Created
April 30, 2014 06:32
-
-
Save tzangms/92d3fe8aa1b9238642e9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Delete S3 bucket with contents, with S3 Multi-Object Delete. | |
| This script makes you delete S3 bucket quickly. | |
| Before using this script, please install boto | |
| $ pip install boto | |
| and setup ~/.boto config | |
| [Credentials] | |
| aws_access_key_id = <your-access-key> | |
| aws_secret_access_key = <your-secret-key> | |
| """ | |
| from boto.s3.connection import S3Connection | |
| conn = S3Connection() | |
| bucket = conn.get_bucket('<bucket-name>') | |
| while True: | |
| result = bucket.delete_keys(bucket.get_all_keys()) | |
| if not result.deleted: | |
| break | |
| print 'Continue ...' | |
| bucket.delete() | |
| print 'Done' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment