Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Aurora MySQL Database cloning using CLI

I want to create a copy of my production aurora mysql database on a weekly basis. The copies will be used for development.

I like the clone feature of Aurora MySQL but unfortunately, the instructions to create these clones from AWS CLI are not clear.

Following the docs, I am able to create another Aurora cluster, but it doesn't create the DBs. It just creates an empty cluster. I am not able to figure out the commands to create a new Db inside this cluster from a snapshot of the Db in the source cluster as the restore-db-instance-from-db-snapshot is not supported for Aurora MySQL.

Please let me know the commands to clone the Aurora Cluster along with the DBs inside it.

like image 596
Smruti Mandal Avatar asked Oct 27 '25 08:10

Smruti Mandal


1 Answers

According to the AWS documentation, this is a two phase process.

When you create a new cluster with:

aws rds restore-db-cluster-to-point-in-time \ 
  --source-db-cluster-identifier arn:aws:rds:eu-central-1:AAAAAAAAAAA:cluster:BBBBBBBBBB-cluster \ 
  --db-cluster-identifier YYYYYYYYYY-cluster \ 
  --restore-type copy-on-write \ 
  --use-latest-restorable-time

When this completes, data store has been created and is ready to be used but there are no aurora instances running.

The second step would be to create one (or more) instances:

aws rds create-db-instance \
  --db-cluster-identifier YYYYYYYYYY-cluster \ 
  --db-instance-class <value> \
  --engine <value>
  (other optional values)
like image 64
chris Avatar answered Oct 29 '25 23:10

chris