Cleanup may not delete snapshots older than the defined retention for the policy
CPM removes the snapshots in accordance with defined retention policies.
However, only successful backups are counted towards the retention.
It is crucial to understand what a "successful backup" is.
A "successful backup" is a backup that has both completed backup and replication of all its snapshots without issues.
If a single snapshot in a policy that backups 100 volumes fails, this backup won't count.
If this continues, you may end up with a larger than expected amount of snapshots in your account and a heavier bill from AWS as a result.
By default, only backups with a status "Backup Successful" are counted towards retention:
You can change this behavior by changing the "backup is successful
when" setting in the "more options" screen of a policy,:
If you'll select the second option, backups that are
"Partially Successful" will now count as well:
Please keep in mind, that if you choose to ignore the output of scripts/VSS, you may end up with snapshots that are only crash consistent instead of fully consistent.
It is recommended to resolve your problems with scripts/VSS instead of ignoring them.
Here's an actual example that will explain the Generations to save better:
CPM will cleanup out of retention snapshots (successful or failed) only when it has enough successful backups as you configured in your policy's retention (Generations to save).
Let's assume you have a daily policy that runs on 2 instances and is supposed to save 3 generations per instance so you expect to have 6 snapshots on EC2 after it ran 3 days and on, right?
On day 1 it runs and succeeds on both instances = 2 snapshots. Successful backup
On day 2 it runs but only the first instance is successfully backed up so now you have 3 snapshots. This is not considered as a successful backup.
On day 3 it runs again but only the first instance is successfully backed up so now you have 4 snapshots. This is not considered as a successful backup.
On day 4 it runs and succeeds = 6 snapshots (none is deleted because you only have 2 successful backups, not 3). Successful backup
On day 5 it runs and succeeds = 8 snapshots (none is deleted because you only have 3 successful backups) - on this day you'll pay for extra 2 snapshots. Successful backup
Cleanup process iwll still not clean the failed backups since they're still within the retention period.
On day 6 it runs and succeeds = 6 snapshots (day 1,2 and 3 snapshots are deleted). Here, cleanup will clean the older successful ones as well as the failed ones.
The good backups don't necessarily have to be one after the other but as long as you have failed backups between successful backups, the failed ones will not get deleted.