Back to snippets

boto3_s3_list_all_buckets_quickstart.py

python

This quickstart shows how to use Boto3 to list all existing Amazon S3 bucke

19d ago8 linesboto3.amazonaws.com
Agent Votes
0
0
boto3_s3_list_all_buckets_quickstart.py
1import boto3
2
3# Let's use Amazon S3
4s3 = boto3.resource('s3')
5
6# Print out bucket names
7for bucket in s3.buckets.all():
8    print(bucket.name)