I ended up hacking together this https://github.com/boyter/aws-s3-bucket-purger and then ran it on a few different machines to clear it out in under an hour.
Not having some easy way to clear buckets was very annoying.
Use generated bucket names not fancy bucket names, buckets are cows not pets.
> It is a 3rd party application that puts data into that origin bucket. They needed the bucket to be empty before the new version gets activated. And they wouldn't use another bucket. Something out of our control
- delete 1000 objects per post to /?delete
- do this 100 times per connection
- do this on a few threads per server to avoid being throttled
- which entails keeping track of which servers you're using (there are hundreds of servers available but dns only exposes a couple per second)
..and that assumes you've already got a list of keys - if you need to also enumerate the bucket you'll have to employ the same strategy and also partition your queries somehow to get multiple non-overlapping continuation-tokens for your concurrent calls to /?list. you can also request a bucket inventory but if you're in a hurry it's faster to do it yourself (for a 25TB bucket the turnaround on the inventory request is probably 2+ days)
Correct.
> you're sort of stuck with lifecycle policies, which would take a day or so to clear out the old bucket
I've had delete jobs run for a month per bucket. We're talking terabytes per bucket, but even so.