Created
October 29, 2013 20:56
-
-
Save JNajera/7222443 to your computer and use it in GitHub Desktop.
Delete all Amazon S3 buckets in console.
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
| require "rubygems" # optional | |
| require "aws/s3" | |
| AWS::S3::Base.establish_connection!( | |
| :access_key_id => 'INSERT_ACCESES_KEY_ID', | |
| :secret_access_key => 'INSERT_SECRET_ACCESES_KEY') | |
| buckets = AWS::S3::Service.buckets | |
| puts 'Start deleting buckets...' | |
| buckets.each_with_index do |bucket, index| | |
| puts "Deleting #{bucket.name} bucket... (#{index+1}/#{buckets.count})" | |
| AWS::S3::Bucket.delete(bucket.name, :force => true) | |
| end | |
| puts 'S3 buckets deleted...' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment