by
1
8
6,412
19
Top 1% !
Popular
Famous
Pearl of Wisdom
Tagged
Easy-to-find
Specified
OpenSource
Popularity: 1038th place
Created
Modified Aug 4, 2013

Published on:

Architecturex86_64
LanguagePython
LicenseMIT_X11
Target Frameworkaws

Amazon S3 Aws - How to delete a bucket using boto API

This example shows how to remove a bucket invoking python API provided by boto.    
Important note: the bucket must be empty.
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/4891/Amazon-S3-Aws---How-to-delete-a-bucket-u?startLine=0"></iframe>
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 = '<aws access key>' secret_key = '<aws secret key>' # This code initialize the Amazon S3 connection to your account conn = boto.connect_s3( aws_access_key_id = access_key, aws_secret_access_key = secret_key) # Iteration through all available buckets stored into S3 # Name and creation date are listed for bucket in conn.get_all_buckets(): print "{name}\t{created}".format( name = bucket.name, created = bucket.creation_date, ) # Remove the bucket conn.delete_bucket(bucket.name)

Other Steps and Solutions

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

blog comments powered by Disqus