Sub topic 13
Copying backups across Regions and accounts
A backup stored next to the resource it protects shares that resource's failure domain. A Regional outage, a compromised account, or a mistaken deletion can take out both. AWS Backup addresses this with copy jobs, which write a second recovery point into a vault in another Region, another account, or both.
This chapter assumes you can already create vaults, backup plans, and a service role, and that you have read about KMS encryption and vault access policies. It uses the AWS CLI.
How a copy works
A copy job takes an existing recovery point (the source) and creates a new, independent recovery point in a destination vault. The copy is a separate object:
- It has its own recovery point ARN.
- It has its own retention, set in the copy action.
- It is encrypted by the destination vault's key.
- It stays available if you delete the source.
You can start copies in two ways:
- A copy action inside a backup rule. AWS Backup starts the copy automatically after each backup job from that rule completes.
- An on-demand copy job, started with
start-copy-jobagainst a recovery point that already exists.
Cross-Region copies in the same account
Create the destination vault in the destination Region first. A copy action refers to the vault by ARN and fails if it does not exist.
aws backup create-backup-vault \
--region us-west-2 \
--backup-vault-name dr-vaultThen add a CopyActions list to the rule. This is the plan from earlier chapters with one copy action added:
{
"BackupPlanName": "daily-35-day-retention",
"Rules": [
{
"RuleName": "DailyBackups",
"TargetBackupVaultName": "app-vault",
"ScheduleExpression": "cron(0 5 ? * * *)",
"StartWindowMinutes": 60,
"CompletionWindowMinutes": 180,
"Lifecycle": {
"DeleteAfterDays": 35
},
"CopyActions": [
{
"DestinationBackupVaultArn": "arn:aws:backup:us-west-2:123456789012:backup-vault:dr-vault",
"Lifecycle": {
"DeleteAfterDays": 90
}
}
]
}
]
}The copy keeps its own lifecycle. Here the source expires after 35 days and the copy after 90. Set the copy lifecycle explicitly instead of relying on a default, so the retention you get is the retention you wrote down. If you use cold storage, the usual rule applies to the copy too: the delete age must be at least 90 days after the transition to cold storage.
Update the plan with aws backup update-backup-plan --backup-plan-id <backup-plan-id> --backup-plan file://plan.json. The change applies to backups that start after the update. Existing recovery points are not copied retroactively.
Cross-account copies
Cross-account copies protect against account compromise. If an attacker or a faulty script deletes everything in the workload account, the copies in a separate account are out of reach of those credentials. Three things must be in place.
- Organization setup. The accounts must be in the same AWS Organization. Cross-account backup must be turned on in the Organizations management account, under the AWS Backup settings.
- A vault access policy on the destination vault. It must allow the source account to copy into it.
- A suitable KMS key. The destination vault needs a customer managed key whose key policy lets the source account use it. A vault that uses the AWS managed key
aws/backupcannot accept cross-account copies.
Run this in the destination account to let account 123456789012 copy into central-vault:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::123456789012:root"
},
"Action": "backup:CopyIntoBackupVault",
"Resource": "*"
}
]
}aws backup put-backup-vault-access-policy \
--backup-vault-name central-vault \
--policy file://central-vault-policy.jsonTo allow every account in the organization, use "Principal": "*" with a Condition that matches aws:PrincipalOrgID. Never use a bare * principal without that condition.
In the source account, the copy action then points at the destination vault ARN, which contains the other account's ID:
"CopyActions": [
{
"DestinationBackupVaultArn": "arn:aws:backup:us-east-1:210987654321:backup-vault:central-vault",
"Lifecycle": {
"DeleteAfterDays": 365
}
}
]A rule can list several copy actions. One rule can therefore send a copy to a second Region and a copy to a central account.
On-demand copies
Use start-copy-job to copy an existing recovery point, for example before a risky change or to seed a new DR vault with your existing backups.
aws backup start-copy-job \
--recovery-point-arn <recovery-point-arn> \
--source-backup-vault-name app-vault \
--destination-backup-vault-arn arn:aws:backup:us-west-2:123456789012:backup-vault:dr-vault \
--iam-role-arn arn:aws:iam::123456789012:role/service-role/AWSBackupDefaultServiceRole \
--lifecycle DeleteAfterDays=90The command returns a CopyJobId. Check progress with:
aws backup describe-copy-job --copy-job-id <copy-job-id>
aws backup list-copy-jobs --by-state FAILEDCopy jobs move through states such as CREATED, RUNNING, COMPLETED, and FAILED. A failed job carries a StatusMessage that usually names the cause.
Restoring from a copy
A copy is a normal recovery point. You list it in the destination vault with list-recovery-points-by-backup-vault and restore it as you would any other. Two details matter:
- You restore into the Region of the vault that holds the copy. This is what makes a Regional DR plan work: the data is already there.
- For a cross-account copy, you restore in the destination account unless you copy the recovery point back. The restoring role needs permission on the destination vault and on its KMS key.
Test this path before you need it. A DR plan that has never been restored has only been assumed to work.
Costs and behavior to plan for
- Data transfer. Cross-Region copies incur inter-Region transfer charges in addition to storage in the destination. Same-Region cross-account copies do not incur transfer, but still incur storage.
- Storage at the destination. Every copy is billed as its own recovery point. Long copy retention multiplies cost quickly, so set the copy lifecycle deliberately.
- Incremental behavior. For some resource types, such as EBS snapshots, the first copy to a destination is full and later copies transfer only changes. Other resource types copy the full backup each time. Check the documentation for each resource type.
- Resource support. Not every resource type supports cross-Region or cross-account copy. Check the feature availability table in the AWS Backup documentation before you design around it.
- Timing. The copy starts only after the source backup completes. Copy jobs are subject to their own completion behavior, so leave room in your RPO for backup time plus transfer time.
Common errors
| Symptom | Likely cause |
|---|---|
| Copy job fails with an access denied message | The destination vault access policy does not allow `backup:CopyIntoBackupVault` from the source account, or the role lacks copy permissions. |
| Copy job fails on encryption | The destination vault uses `aws/backup`, or the KMS key policy does not allow the source account. |
| Rule saves but no copies appear | The destination vault does not exist, or the plan was updated after the backup ran. |
| Cross-account copy is rejected | Cross-account backup is not enabled in the management account, or the accounts are in different organizations. |
| Copies outlive their intended retention | The copy action has no lifecycle of its own, or one was set longer than intended. |
Exercise
A plan rule backs up an RDS database daily in us-east-1 with 35-day retention. You must also keep a copy for 90 days in a vault in a different AWS account, in the same organization. Name the three prerequisites for the destination and the one setting that controls the copy's retention.
Show answer
Prerequisites: (1) cross-account backup is enabled in the Organizations management account; (2) the destination vault has an access policy allowing the source account to perform backup:CopyIntoBackupVault; (3) the destination vault is encrypted with a customer managed KMS key whose policy allows the source account. Retention is set by the Lifecycle (DeleteAfterDays: 90) inside the rule's CopyActions entry, independent of the 35-day source lifecycle.
Exercise
You add a CopyActions entry to an existing rule today. Will yesterday's recovery points be copied? How would you copy one of them?
Show answer
No. Copy actions apply to backup jobs that start after the plan update. To copy an existing recovery point, run aws backup start-copy-job with the recovery point ARN, source vault name, destination vault ARN, and role, then follow it with describe-copy-job.