Why aren't my retention policies deleting Amazon EBS snapshots that are created by Amazon Data Lifecycle Manager?
Last updated: 2023-01-09
I'm using Amazon Data Lifecycle Manager to create Amazon Elastic Block Store (Amazon EBS) snapshot policies with a retention schedule. However, the lifecycle policy isn't deleting the snapshots.
If the lifecycle policy that you created using Data Lifecycle Manager isn't deleting the snapshots, then consider the following scenarios.
Note: You can't use Data Lifecycle Manager to manage snapshots that you created outside of Amazon Data Lifecycle Manager. Also, make sure that the lifecycle policy is in the enabled state.
Updated schedule names
If you change your lifecycle schedule name, then Data Lifecycle Manager doesn't delete snapshots that were created under the old schedule name. Be sure to delete any unwanted snapshots before you update your schedule name.
Age-based retention policies
An age-based retention policy deletes up to only the last snapshot from the standard and archive tiers. The policy doesn't delete the last snapshot. For example, you delete a volume or terminate an instance that's managed by an age-based retention policy. However, you still see an undeleted snapshot that's targeted by an age-based retention policy. You must use the Amazon Elastic Compute Cloud (Amazon EC2) console or AWS Command Line Interface (AWS CLI) to delete the last snapshot. It's a best practice to have a backup of the volume in case of a rollback.
If Data Lifecycle Manager is turned off or in an error state, then snapshots and AMIs are retained from that period. This is true even if the snapshots and AMIs were set to expire during that time. Instead, you must manually delete the snapshots or deregister the AMIs.
Count-based retention policies
If you delete a volume or terminate an instance that's managed by a count-based retention policy, then the policy no longer manages the snapshots. You must use the Amazon EC2 console or AWS CLI to delete the snapshots. Also, if you modify or remove tags that are associated with your target resources, then Amazon Data Lifecycle Manager no longer manages the snapshot.
After a count-based policy creates a snapshot and the retention number is already reached, the policy deletes the oldest snapshot. For example, you specify a count-based policy with a retention of 10. After the policy creates the 11th snapshot, the oldest snapshot is deleted. This is also true if you manually delete a snapshot that's created by a lifecycle policy with a count-based retention. Continuing the example, Amazon Data Lifecycle Manager waits until the policy creates the 11th snapshot to delete the oldest snapshot.