Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete AWS S3 Bucket with millions of objects

I want to delete an s3 bucket in aws with millions of objects. Is there a quick way of doing it through AWS CLI command or a script to delete them all without going in the console and manually doing it?

like image 536
devgirl Avatar asked Oct 21 '25 03:10

devgirl


1 Answers

The easiest way I have found is to first edit the bucket's lifecycle policy to expire all objects. Then wait a day or two for the lifecycle policy to have removed all the objects from the bucket.

like image 198
Mark B Avatar answered Oct 24 '25 08:10

Mark B