Sub topic 13
Copying backups across Regions and accounts
A backup in the same Region and account as its source is exposed to the same failures: a Regional outage, a deleted account, or a compromised credential. A copy in another Region or account is the usual fix. This chapter assumes you know how vaults, recovery points and the service role work, and that you can read a backup plan JSON file.
How copies work
A copy job takes an existing recovery point and writes a new recovery point into a destination vault. The copy has its own ID and its own lifecycle. Deleting the original does not delete the copy.
You can create copies in two ways:
- A copy action in a backup rule. Each backup that the rule creates is copied automatically.
- An on-demand copy job. You copy one existing recovery point with
start-copy-job.
Cross-Region copies
First create a vault in the destination Region. Then add a CopyActions list to the rule:
{
"RuleName": "DailyBackups",
"TargetBackupVaultName": "app-vault",
"ScheduleExpression": "cron(0 5 ? * * *)",
"Lifecycle": { "DeleteAfterDays": 35 },
"CopyActions": [
{
"DestinationBackupVaultArn": "arn:aws:backup:us-west-2:123456789012:backup-vault:app-vault-dr",
"Lifecycle": { "DeleteAfterDays": 90 }
}
]
}The copy keeps the retention you set in its own Lifecycle. Here the original expires after 35 days and the copy after 90.
The destination vault's KMS key encrypts the copy. For a cross-Region copy, that key must exist in the destination Region.
Cross-account copies
Cross-account copies need three things:
- The accounts must belong to the same AWS Organization, and cross-account backup must be enabled in the Organizations management account's AWS Backup settings.
- The destination vault needs an access policy that allows the source account to copy in.
- The destination vault must use a customer managed KMS key whose key policy lets the source account use it. The AWS managed key
aws/backupcannot be shared.
This policy goes on the destination vault and allows account 123456789012 to copy in:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": { "AWS": "arn:aws:iam::123456789012:root" },
"Action": "backup:CopyIntoBackupVault",
"Resource": "*"
}
]
}Apply it from the destination account:
aws backup put-backup-vault-access-policy \
--backup-vault-name central-vault \
--policy file://vault-policy.jsonCopying one recovery point on demand
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:app-vault-dr \
--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 <id>.
Common errors
- Access denied on the destination. The vault access policy is missing, or it does not name the source account.
- KMS errors in cross-account copies. The destination key policy does not allow the source account, or the vault still uses
aws/backup. - Copy job fails on the role. The service role needs permission to copy. The default service role policy covers this for supported resource types.
- Wrong key Region. A cross-Region copy needs a destination vault whose key is in the destination Region.
Exercise
A rule backs up an EBS volume daily into app-vault. You need a copy that survives deletion of the whole source account. Which two destination-side settings must exist before the copy action can succeed?
Show answer
The destination vault must have an access policy that allows backup:CopyIntoBackupVault from the source account, and it must be encrypted with a customer managed KMS key whose key policy allows the source account. The accounts must also be in the same Organization with cross-account backup enabled.