Sub topic 7
Retention periods and cold storage
This chapter explains how a backup rule decides when a recovery point is deleted, and when it moves to cheaper storage. It assumes you can read a backup plan JSON file and know what a vault and a recovery point are.
The lifecycle block
Each backup rule can carry a Lifecycle object. It controls two events on a recovery point's timeline:
MoveToColdStorageAfterDays: the age at which the recovery point moves from warm storage to cold storage.DeleteAfterDays: the age at which AWS Backup deletes the recovery point.
If you leave out Lifecycle, AWS Backup keeps the recovery points until you delete them yourself. Many teams forget this, and the backups pile up and add cost.
{
"BackupPlanName": "daily-cold-after-30",
"Rules": [
{
"RuleName": "DailyBackups",
"TargetBackupVaultName": "app-vault",
"ScheduleExpression": "cron(0 5 ? * * *)",
"StartWindowMinutes": 60,
"CompletionWindowMinutes": 180,
"Lifecycle": {
"MoveToColdStorageAfterDays": 30,
"DeleteAfterDays": 120
}
}
]
}In this rule, a recovery point stays warm for 30 days, spends the next 90 days in cold storage, and is deleted at day 120.
Rules for valid values
AWS Backup checks the lifecycle values when you create the plan. Keep these constraints in mind:
DeleteAfterDaysmust be greater than or equal toMoveToColdStorageAfterDaysplus 90. Cold storage has a 90-day minimum.- You can't change the value of
MoveToColdStorageAfterDaysorDeleteAfterDaysto a shorter period after the transition has happened. A recovery point that is already cold can't move back to warm. - Cold storage is not available for every resource type. It applies only to services that support it, such as Amazon EFS, and to some others. Check the feature availability table for your resource types before you rely on it.
- If the vault has Vault Lock, its minimum and maximum retention limits also apply. A rule that falls outside them fails.
The 90-day minimum is the usual cause of a rejected plan. A rule with MoveToColdStorageAfterDays of 30 and DeleteAfterDays of 60 fails, because 60 is less than 120.
Cost trade-offs
Cold storage costs less per gigabyte than warm storage. It has a minimum charge period of 90 days, so you pay for 90 days even if you delete a recovery point sooner. Restoring from cold storage can also take longer and may cost more. Use cold storage for backups you keep a long time and rarely restore, such as compliance copies. For short retention, such as 35 days, skip the transition.
Changing retention on existing backups
Editing a plan changes the lifecycle for recovery points created after the edit. To change the lifecycle of an existing recovery point, use update-recovery-point-lifecycle:
aws backup update-recovery-point-lifecycle \
--backup-vault-name app-vault \
--recovery-point-arn <recovery-point-arn> \
--lifecycle MoveToColdStorageAfterDays=30,DeleteAfterDays=180Check the result with describe-recovery-point and look at the Lifecycle field.
Exercise
A rule sets MoveToColdStorageAfterDays to 45 and DeleteAfterDays to 100. Will AWS Backup accept it? If not, what is the smallest valid DeleteAfterDays?
Show answer
It will not accept it. DeleteAfterDays must be at least MoveToColdStorageAfterDays plus 90, which is 135. The smallest valid value is 135.