Sub topic 7
Retention periods and cold storage
This chapter assumes you can read a backup plan JSON file, know what a recovery point is, and have run aws backup commands. Earlier chapters covered rules, schedules and windows. Here you will control how long each recovery point lives and when it moves to cheaper storage.
What a lifecycle controls
Every backup rule has a Lifecycle object. It holds two settings:
DeleteAfterDaysis the retention period. AWS Backup deletes the recovery point this many days after the backup was created.MoveToColdStorageAfterDaysis the number of days the recovery point stays in warm storage before it moves to cold storage.
If you omit Lifecycle, AWS Backup keeps the recovery point until you delete it. That is the most common source of unexpected storage bills, because nothing ever expires.
Retention is counted from the creation time of the backup. It is not counted from the time of the last restore or the last copy.
Warm and cold storage
Warm storage is the default tier. Recovery points there can be restored without delay. Cold storage costs less per GB but has trade-offs:
| Property | Warm storage | Cold storage |
|---|---|---|
| Storage price per GB | Higher | Lower |
| Restore | Standard | Possible, but may take longer and cost more |
| Minimum retention | None beyond the vault's rules | 90 days |
| Availability | All supported resource types | Only some resource types |
| Incremental backups | Yes, for services that support them | Depends on the service |
Cold storage is not available for every resource. Support depends on the resource type and sometimes on a feature being enabled on it. For example, a DynamoDB table needs advanced features turned on. Check the AWS Backup feature availability table for your resource before you design a plan around it. If the resource does not support cold storage, MoveToColdStorageAfterDays has no effect for it.
The 90-day rule
Cold storage has a 90-day minimum. AWS Backup enforces it when you save the plan: DeleteAfterDays must be at least 90 days greater than MoveToColdStorageAfterDays. If you move a recovery point to cold storage on day 30, it must be retained until at least day 120.
This minimum protects AWS from short-lived cold objects, and you pay for it. If you delete a recovery point early, you are billed for the remaining cold days. For that reason, cold storage suits backups you keep for months or years. It does not suit a 35-day daily rule.
A rule with cold storage
This plan keeps a weekly backup warm for 30 days, then holds it in cold storage until day 365. The gap is 335 days, which satisfies the 90-day minimum.
{
"BackupPlanName": "weekly-cold-archive",
"Rules": [
{
"RuleName": "WeeklyArchive",
"TargetBackupVaultName": "app-vault",
"ScheduleExpression": "cron(0 5 ? * SUN *)",
"StartWindowMinutes": 60,
"CompletionWindowMinutes": 360,
"Lifecycle": {
"MoveToColdStorageAfterDays": 30,
"DeleteAfterDays": 365
}
}
]
}Create it with the same command used for any plan:
aws backup create-backup-plan \
--backup-plan file://weekly-plan.jsonIf you set MoveToColdStorageAfterDays to 30 and DeleteAfterDays to 90, the call fails with a validation error. Raise DeleteAfterDays to at least 120.
Choosing retention values
Match retention to a requirement, not to a habit. Useful questions:
- How far back would you realistically restore? Operational mistakes are usually noticed within days or weeks.
- Does a compliance rule set a minimum? Financial and healthcare rules often require one to seven years.
- Does the data change fast enough that old backups are useless?
- Is the backup also protected by a Vault Lock minimum or maximum?
A common pattern uses several rules in one plan. A daily rule with 35 days of warm retention covers mistakes. A monthly rule with a year or more of retention, using cold storage, covers audits. Each rule writes its own recovery points, so you pay for both sets.
Continuous backups have their own limit
Continuous backup, which supports point-in-time recovery, has a maximum retention of 35 days. It also does not move to cold storage. If you need long-term retention for a resource that has continuous backup, add a second rule that takes snapshot backups with a longer lifecycle.
Copy actions have separate lifecycles
A copy action in a rule creates a recovery point in another vault, Region or account. That copy has its own Lifecycle. It does not inherit the source's.
{
"RuleName": "WeeklyArchive",
"TargetBackupVaultName": "app-vault",
"ScheduleExpression": "cron(0 5 ? * SUN *)",
"Lifecycle": {
"MoveToColdStorageAfterDays": 30,
"DeleteAfterDays": 365
},
"CopyActions": [
{
"DestinationBackupVaultArn": "arn:aws:backup:us-west-2:123456789012:backup-vault:dr-vault",
"Lifecycle": {
"MoveToColdStorageAfterDays": 30,
"DeleteAfterDays": 365
}
}
]
}If you leave the copy lifecycle out, the copy is kept indefinitely. State it explicitly each time.
Inspecting and changing retention
Use describe-recovery-point to see the tier and expected dates for one recovery point:
aws backup describe-recovery-point \
--backup-vault-name app-vault \
--recovery-point-arn <recovery-point-arn>Check these fields in the output:
StorageClassshows the current tier, such asWARMorCOLD.Lifecycleshows the settings that were applied.CalculatedLifecycleshows the computed dates for the cold move and for deletion.
To change a single recovery point without editing the plan, 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=400The 90-day gap still applies. You cannot shorten a cold move that has already happened.
Plan changes are not retroactive
Editing a plan's lifecycle changes only the backups created after the edit. Existing recovery points keep the lifecycle they were created with. To bring old ones in line, update them one at a time with the command above or script the update across the output of list-recovery-points-by-backup-vault.
Interaction with Vault Lock
If the target vault has a Vault Lock configuration, its minimum and maximum retention values constrain every lifecycle written to that vault. A backup job fails when its retention falls outside the range. A rule without any DeleteAfterDays also fails when the vault has a maximum retention set, because indefinite retention exceeds any maximum. A failure here shows up as a failed backup job, not as an error when you save the plan, so check the job's status message when a new rule produces no recovery points.
Common errors
- Retention gap under 90 days. The plan is rejected. Increase
DeleteAfterDaysor lower the cold move. - No lifecycle at all. Recovery points pile up forever. Review your plans for rules with no
DeleteAfterDays. - Cold storage on an unsupported resource. The setting is ignored and the recovery point stays warm. Check support first.
- Short-lived backups in cold storage. You pay the early-deletion charge. Use cold storage only where you will really keep the data past the minimum.
- Expecting instant deletion. Expired recovery points are removed by a background process, so deletion can lag the calculated date. Do not rely on exact-minute deletion.
Exercise
A rule must keep monthly backups of an EFS file system for 2 years. You want cold storage to cut cost, and you want the backup warm for the first 60 days. Which Lifecycle values would you write, and what happens if you set DeleteAfterDays to 120 with a cold move at 60 days?
Show answer
Use MoveToColdStorageAfterDays: 60 and DeleteAfterDays: 730 (2 years). The gap is 670 days, which is more than 90. With a cold move at day 60 and DeleteAfterDays of 120, the gap is only 60 days, so AWS Backup rejects the plan because cold storage requires at least 90 days of retention after the move. The earliest valid DeleteAfterDays for a day-60 move is 150.