Object versioning is a powerful feature of Amazon S3. When you enable object versioning on your S3 bucket, S3 will automatically preserve previous versions of your objects. This allows you to retrieve previous versions in cases of incorrect overwrites or accidental deletion.
However, by preserving previous versions of your objects, you will be charged for the storage occupied by those older versions. For example, if you have an object of 100 megabytes and you overwrite it with an object of 50 megabytes, you will be charged for 150 megabytes.
Amazon S3 does include some lifecycle features with which you can delete previous versions once they reach a certain age. Using this feature, you can remove all older versions once they are 30 days old, for example. Going back to our previous example, the 100 megabyte version could be erased after 30 days. After that, you would only be charged for the 50 megabyte version.
When you delete an object in a version-enabled bucket, the previous versions are maintained as well. This allows you to “undelete” the file in case the file was incorrectly deleted.
There are many cases where all previous versions of existing files should be preserved, but deleted files should be erased completely. But Amazon S3 lifecycles does not provide a solution for these cases.
This can lead to a hidden (and constantly accumulating) cost on your AWS bill.
We’ve made available a new action for this use-case: Erase Deleted S3 Objects. This action will examine your S3 bucket (with an optional prefix) and permanently delete old versions of any files which have been deleted. Existing objects and their previous versions are not affected.
This action includes a test mode which you can use to inspect the bucket without deleting anything. This way, you can check for any benefits you could receive by erasing deleting objects.
Full pricing information for this new action can be found on our pricing page.
This new action is available today.