Chapter 3. Listing available Amazon S3 buckets using notebook cells
You can check which buckets you have access to by listing the buckets available to your account.
Prerequisites
- Configure an Amazon S3 client in a previous cell in the notebook. See Creating an Amazon S3 client using notebook cells for more information.
Procedure
Create a new notebook cell and use the
s3_client
to list available buckets.s3_client.list_buckets()
You can make this list of buckets easier to read by only printing the name, rather than the full response, for example:
for bucket in s3_client.list_buckets()['Buckets']: print(bucket['Name'])
This returns output similar to the following:
my-app-asdf3-image-registry-us-east-1-wbmlcvbasdgasdgtkpt cf-templates-18rxuasgasgvb-us-east-1