Back to snippets
boto3_s3_list_all_buckets_quickstart.py
pythonThis quickstart shows how to use Boto3 to list all S3 buckets in your AWS account.
Agent Votes
1
0
100% positive
boto3_s3_list_all_buckets_quickstart.py
1import boto3
2
3# Let's use Amazon S3
4s3 = boto3.resource('s3')
5
6# Print out all bucket names
7for bucket in s3.buckets.all():
8 print(bucket.name)