Is there an easy way of deleting an Amazon S3 bucket that has many tens of thousands of objects within it? I've tried s3cmd with --recursive and --force, but it memory-bloats and has been running for days with little effect.

4 Answers 4


The new answer for deleting an Amazon S3 bucket with many thousands or millions of items in it is to use the new Object Expiration rules.

You can even do this from the AWS Console. Simply go to the properties of bucket you want to delete, open the LifeCycle tab and setup a new expiration rule with no prefix and 1 day to expire. Wait one day and the objects will be removed. If you have millions (as I have in my case) you could take a few days before the objects all actually disappear, however, you will be happy to note that you no longer pay for those stored items after the expiration period of 24 hours.

Note: The only limitation on this approach is that you can not set the lifecycle rules if you have versioning enabled.

Object Expiration

  • I don't see this menu anymore in AWS Console, could you please update the post? Thanks
    – Toolkit
    Oct 30, 2017 at 11:31

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.

The documentation for the new feature is available here: http://docs.amazonwebservices.com/AmazonS3/latest/API/index.html?multiobjectdeleteapi.html

For now you'd have to manually use the API for the request, but I would expect that tools like s3cmd will eventually be updated to directly support the feature.

  • Recently? The just sent out the emails today! ;)
    – thinice
    Dec 8, 2011 at 15:00
  • Yep, but if I wrote "Today" it would only have been accurate for a day :-) I remembered seeing this question a while ago, so when I got the e-mail, I came back to answer it. Dec 15, 2011 at 13:13

sync an empty directory to the bucket with the --delete flag.

mkdir tmp-empty-dir
aws s3 sync --delete tmp-empty-dir/ s3://my-bucket

then the bucket will be empty and can be deleted.

  • 2
    that has the same effect as rb - it deletes files one by one
    – Toolkit
    Oct 30, 2017 at 11:33

I use this Java Applet to do this. You can easily select all of your files and delete them.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .