Reputation:
Folks, I want to figure out how to delete all the S3 buckets with Fog without doing a list. I wont be knowing the list of buckets and objects in S3 for an account, and doing a list and then deleting sounds too expensive, isnt there a way to delete all the objects and buckets for an amazon account.
Thanks a lot.
Upvotes: 1
Views: 519
Reputation: 9318
The fog
gem does not support deleting a bucket without deleting its objects first. Unfortunately, you will have to get the object keys (by listing them first), delete the objects (I recommend using the Delete Multiple Objects call), and then deleting the buckets themselves.
Unfortunately, Amazon S3 does not support deleting a bucket that is not empty. Whichever framework/library that you find that has this feature is executing a delete on the objects under the covers before deleting the bucket.
Upvotes: 2