Sub topic 12
Continuous backups and point-in-time recovery
This chapter assumes you have created a vault and a backup plan with a rule, and that you know what a recovery point is.
Snapshot backups versus continuous backups
A scheduled rule normally takes a snapshot at a set time. If you back up daily at 05:00 UTC and a table is corrupted at 14:30, the newest snapshot is nearly 10 hours old. You lose everything written since then. That gap is your recovery point objective (RPO).
A continuous backup records changes as they happen. It lets you restore to any second inside the retention period, which is called point-in-time recovery (PITR).
Supported resources and limits
Continuous backup is available only for some resource types. These include Amazon S3, Amazon RDS, Amazon Aurora, and SAP HANA on Amazon EC2. Check the current AWS Backup feature matrix for your resource type before you design around it.
- Retention: You can keep continuous backups for 1 to 35 days.
- Cold storage: You can't move continuous recovery points to cold storage, so a lifecycle rule for them must not set
MoveToColdStorageAfterDays. - S3 prerequisite: Versioning must be enabled on the bucket.
- Cross-Region and cross-account copies: A copy of a continuous recovery point is stored as a snapshot, not as a continuous backup.
Enabling it in a rule
You turn on continuous backup per rule with EnableContinuousBackup. This plan file takes a continuous backup with 35-day retention:
{
"BackupPlanName": "continuous-35-day",
"Rules": [
{
"RuleName": "ContinuousBackups",
"TargetBackupVaultName": "app-vault",
"ScheduleExpression": "cron(0 5 ? * * *)",
"StartWindowMinutes": 60,
"CompletionWindowMinutes": 180,
"EnableContinuousBackup": true,
"Lifecycle": {
"DeleteAfterDays": 35
}
}
]
}Create the plan the same way as before:
aws backup create-backup-plan \
--backup-plan file://continuous-plan.jsonResources are still assigned by tag or ARN. If a selected resource type doesn't support continuous backup, that rule can't protect it. Put such resources in a separate rule.
A rule can't mix the two modes in one recovery point. If you want both a continuous backup and periodic snapshots, add a second rule with EnableContinuousBackup set to false.
How a restore works
AWS Backup never overwrites the source. A restore job creates a new resource, such as a new database instance or a restored S3 bucket. In the console, pick the continuous recovery point and choose a restore time or the latest restorable time. The latest restorable time usually trails the present by a few minutes. You can't restore to a moment after it. Use get-recovery-point-restore-metadata to see the settings a restore request needs.
Common errors
- Backup job fails on S3: Versioning is usually not enabled on the bucket.
- Plan creation rejected: A lifecycle with cold storage was combined with continuous backup.
- Restore time rejected: The requested time is outside the retention window or after the latest restorable time.
- Expecting a snapshot after the retention window: Continuous recovery points expire at the retention limit, so keep a snapshot rule if you need older restore points.
Exercise
Your plan runs one daily snapshot rule for an RDS database, and you need to restore to any second within the last 14 days. What do you change, and what is the cold storage rule?
Show answer
Add a rule (or change the rule) with "EnableContinuousBackup": true and Lifecycle DeleteAfterDays of 14. Continuous recovery points can't be moved to cold storage, so don't set MoveToColdStorageAfterDays on that rule. You can keep the snapshot rule for longer retention or cold storage.