Obtaining an Aurora backup and copying it to another region with AWS Backup

tada_infra

SADAYOSHI TADA🎉

Posted on December 9, 2023

Obtaining an Aurora backup and copying it to another region with AWS Backup

Hi,I'm taddy.

AWS Backup now supports restore testing.I wanted to restore from a backup that was copied to another region for DR purposes rather than the main region where the system runs, so in this article I will first take a backup and copy it to AWS. Since I used the CLI, I will summarize the contents.The AWS CLI version is aws-cli/2.13.29 Python/3.11.6 Darwin/21.6.0 source/arm64 prompt/off.

AWS Backup Now Supports Restore Testing

Backup and copy with AWS CLI

First, we will take a backup that will be replicated to another region.In this article, we will take a backup of Aurora in the Tokyo region.The command to execute the backup job was executed below.

$ aws backup start-backup-job --backup-vault-name hoge-test --resource-arn arn:aws:rds:ap-northeast-1:123456789191011:cluster:hoge --iam-role-arn arn:aws:iam::123456789191011:role/test-backup-role --lifecycle DeleteAfterDays=3
{
    "BackupJobId": "26d81d3c-cc99-456e-a9e6-a9cdd0fec86c",
    "CreationDate": "2023-12-08T22:09:40.039000+09:00",
    "IsParent": false
}
Enter fullscreen mode Exit fullscreen mode

Check the backup completion status using the BackupJobId that was returned in response when the backup job was executed. Once completed, it will become COMPLETED, so when this status is reached, copy RecoveryPointArn.

aws backup describe-backup-job --backup-job-id 26d81d3c-cc99-456e-a9e6-a9cdd0fec86c
{
~omission~
  "RecoveryPointArn": "arn:aws:rds:ap-northeast-1:1234567891011:cluster-snapshot:awsbackup:job-26d81d3c-cc99-456e-a9e6-a9cdd0fec86c",
~omission~
    "State": "COMPLETED",
    "PercentDone": "100.0",
~omission~
}
Enter fullscreen mode Exit fullscreen mode

We will copy the obtained backup to another region.The command to execute the copy job is executed below to copy it to the Osaka region.

$ aws backup start-copy-job --recovery-point-arn arn:aws:rds:ap-northeast-1:1234567891011:cluster-snapshot:awsbackup:job-26d81d3c-cc99-456e-a9e6-a9cdd0fec86c --source-backup-vault-name hoge-test --destination-backup-vault-arn arn:aws:backup:ap-northeast-3:1234567891011:backup-vault:hoge-test --iam-role-arn arn:aws:iam::1234567891011:role/test-backup-role --lifecycle DeleteAfterDays=3
{
    "CopyJobId": "1E8D42FF-7469-2442-1BEB-F1E7A8CCCED4",
    "CreationDate": "2023-12-08T22:35:42.782000+09:00",
    "IsParent": false
}
Enter fullscreen mode Exit fullscreen mode

Check the backup completion status using the CopyJobId returned in the response when executing the copy job. Once completed, it will be COMPLETED.

$ aws backup describe-copy-job --copy-job-id 1E8D42FF-7469-2442-1BEB-F1E7A8CCCED4
{
    "CopyJob": {
~omission~
        "CopyJobId": "1E8D42FF-7469-2442-1BEB-F1E7A8CCCED4",
~omission~
        "State": "COMPLETED",
~omission~
    }
}
Enter fullscreen mode Exit fullscreen mode

Summary

In preparation for performing an AWS Backup restore test, I tried replicating an Aurora backup from the Tokyo region to the Osaka region using the AWS CLI.Next time, I will perform a restore test.

💖 💪 🙅 🚩
tada_infra
SADAYOSHI TADA🎉

Posted on December 9, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related