How to empty the bucket?

How to empty the the bucket?

ClearBucket class and clearBucket method no longer exist. I need to delete the bucket and before the bucket could be deleted, it is mandatory to empty the bucket?


ANSWERS:


Docs:

You have 3 options:

  • if you no longer need the bucket you just delete the bucket. (you can also delete and recreate the bucket but there are no guarantees you're going to be able to recreate - ie if someone else creates a bucket with same name after you delete it you cannot use that name as bucket names are unique)
  • if you still need the bucket, you list the objects in the bucket and iterate over them issuing a delete request for each object.
  • if you still need the bucket, you could setup a life-cycle policy that deletes objects older than X and just wait X. S3 will kill everything in the bucket for you.


 MORE:


 ? AWS API: How to write code that checks whether a file exists in a specific bucket?
 ? Fatest way to retrieve S3 objects metadata (NodeJS API)
 ? Time to live for SimpleDB or DynamoDB
 ? Time to live for SimpleDB or DynamoDB
 ? Time to live for SimpleDB or DynamoDB
 ? Scaling MongoDB on EC2 or should I just switch to DynamoDB?
 ? Is Amazon SimpleDB more reliable/available than DynamoDB?
 ? Amazon SimpleDB or DynamoDB
 ? Time to live of a item in dynamodb
 ? AWS SimpleDB how to setup