Sub topic 2
Rules: schedules, start windows and completion windows
Assume you know AWS CLI, IAM roles, resource tags, and basic RPO/RTO terms. This chapter uses an existing app-vault vault and AWSBackupDefaultServiceRole role.
Schedules and backup windows
A backup rule combines a schedule with timing limits:
ScheduleExpressionuses UTC cron syntax.cron(0 5 ? * * *)requests a backup every day at 05:00 UTC.StartWindowMinutesis how long AWS Backup may wait before starting the job.CompletionWindowMinutesis how long the job may run after it starts.
A schedule is a target time, not a guarantee that the backup begins exactly then. Common errors include using local time instead of UTC and setting windows shorter than the resource can support.
aws backup create-backup-plan \
--backup-plan '{
"BackupPlanName": "daily-35-day-retention",
"Rules": [{
"RuleName": "DailyBackups",
"TargetBackupVaultName": "app-vault",
"ScheduleExpression": "cron(0 5 ? * * *)",
"StartWindowMinutes": 60,
"CompletionWindowMinutes": 180,
"Lifecycle": {
"DeleteAfterDays": 35
}
}]
}'Retention and cold storage
DeleteAfterDays controls how long AWS Backup retains each recovery point. Cold storage can reduce cost for backups that are rarely restored, but support and minimum storage periods depend on the protected resource. Use MoveToColdStorageAfterDays only when that resource supports it, and calculate the total retention period before enabling the rule.
Assigning resources
A resource assignment connects a plan to resources. Tag-based assignments scale well:
backup=dailycan include current and future matching resources.- An ARN assignment targets one specific resource.
- The selection needs an IAM service role that AWS Backup can assume.
Review tags carefully. A broad tag can protect more resources than intended and increase cost.
On-demand backups
Use an on-demand job before maintenance or a risky change. Supply the resource ARN, vault, role, and optional lifecycle:
aws backup start-backup-job \
--backup-vault-name app-vault \
--resource-arn arn:aws:ec2:us-east-1:123456789012:volume/vol-0123456789abcdef0 \
--iam-role-arn arn:aws:iam::123456789012:role/service-role/AWSBackupDefaultServiceRole \
--lifecycle DeleteAfterDays=35Inspecting recovery points
A recovery point is a completed backup that can be used for restore. List the vault contents, then retrieve restore metadata before constructing a restore request.
aws backup list-recovery-points-by-backup-vault \
--backup-vault-name app-vault
aws backup get-recovery-point-restore-metadata \
--backup-vault-name app-vault \
--recovery-point-arn arn:aws:backup:us-east-1:123456789012:recovery-point:exampleWait for the backup job to reach COMPLETED. An unsuccessful job does not provide a usable recovery point.
Exercise
A daily backup is scheduled for 05:00 UTC, but the job starts at 05:40 and finishes at 08:20. Are 60-minute and 180-minute windows sufficient?
Show answer
Yes. It starts within the 60-minute start window and runs for 160 minutes, within the 180-minute completion window.