Back to snippets

boto3_s3_list_all_buckets_quickstart.py

python

This quickstart demonstrates how to use Boto3 (the AWS SDK for Python) to list

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