How do I empty an Amazon S3 bucket using a lifecycle configuration rule?
I have an Amazon Simple Storage Service (Amazon S3) bucket that stores millions of objects. I want to empty the bucket using a lifestyle configuration rule so that I won't be charged for storage anymore.
"I have an Amazon Simple Storage Service (Amazon S3) bucket that stores millions of objects. I want to empty the bucket using a lifestyle configuration rule so that I won't be charged for storage anymore.ResolutionFollow these steps to create a lifecycle configuration rule that expires current versions of objects and permanently delete previous versions of objects:1.    Open the Amazon S3 console.2.    From the list of buckets, choose the bucket that you want to empty.3.    Choose the Management tab.4.    Choose Create lifecycle rule.5.    For Lifecycle rule name, enter a rule name.6.    For Choose a rule scope, select This rule applies to all objects in the bucket.7.    Select I acknowledge that this rule will apply to all objects in the bucket.8.    For Lifecycle rule actions, select the following to create a lifecycle rule:Expire current versions of objectsPermanently delete previous versions of objectsDelete expired delete markers or incomplete multipart uploads9.    In the Expire current versions of objects field, enter "1" in the Days after object creation field.10.    In the Permanently delete previous versions of objects field, enter "1" in the Number of days after objects become noncurrent field.11.    Leave the Number of newer versions to retain field empty to delete all versions.12.    Select Delete incomplete multipart uploads and enter "1" for the Number of days field.13.    Choose Create rule.14.    Create a second lifecycle rule by repeating steps 4-7.15.    Then, select the following: Delete expired delete markers or incomplete multipart uploads16.    Select Delete expired object delete markers.17.    Choose Create rule.Amazon S3 runs lifecycle rules once every day. After the first time that Amazon S3 runs the rules, all objects that are eligible for expiration are marked for deletion. You're no longer charged for objects that are marked for deletion. However, rules might take a few days to run before the bucket is empty because expiring object versions and cleaning up delete markers are asynchronous steps. For more information about this asynchronous object removal in Amazon S3, see Expiring objects.Related informationRemoving expired object delete markersManaging your storage lifecycleHow do I delete Amazon S3 objects and buckets?Deleting a bucketFollow"