<p>I've been interacting with Amazon S3 through <a href="https://addons.mozilla.org/en-US/firefox/addon/3247" rel="noreferrer">S3Fox</a> and I can't seem to delete my buckets. I select a bucket, hit delete, confirm the delete in a popup, and... nothing happens. Is there another tool that I should use?</p>

[{'answer_id': 27285, 'author': 'jsight', 'author_id': 1432, 'author_profile': 'https://Stackoverflow.com/users/1432', 'pm_score': 0, 'selected': False, 'text': "<p>I've always ended up using their C# API and little scripts to do this.  I'm not sure why S3Fox can't do it, but that functionality appears to be broken within it at the moment.  I'm sure that many of the other S3 tools can do it as well, though.</p>\n"}, {'answer_id': 27624, 'author': 'Stu Thompson', 'author_id': 2961, 'author_profile': 'https://Stackoverflow.com/users/2961', 'pm_score': 0, 'selected': False, 'text': '<p>Delete all of the objects in the bucket first.  Then you can delete the bucket itself.  </p>\n\n<p>Apparently, one cannot delete a bucket with objects in it and S3Fox does not do this for you.</p>\n\n<p>I\'ve had other little issues with S3Fox myself, like this, and now use a Java based tool, <a href="https://jets3t.dev.java.net/" rel="nofollow noreferrer">jets3t</a> which is more forthcoming about error conditions.  There must be others, too.</p>\n'}, {'answer_id': 48189, 'author': 'James Murty', 'author_id': 4970, 'author_profile': 'https://Stackoverflow.com/users/4970', 'pm_score': 3, 'selected': False, 'text': '<p>This may be a bug in S3Fox, because it is generally able to delete items recursively. However, I\'m not sure if I\'ve ever tried to delete a whole bucket and its contents at once.</p>\n\n<p>The <a href="http://jets3t.s3.amazonaws.com/index.html" rel="noreferrer">JetS3t</a> project, as mentioned by Stu, includes a Java GUI applet you can easily run in a browser to manage your S3 buckets: <a href="http://jets3t.s3.amazonaws.com/applications/cockpit.html" rel="noreferrer">Cockpit</a>. It has both strengths and weaknesses compared to S3Fox, but there\'s a good chance it will help you deal with your troublesome bucket. Though it will require you to delete the objects first, then the bucket.</p>\n\n<p>Disclaimer: I\'m the author of JetS3t and Cockpit</p>\n'}, {'answer_id': 89659, 'author': 'John Spurlock', 'author_id': 3054, 'author_profile': 'https://Stackoverflow.com/users/3054', 'pm_score': 3, 'selected': False, 'text': '<p><a href="http://www.codeplex.com/spaceblock" rel="noreferrer">SpaceBlock</a> also makes it simple to delete s3 buckets - right click bucket, delete, wait for job to complete in transfers view, done.</p>\n\n<p>This is the free and open source windows s3 front-end that I maintain, so shameless plug alert etc.</p>\n'}, {'answer_id': 307565, 'author': 'Gatorhall', 'author_id': 39527, 'author_profile': 'https://Stackoverflow.com/users/39527', 'pm_score': 0, 'selected': False, 'text': '<p>You must make sure you have correct write permission set for the bucket, and the bucket contains no objects.\nSome useful tools that can assist your deletion: <a href="http://www.crossftp.com/" rel="nofollow noreferrer">CrossFTP</a>, view and delete the buckets like the FTP client. <a href="http://jets3t.s3.amazonaws.com/index.html" rel="nofollow noreferrer">jets3t</a> Tool as mentioned above. </p>\n'}, {'answer_id': 1064777, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 3, 'selected': False, 'text': '<p>With s3cmd:\nCreate a new empty directory\ns3cmd sync --delete-removed empty_directory s3://yourbucket</p>\n'}, {'answer_id': 1123600, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': '<p>I guess the easiest way would be to use <a href="http://s3.amazonaws.com/s3fm/index.html" rel="nofollow noreferrer">S3fm</a>, a free online file manager for Amazon S3. No applications to install, no 3rd party web sites registrations. Runs directly from Amazon S3, secure and convenient. </p>\n\n<p>Just select your bucket and hit delete.   </p>\n'}, {'answer_id': 1179190, 'author': 'MattLor', 'author_id': 144148, 'author_profile': 'https://Stackoverflow.com/users/144148', 'pm_score': 5, 'selected': False, 'text': '<p>Remeber that S3 Buckets need to be empty before they can be deleted. The good news is that most 3rd party tools automate this process. If you are running into problems with S3Fox, I recommend trying S3FM for GUI or S3Sync for command line. Amazon has a great article describing <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=931&amp;categoryID=100" rel="noreferrer">how to use S3Sync</a>. After setting up your variables, the key command is </p>\n\n<pre><code>./s3cmd.rb deleteall &lt;your bucket name&gt;\n</code></pre>\n\n<p>Deleting buckets with lots of individual files tends to crash a lot of S3 tools because they try to display a list of all files in the directory. You need to find a way to delete in batches. The best GUI tool I\'ve found for this purpose is Bucket Explorer. It deletes files in a S3 bucket in 1000 file chunks and does not crash when trying to open large buckets like s3Fox and S3FM.</p>\n\n<p>I\'ve also found a few scripts that you can use for this purpose. I haven\'t tried these scripts yet but they look pretty straightforward. </p>\n\n<p><strong>RUBY</strong></p>\n\n<pre><code>require \'aws/s3\'\n\nAWS::S3::Base.establish_connection!(\n:access_key_id =&gt; \'your access key\',\n:secret_access_key =&gt; \'your secret key\'\n)\n\nbucket = AWS::S3::Bucket.find(\'the bucket name\')\n\nwhile(!bucket.empty?)\nbegin\nputs "Deleting objects in bucket"\n\nbucket.objects.each do |object|\nobject.delete\nputs "There are #{bucket.objects.size} objects left in the bucket"\nend\n\nputs "Done deleting objects"\n\nrescue SocketError\nputs "Had socket error"\nend\n\nend\n</code></pre>\n\n<p><strong>PERL</strong></p>\n\n<pre><code>#!/usr/bin/perl\nuse Net::Amazon::S3;\nmy $aws_access_key_id = \'your access key\';\nmy $aws_secret_access_key = \'your secret access key\';\nmy $increment = 50; # 50 at a time\nmy $bucket_name = \'bucket_name\';\n\nmy $s3 = Net::Amazon::S3-&gt;new({aws_access_key_id =&gt; $aws_access_key_id, aws_secret_access_key =&gt; $aws_secret_access_key, retry =&gt; 1, });\nmy $bucket = $s3-&gt;bucket($bucket_name);\n\nprint "Incrementally deleting the contents of $bucket_name\\n";\n\nmy $deleted = 1;\nmy $total_deleted = 0;\nwhile ($deleted &gt; 0) {\nprint "Loading up to $increment keys...\\n";\n$response = $bucket-&gt;list({\'max-keys\' =&gt; $increment, }) or die $s3-&gt;err . ": " . $s3-&gt;errstr . "\\n";\n$deleted = scalar(@{ $response-&gt;{keys} }) ;\n$total_deleted += $deleted;\nprint "Deleting $deleted keys($total_deleted total)...\\n";\nforeach my $key ( @{ $response-&gt;{keys} } ) {\nmy $key_name = $key-&gt;{key};\n$bucket-&gt;delete_key($key-&gt;{key}) or die $s3-&gt;err . ": " . $s3-&gt;errstr . "\\n";\n}\n}\nprint "Deleting bucket...\\n";\n$bucket-&gt;delete_bucket or die $s3-&gt;err . ": " . $s3-&gt;errstr;\nprint "Done.\\n";\n</code></pre>\n\n<p>SOURCE: Tarkblog</p>\n\n<p>Hope this helps!</p>\n'}, {'answer_id': 1251127, 'author': 'Erik Forsberg', 'author_id': 8675, 'author_profile': 'https://Stackoverflow.com/users/8675', 'pm_score': 1, 'selected': False, 'text': '<p>I hacked together a script for doing it from Python, it successfully removed my 9000 objects. See this page:</p>\n\n<p><a href="https://efod.se/blog/archive/2009/08/09/delete-s3-bucket" rel="nofollow noreferrer">https://efod.se/blog/archive/2009/08/09/delete-s3-bucket</a></p>\n'}, {'answer_id': 1312596, 'author': 'Jaymie Thomas', 'author_id': 7703, 'author_profile': 'https://Stackoverflow.com/users/7703', 'pm_score': 0, 'selected': False, 'text': '<p>I\'ll have to have a look at some of these alternative file managers.  I\'ve used (and like) BucketExplorer, which you can get from - surprisingly - <a href="http://www.bucketexplorer.com/" rel="nofollow noreferrer">http://www.bucketexplorer.com/</a>.</p>\n\n<p>It\'s a 30 day free trial, then (currently) costing US$49.99 per licence (US$49.95 on the purchase cover page).</p>\n'}, {'answer_id': 1473333, 'author': 'SFEley', 'author_id': 145809, 'author_profile': 'https://Stackoverflow.com/users/145809', 'pm_score': 1, 'selected': False, 'text': '<p>One more shameless plug: I got tired of waiting for individual HTTP delete requests when I had to delete 250,000 items, so I wrote a Ruby script that does it multithreaded and completes in a fraction of the time:</p>\n\n<p><a href="http://github.com/sfeley/s3nuke/" rel="nofollow noreferrer">http://github.com/sfeley/s3nuke/</a></p>\n\n<p>This is one that works much faster in Ruby 1.9 because of the way threads are handled.</p>\n'}, {'answer_id': 1829655, 'author': 'robbyt', 'author_id': 222500, 'author_profile': 'https://Stackoverflow.com/users/222500', 'pm_score': 4, 'selected': False, 'text': '<p>recent versions of s3cmd have --recursive </p>\n\n<p>e.g., </p>\n\n<pre><code>~/$ s3cmd rb --recursive s3://bucketwithfiles\n</code></pre>\n\n<p><a href="http://s3tools.org/kb/item5.htm" rel="noreferrer">http://s3tools.org/kb/item5.htm</a></p>\n'}, {'answer_id': 2613235, 'author': 'aws', 'author_id': 313442, 'author_profile': 'https://Stackoverflow.com/users/313442', 'pm_score': 0, 'selected': False, 'text': '<p>Try <a href="https://s3explorer.appspot.com/" rel="nofollow noreferrer">https://s3explorer.appspot.com/</a> to manage your S3 account.</p>\n'}, {'answer_id': 3848338, 'author': 'sent-hil', 'author_id': 236655, 'author_profile': 'https://Stackoverflow.com/users/236655', 'pm_score': 0, 'selected': False, 'text': '<p>This is what I use. Just simple ruby code.</p>\n\n<pre><code>case bucket.size\n  when 0\n    puts "Nothing left to delete"\n  when 1..1000\n    bucket.objects.each do |item|\n      item.delete\n      puts "Deleting - #{bucket.size} left"        \n    end\nend\n</code></pre>\n'}, {'answer_id': 3951883, 'author': 'Jonathan Kamens', 'author_id': 478321, 'author_profile': 'https://Stackoverflow.com/users/478321', 'pm_score': 1, 'selected': False, 'text': '<p>This is a hard problem. My solution is at <a href="http://stuff.mit.edu/~jik/software/delete-s3-bucket.pl.txt" rel="nofollow">http://stuff.mit.edu/~jik/software/delete-s3-bucket.pl.txt</a>. It describes all of the things I\'ve determined can go wrong in a comment at the top. Here\'s the current version of the script (if I change it, I\'ll put a new version at the URL but probably not here).</p>\n\n<pre><code>#!/usr/bin/perl\n\n# Copyright (c) 2010 Jonathan Kamens.\n# Released under the GNU General Public License, Version 3.\n# See &lt;http://www.gnu.org/licenses/&gt;.\n\n# $Id: delete-s3-bucket.pl,v 1.3 2010/10/17 03:21:33 jik Exp $\n\n# Deleting an Amazon S3 bucket is hard.\n#\n# * You can\'t delete the bucket unless it is empty.\n#\n# * There is no API for telling Amazon to empty the bucket, so you have to\n# delete all of the objects one by one yourself.\n#\n# * If you\'ve recently added a lot of large objects to the bucket, then they\n# may not all be visible yet on all S3 servers. This means that even after the\n# server you\'re talking to thinks all the objects are all deleted and lets you\n# delete the bucket, additional objects can continue to propagate around the S3\n# server network. If you then recreate the bucket with the same name, those\n# additional objects will magically appear in it!\n# \n# It is not clear to me whether the bucket delete will eventually propagate to\n# all of the S3 servers and cause all the objects in the bucket to go away, but\n# I suspect it won\'t. I also suspect that you may end up continuing to be\n# charged for these phantom objects even though the bucket they\'re in is no\n# longer even visible in your S3 account.\n#\n# * If there\'s a CR, LF, or CRLF in an object name, then it\'s sent just that\n# way in the XML that gets sent from the S3 server to the client when the\n# client asks for a list of objects in the bucket. Unfortunately, the XML\n# parser on the client will probably convert it to the local line ending\n# character, and if it\'s different from the character that\'s actually in the\n# object name, you then won\'t be able to delete it. Ugh! This is a bug in the\n# S3 protocol; it should be enclosing the object names in CDATA tags or\n# something to protect them from being munged by the XML parser.\n#\n# Note that this bug even affects the AWS Web Console provided by Amazon!\n#\n# * If you\'ve got a whole lot of objects and you serialize the delete process,\n# it\'ll take a long, long time to delete them all.\n\nuse threads;\nuse strict;\nuse warnings;\n\n# Keys can have newlines in them, which screws up the communication\n# between the parent and child processes, so use URL encoding to deal\n# with that. \nuse CGI qw(escape unescape); # Easiest place to get this functionality.\nuse File::Basename;\nuse Getopt::Long;\nuse Net::Amazon::S3;\n\nmy $whoami = basename $0;\nmy $usage = "Usage: $whoami [--help] --access-key-id=id --secret-access-key=key\n --bucket=name [--processes=#] [--wait=#] [--nodelete]\n\n    Specify --processes to indicate how many deletes to perform in\n    parallel. You\'re limited by RAM (to hold the parallel threads) and\n    bandwidth for the S3 delete requests.\n\n    Specify --wait to indicate seconds to require the bucket to be verified\n    empty. This is necessary if you create a huge number of objects and then\n    try to delete the bucket before they\'ve all propagated to all the S3\n    servers (I\'ve seen a huge backlog of newly created objects take *hours* to\n    propagate everywhere). See the comment at the top of the script for more\n    information about this issue.\n\n    Specify --nodelete to empty the bucket without actually deleting it.\\n";\n\nmy($aws_access_key_id, $aws_secret_access_key, $bucket_name, $wait);\nmy $procs = 1;\nmy $delete = 1;\n\ndie if (! GetOptions(\n       "help" =&gt; sub { print $usage; exit; },\n       "access-key-id=s" =&gt; \\$aws_access_key_id,\n       "secret-access-key=s" =&gt; \\$aws_secret_access_key,\n       "bucket=s" =&gt; \\$bucket_name,\n       "processess=i" =&gt; \\$procs,\n       "wait=i" =&gt; \\$wait,\n       "delete!" =&gt; \\$delete,\n ));\ndie if (! ($aws_access_key_id &amp;&amp; $aws_secret_access_key &amp;&amp; $bucket_name));\n\nmy $increment = 0;\n\nprint "Incrementally deleting the contents of $bucket_name\\n";\n\n$| = 1;\n\nmy(@procs, $current);\nfor (1..$procs) {\n    my($read_from_parent, $write_to_child);\n    my($read_from_child, $write_to_parent);\n    pipe($read_from_parent, $write_to_child) or die;\n    pipe($read_from_child, $write_to_parent) or die;\n    threads-&gt;create(sub {\n close($read_from_child);\n close($write_to_child);\n my $old_select = select $write_to_parent;\n $| = 1;\n select $old_select;\n &amp;child($read_from_parent, $write_to_parent);\n      }) or die;\n    close($read_from_parent);\n    close($write_to_parent);\n    my $old_select = select $write_to_child;\n    $| = 1;\n    select $old_select;\n    push(@procs, [$read_from_child, $write_to_child]);\n}\n\nmy $s3 = Net::Amazon::S3-&gt;new({aws_access_key_id =&gt; $aws_access_key_id,\n          aws_secret_access_key =&gt; $aws_secret_access_key,\n          retry =&gt; 1,\n         });\nmy $bucket = $s3-&gt;bucket($bucket_name);\n\nmy $deleted = 1;\nmy $total_deleted = 0;\nmy $last_start = time;\nmy($start, $waited);\nwhile ($deleted &gt; 0) {\n    $start = time;\n    print "\\nLoading ", ($increment ? "up to $increment" :\n    "as many as possible")," keys...\\n";\n    my $response = $bucket-&gt;list({$increment ? (\'max-keys\' =&gt; $increment) : ()})\n or die $s3-&gt;err . ": " . $s3-&gt;errstr . "\\n";\n    $deleted = scalar(@{ $response-&gt;{keys} }) ;\n    if (! $deleted) {\n if ($wait and ! $waited) {\n     my $delta = $wait - ($start - $last_start);\n     if ($delta &gt; 0) {\n  print "Waiting $delta second(s) to confirm bucket is empty\\n";\n  sleep($delta);\n  $waited = 1;\n  $deleted = 1;\n  next;\n     }\n     else {\n  last;\n     }\n }\n else {\n     last;\n }\n    }\n    else {\n $waited = undef;\n    }\n    $total_deleted += $deleted;\n    print "\\nDeleting $deleted keys($total_deleted total)...\\n";\n    $current = 0;\n    foreach my $key ( @{ $response-&gt;{keys} } ) {\n my $key_name = $key-&gt;{key};\n while (! &amp;send(escape($key_name) . "\\n")) {\n     print "Thread $current died\\n";\n     die "No threads left\\n" if (@procs == 1);\n     if ($current == @procs-1) {\n  pop @procs;\n  $current = 0;\n     }\n     else {\n  $procs[$current] = pop @procs;\n     }\n }\n $current = ($current + 1) % @procs;\n threads-&gt;yield();\n    }\n    print "Sending sync message\\n";\n    for ($current = 0; $current &lt; @procs; $current++) {\n if (! &amp;send("\\n")) {\n     print "Thread $current died sending sync\\n";\n     if ($current = @procs-1) {\n  pop @procs;\n  last;\n     }\n     $procs[$current] = pop @procs;\n     $current--;\n }\n threads-&gt;yield();\n    }\n    print "Reading sync response\\n";\n    for ($current = 0; $current &lt; @procs; $current++) {\n if (! &amp;receive()) {\n     print "Thread $current died reading sync\\n";\n     if ($current = @procs-1) {\n  pop @procs;\n  last;\n     }\n     $procs[$current] = pop @procs;\n     $current--;\n }\n threads-&gt;yield();\n    }    \n}\ncontinue {\n    $last_start = $start;\n}\n\nif ($delete) {\n    print "Deleting bucket...\\n";\n    $bucket-&gt;delete_bucket or die $s3-&gt;err . ": " . $s3-&gt;errstr;\n    print "Done.\\n";\n}\n\nsub send {\n    my($str) = @_;\n    my $fh = $procs[$current]-&gt;[1];\n    print($fh $str);\n}\n\nsub receive {\n    my $fh = $procs[$current]-&gt;[0];\n    scalar &lt;$fh&gt;;\n}\n\nsub child {\n    my($read, $write) = @_;\n    threads-&gt;detach();\n    my $s3 = Net::Amazon::S3-&gt;new({aws_access_key_id =&gt; $aws_access_key_id,\n       aws_secret_access_key =&gt; $aws_secret_access_key,\n       retry =&gt; 1,\n      });\n    my $bucket = $s3-&gt;bucket($bucket_name);\n    while (my $key = &lt;$read&gt;) {\n if ($key eq "\\n") {\n     print($write "\\n") or die;\n     next;\n }\n chomp $key;\n $key = unescape($key);\n if ($key =~ /[\\r\\n]/) {\n     my(@parts) = split(/\\r\\n|\\r|\\n/, $key, -1);\n     my(@guesses) = shift @parts;\n     foreach my $part (@parts) {\n  @guesses = (map(($_ . "\\r\\n" . $part,\n     $_ . "\\r"   . $part,\n     $_ . "\\n"   . $part), @guesses));\n     }\n     foreach my $guess (@guesses) {\n  if ($bucket-&gt;get_key($guess)) {\n      $key = $guess;\n      last;\n  }\n     }\n }\n $bucket-&gt;delete_key($key) or\n     die $s3-&gt;err . ": " . $s3-&gt;errstr . "\\n";\n print ".";\n threads-&gt;yield();\n    }\n    return;\n}\n</code></pre>\n'}, {'answer_id': 4550709, 'author': 'mfonda', 'author_id': 492401, 'author_profile': 'https://Stackoverflow.com/users/492401', 'pm_score': 2, 'selected': False, 'text': '<p>One technique that can be used to avoid this problem is putting all objects in a "folder" in the bucket, allowing you to just delete the folder then go along and delete the bucket. Additionally, the s3cmd tool available from <a href="http://s3tools.org" rel="nofollow">http://s3tools.org</a> can be used to delete a bucket with files in it:</p>\n\n<pre><code>s3cmd rb --force s3://bucket-name\n</code></pre>\n'}, {'answer_id': 4601993, 'author': 'Maxim Veksler', 'author_id': 48062, 'author_profile': 'https://Stackoverflow.com/users/48062', 'pm_score': 2, 'selected': False, 'text': '<p>I\'ve implemented <strong>bucket-destroy</strong>, a multi threaded utility that does everything it takes to delete a bucket. I handle non empty buckets, as well as version enabled bucket keys.</p>\n\n<p>You can read the blog post here <a href="http://bytecoded.blogspot.com/2011/01/recursive-delete-utility-for-version.html" rel="nofollow">http://bytecoded.blogspot.com/2011/01/recursive-delete-utility-for-version.html</a> and the instructions here <a href="http://code.google.com/p/bucket-destroy/" rel="nofollow">http://code.google.com/p/bucket-destroy/</a></p>\n\n<p>I\'ve successfully deleted with it a bucket that contains double \'//\' in the key name, versioned key and DeleteMarker keys. Currently I\'m running it on a bucket that contains ~40,000,000 so far I\'ve been able to delete 1,200,000 in several hours on m1.large. Note that the utility is multi threaded but does not (yet) implemented shuffling (which will horizontal scaling, launching the utility on several machines).</p>\n'}, {'answer_id': 4884006, 'author': 'Hein B', 'author_id': 169787, 'author_profile': 'https://Stackoverflow.com/users/169787', 'pm_score': -1, 'selected': False, 'text': '<p>Use the amazon web managment console. With Google chrome for speed. Deleted the objects a lot faster than firefox (about 10 times faster). Had 60 000 objects to delete.</p>\n'}, {'answer_id': 5558747, 'author': 'Doug', 'author_id': 693793, 'author_profile': 'https://Stackoverflow.com/users/693793', 'pm_score': 2, 'selected': False, 'text': "<p>If you use amazon's console and on a one-time basis need to clear out a bucket: You can browse to your bucket then select the top key then scroll to the bottom and then press shift on your keyboard then click on the bottom one. It will select all in between then you can right click and delete.</p>\n"}, {'answer_id': 7427700, 'author': 'Željko Filipin', 'author_id': 17469, 'author_profile': 'https://Stackoverflow.com/users/17469', 'pm_score': 2, 'selected': False, 'text': '<p>If you have <a href="http://www.ruby-lang.org/en/" rel="nofollow">ruby</a> (and <a href="https://rubygems.org/" rel="nofollow">rubygems</a>) installed, install <a href="http://amazon.rubyforge.org/" rel="nofollow">aws-s3</a> gem with</p>\n\n<pre><code>gem install aws-s3\n</code></pre>\n\n<p>or </p>\n\n<pre><code>sudo gem install aws-s3\n</code></pre>\n\n<p>create a file <code>delete_bucket.rb</code>:</p>\n\n<pre><code>require "rubygems" # optional\nrequire "aws/s3"\nAWS::S3::Base.establish_connection!(\n  :access_key_id     =&gt; \'access_key_id\',\n  :secret_access_key =&gt; \'secret_access_key\')\nAWS::S3::Bucket.delete("bucket_name", :force =&gt; true)\n</code></pre>\n\n<p>and run it:</p>\n\n<pre><code>ruby delete_bucket.rb\n</code></pre>\n\n<p>Since <code>Bucket#delete</code> returned timeout exceptions a lot for me, I have expanded the script:</p>\n\n<pre><code>require "rubygems" # optional\nrequire "aws/s3"\nAWS::S3::Base.establish_connection!(\n  :access_key_id     =&gt; \'access_key_id\',\n  :secret_access_key =&gt; \'secret_access_key\')\nwhile AWS::S3::Bucket.find("bucket_name")\n  begin\n    AWS::S3::Bucket.delete("bucket_name", :force =&gt; true)\n  rescue\n  end\nend\n</code></pre>\n'}, {'answer_id': 7763301, 'author': 'user98865', 'author_id': 994768, 'author_profile': 'https://Stackoverflow.com/users/994768', 'pm_score': 1, 'selected': False, 'text': '<p>I am one of the Developer Team member of Bucket Explorer Team, We will provide different option to delete Bucket as per the users choice...\n1) Quick Delete -This option will delete you data from bucket in chunks of 1000.\n2) Permanent Delete-This option will Delete objects in queue.</p>\n\n<p><a href="http://www.bucketexplorer.com/documentation/amazon-s3--how-to-delete-files-and-bucket.html" rel="nofollow">How to delete Amazon S3 files and bucket?</a> </p>\n'}, {'answer_id': 8431389, 'author': 'Andrew Maiman', 'author_id': 754526, 'author_profile': 'https://Stackoverflow.com/users/754526', 'pm_score': 1, 'selected': False, 'text': '<p>Amazon recently added a new feature, "Multi-Object Delete", which allows up to 1,000 objects to be deleted at a time with a single API request.  This should allow simplification of the process of deleting huge numbers of files from a bucket.</p>\n\n<p>The documentation for the new feature is available here: <a href="http://docs.amazonwebservices.com/AmazonS3/latest/dev/DeletingMultipleObjects.html" rel="nofollow">http://docs.amazonwebservices.com/AmazonS3/latest/dev/DeletingMultipleObjects.html</a></p>\n'}, {'answer_id': 9015858, 'author': 'chris14679', 'author_id': 711821, 'author_profile': 'https://Stackoverflow.com/users/711821', 'pm_score': 7, 'selected': False, 'text': '<p>It is finally possible to delete all the files in one go using the new Lifecycle (expiration) rules feature. You can even do it from the AWS console.</p>\n\n<p>Simply right click on the bucket name in AWS console, select "Properties" and then in the row of tabs at the bottom of the page select "lifecycle" and "add rule". Create a lifecycle rule with the "Prefix" field set blank (blank means all files in the bucket, or you could set it to "a" to delete all files whose names begin with "a"). Set the "Days" field to "1". That\'s it. Done. Assuming the files are more than one day old they should all get deleted, then you can delete the bucket.</p>\n\n<p>I only just tried this for the first time so I\'m still waiting to see how quickly the files get deleted (it wasn\'t instant but presumably should happen within 24 hours) and whether I get billed for one delete command or 50 million delete commands... fingers crossed!</p>\n'}]
['https://Stackoverflow.com/questions/27267', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/658/']