3
votes

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?

2

2 Answers

1
votes

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.

0
votes

You can use the following to delete the bucket with the object. But i think that can take a lot of time if there are a lot of objects. I think there isn't a really fast way to do this.

aws s3 rb --force s3://your_bucket_name

But perhaps everyone does a better way.