Steps to Restore XtraBackup to AWS Aurora

Till the end of this topic, you will come to know Steps to Restore XtraBackup to AWS Aurora.

One of our customers is using Percona Xtrabackup to backup their on-prem/EC2 Mysql databases.
We were in a situation to restore their on-prem/Ec2 database to Aurora. The size of the database is around 1.6TB. Option in front of us was to take mysqldump and restore but this option is more time consuming but this possible from this below step.

So we decided to restore the existing Percona’s backup. AWS already documented this process here. In this documentation, they used innobackupex script to backup, but we can use xtrabackup instead.

What is Xtrabackup?
It is an open-source utility for MySQL. It is used for taking hot backup MySQL based servers which will not lock our database during the backup.

It can back up data from InnoDB, XtraDB, and MyISAM tables on MySQL 5.1 [1], 5.5, 5.6, and 5.7 servers, as well as Percona Server with XtraDB. Percona XtraBackup is designed in such a way that it make backups without disrupting the performance of the server in a production/development/stagging environment.
Command to take Backup from xtrabackup :

xtrabackup --backup --user=root --password=xxxx--target-dir=/tmp/xtrabackup
Steps to Restore XtraBackup to AWS Aurora
Here we didn’t compress anything.

Upload the backup folder to S3 

aws s3 sync /tmp/xtrabackup s3://****/xtrabackup
·Go to RDS console and click on Restore Aurora DB Cluster from S3.
Steps to Restore XtraBackup to AWS Aurora
·Specify Source Backup Details.
Steps to Restore XtraBackup to AWS Aurora
In Source Engine Version you can mention the Major version, (ie 5.6.2 as 5.6).
Create an IAM role that will have read permission for the file from S3, you can create the Role in the same page or create a role in IAM with the below-mentioned policy and select in RDS console.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:GetBucketLocation" ], "Resource": [ "arn:aws:s3:::<bucket name>" ] }, { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": [ "arn:aws:s3:::<bucket name>/<prefix>*" ] } ] }
·In Specify DB Details page looks like the following.
Steps to Restore XtraBackup to AWS Aurora
·Click Next to create an Instance. And configure below settings:
    • Advanced settings
    • Database Options
    • Failover
    • Backup
    • Monitoring
    • Maintenance
·Now click Launch DB instance.
Steps to Restore XtraBackup to AWS Aurora
Steps to Restore XtraBackup to AWS Aurora
·If you want to see how much data is migrated to Aurora then click to Cluster tab as per following:
Steps to Restore XtraBackup to AWS Aurora
Once it is migrated, then it’ll take a few minutes to create an instance.
 
In this process, we didn’t compress anything, but it supports gz, tar, .xbstream formats. If you want to compress your backup file, please use the below command in the backup script. 

Don’t compress the backup directory after the backup, it won’t work.

innobackupex --user=root --password=xxxx --stream=tar /tmp/innobackupex | gzip - | split -d --bytes=512000 - /tmp/innobackupex/backup.tar.gz
Or
xtrabackup --user=root --password=xxxx --stream=tar /tmp/innobackupex | gzip - | split -d --bytes=512000 - /tmp/ xtrabackup /backup.tar.gz
Each compressed file must be < 5TB
This is the end of the tutorial, Steps to Restore XtraBackup to AWS Aurora.
thanks for reading this article, you’ll also like:






2 thoughts on “Steps to Restore XtraBackup to AWS Aurora”

Comments are closed.