Amazon S3 Aws - Listing Owned Buckets using boto api

This code returns  a list of Buckets that you own, invoking get\_all\_buckets() method. 
For each bucket you can get  name and creation date.
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
import boto import boto.s3.connection access_key = 'put your access key here!' secret_key = 'put your secret key here!' # Setup Amazon S3 connection conn = boto.connect_s3( aws_access_key_id = access_key, aws_secret_access_key = secret_key) # Iteration on all buckets get from get_all_buckets() method # For each bucket object the name and creation date is shown for bucket in conn.get_all_buckets(): print "{name}\t{created}".format( name =, created = bucket.creation_date, )

Other Steps and Solutions

If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus