Best practice for restoring an RDS Aurora snapshot into a CloudFormation-built solution

0

Hi experts,

I'm looking for best practices in restoring data into a cloudformation-built system.

I've got extensive cloudformation that builds a solution, including an RDS Aurora Serverless database cluster. Now I want to restore that RDS server from a snapshot.

For the DbSnapshotIdentifier point above, here's the relevant wording from their docs that concerns me:

After you restore a DB instance with a DBSnapshotIdentifier property, you must specify the same DBSnapshotIdentifier property for any future updates to the DB instance. When you specify this property for an update, the DB instance is not restored from the DB snapshot again, and the data in the database is not changed. However, if you don't specify the DBSnapshotIdentifier property, an empty DB instance is created, and the original DB instance is deleted

It seems this should be simple but it's not. Please don't tell me I need to fall back to using mysqlbackup ¯\_(ツ)_/¯

Thanks in advance, Scott

scott
asked 2 years ago1307 views
1 Answer
0

Hi Scott - The DbSnapshotIdentifier property is a "Replacement" property so whenever it is updated a new instance is created and previous instance destroyed. I'll walk through a brief scenario to hopefully explain.

  1. Create a cluster in a new stack without DbSnapshotIdentifier property - this will be a blank DB
  2. Update the stack with DbSnapshotIdentifier to restore from a snapshot - this will build a new db from the snapshot and destroy the previous instance
  3. Update the stack again with some other property keeping the previous DbSnapshotIdentifier value the same - no restore will be attempted as the DbSnapshotIdentifier property has not changed. It will not revert to the snapshot specified previously
  4. Update the stack again with a new DbSnapshotIdentifier property - this will build a new db from the new snapshot and destroy the previous instance

If you remove the DbSnapshotIdentifier property from the stack it will see that as a change and therefore build a new blank instance and destroy the previous. Therefore once you use the property once you need to keep using with either the old value to do nothing or a new value for a new restore

AWS
EXPERT
Peter_G
answered 2 years ago
profile picture
EXPERT
reviewed 20 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions