Sub topic 6
Rules: schedules, start windows and completion windows
A backup rule tells AWS Backup when to start a backup, how long it may take, where to store the result, and how long to keep it. This chapter assumes you know what a backup vault and a backup plan are, and that you can read a cron expression. It covers the three timing settings in a rule: the schedule, the start window, and the completion window.
What a rule contains
A backup plan holds one or more rules. Each rule is an independent policy. Every rule names a target vault and sets its own schedule and lifecycle. Resources assigned to the plan are backed up by every rule in it.
Here is the rule from the plan file used in this tutorial:
{
"BackupPlanName": "daily-35-day-retention",
"Rules": [
{
"RuleName": "DailyBackups",
"TargetBackupVaultName": "app-vault",
"ScheduleExpression": "cron(0 5 ? * * *)",
"StartWindowMinutes": 60,
"CompletionWindowMinutes": 180,
"Lifecycle": {
"DeleteAfterDays": 35
}
}
]
}The schedule
ScheduleExpression uses a six-field cron format: minutes, hours, day of month, month, day of week, year. Times are in UTC unless you set the rule's ScheduleExpressionTimezone.
In cron(0 5 ? * * *), the job runs at 05:00 every day. The ? means "no specific value" and is required in either the day-of-month or day-of-week field. You can't set both.
Start window and completion window
The two windows control what happens after the scheduled time.
- Start window (
StartWindowMinutes): how long AWS Backup waits for the job to begin. If the job hasn't started by the end of this window, it expires. The default is 480 minutes (8 hours). The minimum is 60. - Completion window (
CompletionWindowMinutes): how long the job may run, counted from the scheduled time and including the start window. If it hasn't finished by then, AWS Backup cancels it. The default is 10080 minutes (7 days).
A job can fail to start if the resource is busy or if AWS Backup is short of capacity at that moment. The start window gives it room to retry.
With the rule above, a job scheduled for 05:00 must start by 06:00 and finish by 08:00.
Common errors
- Expired jobs. The job didn't start within the start window. Check whether the resource was stopped, locked, or in a state that blocks backups.
- Cancelled jobs. The completion window was too short for the first full backup, which is usually the slowest. Later backups of many services are incremental and faster.
- Unexpected run times. The cron expression is in UTC. A schedule meant for 05:00 local time will run at a different hour.
- Overlapping rules. Two rules in one plan that fire at the same time both back up the same resource. Use different schedules, or accept the extra recovery points and their cost.
Exercise
A rule has the schedule cron(0 2 ? *), StartWindowMinutes of 90, and CompletionWindowMinutes of 240. At what latest time must a job start, and by what time must it finish, to avoid expiring or being cancelled? Times are UTC.
Show answer
It must start by 03:30 (02:00 plus 90 minutes) and finish by 06:00 (02:00 plus 240 minutes). The completion window is counted from the scheduled time, not from when the job starts.