devgirl
devgirl

Reputation: 783

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?

Upvotes: 4

Views: 2561

Answers (2)

Mark B
Mark B

Reputation: 200682

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.

Upvotes: 2

René Höhle
René Höhle

Reputation: 27295

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.

Upvotes: 0

Related Questions