How to remove a bucket with 400 million files on Amazon S3

    Suppose you have several hundred million files accumulated in your bucket (anything can happen) and you decide to delete them. You cannot delete a bucket without deleting the contents. Deleting the files themselves takes about 1000 in 2 seconds. It is easy to calculate that 400 million files can be deleted in 9 days of the browser without shutting down, and you will have to pay for each operation (DELETE, although free, but LIST costs money).

    But it is possible to configure the rules for storing files so that they are deleted automatically:

    1. Go to the Amazon S3 Management Console.
    2. Right-click on the bucket and select Properties.
    3. Expand the Livecycle block on the right side of the screen and click Add Rule.
    4. In the Choose Rule Target window, leave the Whole Bucket.
    5. In the next Configure Rule window, select Permanently Delete Only and in the appeared field of the number of days set 1 (unfortunately, 0 cannot be set).
    6. And in the last Review window, click Create and activate rule.
    7. Wait until tomorrow. Tomorrow the bucket should be empty.

    Also popular now: