Sub topic 5
Designing a backup plan
A backup plan is the policy document of AWS Backup. It says when to back up, where to store the result, and how long to keep it. This chapter covers the structure of a plan, the decisions you make when designing one, and the errors that most often break plans in practice.
This chapter assumes you have read the earlier chapters on vaults and the service role. You should be comfortable with the AWS CLI, JSON files, IAM roles, and the ideas of RPO (how much data loss you can accept) and RTO (how long a restore may take).
What a plan contains
A plan is a named container for one or more rules. It does not name any resources. Resources are attached to a plan separately, through a resource assignment, which is the subject of a later chapter. This split lets you change what is protected without touching the schedule, and change the schedule without touching the list of resources.
| Part | What it defines | Where it lives |
|---|---|---|
| Plan | A name and a list of rules | The plan itself |
| Rule | Schedule, windows, target vault, lifecycle, copy actions | Inside the plan |
| Resource assignment | Which resources the plan protects, and which role is used | Attached to the plan |
| Vault | Where recovery points are stored | A separate resource that a rule points to |
Each rule runs on its own schedule. When a rule fires for a resource, AWS Backup creates a backup job, and a successful job produces a recovery point in the rule's target vault.
A minimal plan
The plan below has one rule. It starts a backup daily at 05:00 UTC, allows 60 minutes for the job to start and 180 minutes to finish, and deletes recovery points after 35 days. It targets the app-vault vault, which must already exist.
{
"BackupPlanName": "daily-35-day-retention",
"Rules": [
{
"RuleName": "DailyBackups",
"TargetBackupVaultName": "app-vault",
"ScheduleExpression": "cron(0 5 ? * * *)",
"StartWindowMinutes": 60,
"CompletionWindowMinutes": 180,
"Lifecycle": {
"DeleteAfterDays": 35
}
}
]
}Save it as plan.json, create the plan, and then attach a tag-based selection. Replace <backup-plan-id> with the BackupPlanId value returned by the first command.
aws backup create-backup-plan \
--backup-plan file://plan.json
aws backup create-backup-selection \
--backup-plan-id <backup-plan-id> \
--backup-selection file://selection.jsonThe create-backup-plan response also contains a VersionId. You will need to understand that field, as described next.
Plans are versioned
You cannot edit a plan in place. When you call update-backup-plan, AWS Backup creates a new version and uses it from then on. Earlier versions are kept, and you can read them with get-backup-plan --version-id.
Two consequences follow:
- Recovery points record the plan version that created them. Changing a plan later does not change the retention of recovery points that already exist, unless you edit them directly.
- Infrastructure-as-code tools see an update as a new version. Drift in a plan is easy to detect by comparing versions.
Decisions to make when designing a plan
Group by recovery objective, not by service
A common mistake is to build one plan per AWS service, such as "EBS plan" and "RDS plan". A better grouping is by what the data needs. Resources with the same RPO, retention, and compliance needs share a plan, whatever service they run on.
A practical set of plans might be:
- A critical plan with frequent backups, such as every 6 hours, a short retention, and a cross-Region copy.
- A standard plan with one daily backup and 35 days of retention.
- A long-term plan with a monthly backup retained for a year or more, often moved to cold storage.
A resource can be assigned to more than one plan. In that case it is backed up under each plan's rules.
Choose the schedule from your RPO
The schedule is a cron expression in UTC. The fields are minutes, hours, day of month, month, day of week, and year. AWS Backup requires a ? in either the day-of-month or day-of-week field. With a daily schedule, your worst-case data loss is roughly 24 hours plus the time the job takes. If your RPO is shorter than that, increase the frequency, or use continuous backup for services that support it.
| Goal | Expression | Meaning |
|---|---|---|
| Every day at 05:00 UTC | `cron(0 5 ? * * *)` | Daily |
| Every 6 hours | `cron(0 0/6 ? * * *)` | 00:00, 06:00, 12:00, 18:00 |
| Weekdays at 23:00 UTC | `cron(0 23 ? * MON-FRI *)` | Monday to Friday |
| First day of the month | `cron(0 3 1 * ? *)` | Monthly |
Set the windows deliberately
The start window is how long AWS Backup waits for a job to begin after the scheduled time. If the job has not started within the window, it is marked expired and does not run. The completion window is the time allowed for the job to finish after it starts. A job that runs longer is stopped and marked as failed or expired.
The two windows are easy to confuse. The completion window starts when the job starts running, not at the scheduled time. Keep these points in mind:
- The default start window is 8 hours. A short window, such as 60 minutes, makes missed backups visible quickly, but gives less room when the service is busy.
- The completion window must be at least 60 minutes longer than... the start window is not a constraint here, but both values must be large enough for your largest resource. A first backup of a large volume is a full copy and takes much longer than later incremental ones.
- If the completion window is too short, a first backup may never finish. Each retry starts from scratch for services that do not checkpoint.
Match retention to the lifecycle rules
DeleteAfterDays sets when a recovery point is deleted. If you also set MoveToColdStorageAfterDays, the cold storage move must happen at least 90 days before deletion. Cold storage applies only to certain resource types. Recovery points that are moved to cold storage also carry a minimum charge period of 90 days. A later chapter covers this in detail. For plan design, the point is to decide lifecycle at the same time as the schedule, because they interact.
If the vault has a Vault Lock configuration with minimum and maximum retention, every rule that targets that vault must stay within those limits. A rule outside the range fails at job time or when the plan is created.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| Plan creation fails with a vault error | The target vault name does not exist in this Region | Create the vault first, in the same Region and account |
| Job state is `EXPIRED` | The job did not start within the start window | Lengthen the start window, or check for resource contention |
| Job state is `FAILED` with an access error | The service role lacks permission, or the resource uses a customer managed KMS key the role cannot use | Fix the role policy and the key policy |
| Resource is never backed up | The tag does not match, or the resource type is not supported | Check the tag key and value, and the supported resource list |
| Retention does not change after a plan edit | The change applies to new recovery points only | Update existing recovery points directly |
| Plan rejected by a locked vault | The rule's retention is outside the vault's min/max limits | Adjust the lifecycle to fit the lock |
Plans and vaults are Regional. A plan in us-east-1 only protects resources in us-east-1. To cover several Regions you create a plan in each, or use organization backup policies, covered in a later chapter.
Verifying your design
After creating a plan, confirm that it is what you intended:
aws backup list-backup-plans
aws backup get-backup-plan \
--backup-plan-id <backup-plan-id>
aws backup list-backup-selections \
--backup-plan-id <backup-plan-id>Then wait for the first scheduled run, or run an on-demand backup, and check that a recovery point appears in the target vault. A plan that has never produced a recovery point has not been tested.
Exercise
A resource is tagged correctly and assigned to a plan with a daily rule, but the backup job for the first run shows state EXPIRED. Which rule setting is the most likely cause, and what does it control?
Show answer
The start window. It controls how long AWS Backup waits for a job to begin after the scheduled time. If the job cannot start inside that window, it expires and does not run. Lengthening StartWindowMinutes, or finding out why the resource could not start a backup, resolves it. The completion window only applies after a job has started.
Exercise
You change DeleteAfterDays from 35 to 90 on a rule with update-backup-plan. Will recovery points created last week now be kept for 90 days?
Show answer
No. Updating a plan creates a new version, and the new retention applies to recovery points created after the change. Existing recovery points keep the lifecycle they were created with, unless you change them with update-recovery-point-lifecycle.