Daniel Green's Homepage

Restoring a MySQL backup to AWS RDS without the automated post-restore snapshot

While getting our CDK-based AWS infrastructure going, I often found myself restoring a MySQL backup to RDS.  This went fairly smoothly, except that I could not avoid the end-of-restore snapshot that the AWS web console requires.  This adds several hours to the restore of our database, which stalled out CDK deploys as the deploy waits for RDS to enter its "ready" state.

A quick note to AWS technical support – we pay for it, so I make sure to use it whenever I can (and they are great!) – revealed that the automated snapshot could not be avoided in the web console; however, it can be avoided if the restore is initiated via the AWS CLI:

aws rds restore-db-instance-from-s3 --allocated-storage 5334 --storage-type gp2 --db-instance-identifier cli-restore-test --db-instance-class db.r5.16xlarge --engine mysql --backup-retention-period 0 --master-username admin --master-user-password password --s3-bucket-name my_bucket --s3-ingestion-role-arn ARN_HERE --s3-prefix 20210614.xbstream --source-engine mysql --source-engine-version 5.7.26

You may need more / different parameters for a successful restore, but the key parameter here is "--backup-retention-period".  Setting this to 0 (zero) avoids the automated snapshot.  Useful if you just want to stand up an RDS instance and test some stuff, less useful for production instances...

AWS MySQL RDS