3 ms·
A fun corollary of this issue: Deleting an S3 bucket is nontrivial! You can't delete a bucket with objects in it. And you can't just tell S3 to delete all the
by jameshart 3y ago
A fun corollary of this issue:
Deleting an S3 bucket is nontrivial!
You can't delete a bucket with objects in it. And you can't just tell S3 to delete all the objects. You need to send individual API requests to S3 to delete each object. Which means sending requests to S3 to list out the objects, 1000 at a time. Which takes time. And those list calls cost money to execute.
This is a good summary of the situation: https://cloudcasts.io/article/deleting-an-s3-bucket-costs-money https://cloudcasts.io/article/deleting-an-s3-bucket-costs-mo...
The fastest way to quickly dispose of an S3 bucket turns out to be to delete the AWS account it belongs to.
- deleted 3y ago[deleted]
- electroly 3y agoNo, don't do that. Set up a lifecycle rule that expires all of the objects and wait 24 hours. You won't pay for API calls and even the cost of storing the objects themselves is waived once they are marked for expiration. The article has a mistake about this too: expirations do NOT count as lifecycle transitions and you don't get charged as such. You will, of course, get charged if you prematurely delete objects that are in a storage class with a minimum storage duration that they haven't reached yet. This is what they're actually talking about when they mention Infrequent Access and other lower tiers.
- jameshart 3y agoStill counts as nontrivial.
- electroly 3y agoThis is really easy; much easier than trying to delete them by hand. AWS does all the work for you. It takes longer to log into the AWS Management Console than it does to set up this lifecycle rule.
- orf 3y agoLiterally 1 API call.
- jameshart 3y agoTwo. The one to set up the lifecycle rule. Then the one to delete the bucket, some number of hours later.
- orf 3y agoIncorrect. One call to trigger a step function that sets up the lifecycle rule, sleeps for 24 hours and then deletes the bucket. Stop being silly, as if 1 vs 2 API calls matters. You should empty large buckets with lifecycle policies. It's trivial.
- jameshart 3y agoImagine for a second you’re a Unix user, familiar with the rm command. Imagine you are using windows for the first time and you want to delete a directory, so you find an answer on Serverfault that explains that to do so you need to spin up a COM object that marks the directory for deletion, then the next day comes back and deletes it. You might be inclined to say ‘that seems overly complicated’. The original answerer is confused though. ‘It’s trivial, stop being silly. Can you think of a simpler way to delete a directory?’ Do you see now why I thought the ‘non triviality’ of deleting an S3 bucket was perhaps relevant in a discussion on an article about why S3 is both simpler and more complex than a file system? And why your approach might not actually be making the case for it being as simple as you think?
- orf 3y agoRight click, move to recycle bin, wait for the progress bar to finish. Except the progress bar takes a day or so. This is only needed if you have a huge (100 million+) bucket, at which point you should be experienced with s3, otherwise you can just click the big, clear and obvious “empty bucket” button on the console.