Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I restore RDS snapshot into a cloudformation?

I want to restore an RDS instance from a snapshot and have it replace an instance in a cloudformation.

Let's say I have one EC2 instance connected to one RDS instance in a cloud formation and I want to restore the RDS instance from a snapshot.

Since an RDS snapshot can only be restored into a new RDS instance, and that new RDS instance needs the domain name of the old instance for my EC2 to reach it, I have to let go of the old RDS instance by renaming or deleting before creating the new restore, but then the new RDS is not in my cloud formation stack anymore and does not have the proper tags. Instead the tags are in my old throw away instance.

This causes some negative side effects, like problems deleting the cloudformation stack and issues with taking a proper inventory.

Anyone know how to put the new restored instance into my cloudformation again?

like image 777
Henry Grantham Avatar asked Aug 27 '15 16:08

Henry Grantham


People also ask

How do I restore an RDS snapshot?

Sign in to the AWS Management Console and open the Amazon RDS console at https://console.aws.amazon.com/rds/ . In the navigation pane, choose Snapshots. Choose the DB snapshot that you want to restore from. For Actions, choose Restore snapshot.

Where are Amazon RDS snapshots stored?

Amazon RDS DB snapshots and automated backups are stored in S3. You can use the AWS Management Console, the ModifyDBInstance API, or the modify-db-instance command to manage the period of time your automated backups are retained by modifying the RetentionPeriod parameter.

How do I restore an RDS backup?

Open the AWS Backup console at https://console.aws.amazon.com/backup . In the navigation pane, choose Protected resources and the Amazon RDS resource ID you want to restore.

What is the difference between RDS snapshot and backup?

First backup is a full backup, while the others are incremental. When a DB instance is deleted, a final DB snapshot can be created upon deletion; which can be used to restore the deleted DB instance at a later date. RDS retains the final user-created DB snapshot along with all other manually created DB snapshots.


1 Answers

If you support downtime, you can proceed to:

  1. append the 'DBSnapshotIdentifier' to your RDS cloudformation template
  2. update your CFN stack which will recreate your RDS DB from the snapshot.
  3. update your DNS/hosts entries since the new RDS instance will have a new address.
like image 187
Stefan Serban Avatar answered Sep 18 '22 12:09

Stefan Serban