-
Notifications
You must be signed in to change notification settings - Fork 3
Creating, recreating, or restoring a database from a backup
In order to create, recreate, or restore an RDS instance from a backup, those backups must be available first. You must either have automatic snapshots being taken, a manual snapshot(s) created, and/or have a final backup created.
NOTE: In the case of recreating a database using its own snapshots, you can't use any automated snapshots because when the DB is being destroyed, the automated snapshots will be destroyed too.
-
Login to the Amazon RDS console and go to the Snapshots section.
-
Find the snapshot you want to use and click on it to expand the details. Find the DB Snapshot Name parameter and copy the value. If you don't see a snapshot you want to use, create one first.
-
In the terraform config you must set or modify the following:
-
snapshot_identifier
to the DB Snapshot Name value you copied
-
-
Leave the
name
property out or comment it out for now (C-style block comment syntax:/* name = "fec" */
). -
Review and merge the pull request.
This will do the following:
- Create the database instance with whatever configuration you set.
- Perform a restore using the specific snapshot.
-
In the terraform config you must set or modify the following:
-
final_snapshot_identifier
to a name of your choosing (must contain only letters, digits, or hyphens) -
snapshot_identifier
to the same name asfinal_snapshot_identifier
-
lifecycle
to just an empty config:{}
- comment out the
name
property (C-style block comment syntax):/* name = "fec" */
-
-
Make any other changes that necessitate recreating the database.
-
Review and merge the pull request.
This will do the following:
- Create a final back up of the database being recreated before destroying it.
- Destroy the database and create it again with whatever new configuration you set.
- Restore the final state of the previous instance of the database.