{"id":4480,"date":"2011-11-12T19:16:32","date_gmt":"2011-11-12T13:46:32","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=4480"},"modified":"2016-12-19T15:30:12","modified_gmt":"2016-12-19T10:00:12","slug":"how-to-delete-all-contentsobjects-of-amazon-s3-bucket","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/how-to-delete-all-contentsobjects-of-amazon-s3-bucket\/","title":{"rendered":"How to delete all contents\/objects of Amazon S3 bucket"},"content":{"rendered":"<p>If you have an S3 bucket with a huge number of files, and you want to delete the bucket, you need to empty the bucket first. If the bucket has a handful of files, then it is easy enough from the AWS interface, but if the bucket has a large number of files, then AWS interface is not an option; and you must use <a href=\"http:\/\/s3tools.org\/s3cmd\">s3cmd<\/a> or may be some other tool which allows this.<br \/>\n<\/br><br \/>\ns3cmd is a command-line tool for manipulating S3 buckets and objects; and as you would expect, it does have a way to recursively delete all objects in a bucket.<br \/>\n<\/br><\/p>\n<div id=\"_mcePaste\"><strong><em>s3cmd del &#8211;recursive &#8211;force &lt;bucket_url&gt;<\/em><\/strong><\/div>\n<p><\/br><\/p>\n<div>What&#8217;s annoying is that S3 does not provide this capability natively. The above command probably simply lists all the objects first internally; and then makes a delete call on each object.<\/div>\n<p><\/br>It took me a while to figure this out, because it does not seem to be documented, I found this in one of the comments on <a href=\"http:\/\/s3tools.org\/s3cmd\" target=\"_blank\">S3cmd page<\/a>.<br \/>\n<\/br>-Deepak<\/p>\n<p><\/br><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>If you have an S3 bucket with a huge number of files, and you want to delete the bucket, you need to empty the bucket first. If the bucket has a handful of files, then it is easy enough from the AWS interface, but if the bucket has a large number of files, then AWS [&hellip;]<\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":8},"categories":[1174],"tags":[670,671],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/4480"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=4480"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/4480\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=4480"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=4480"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=4480"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}