- Lab
- A Cloud Guru

Restoring an Amazon RDS Instance Using Snapshots
A critical part of database management is being able to recover your data after corruption or accidental deletion has occurred. In this hands-on lab, we'll use the point-in-time restore capability of RDS automated snapshots to restore a database and bring a site back up. **NOTE**: This lab may take up to 15 minutes to fully start due to the number of resources that need to be provisioned.

Path Info
Table of Contents
-
Challenge
Create an RDS Snapshot
Create a manual snapshot of the existing RDS database in this environment.
- In the RDS console, choose the running instance.
- Select Maintenance & backups > Take snapshot.
- Name the snapshot (e.g., "wordpress-YYYYMMDD").
-
Challenge
Log in to the Bastion Host and Delete Database Data
Log in to the bastion host via SSH, and, using the
mysql
command line, drop a critical table from the database.-
In the EC2 console, find the public IP of the bastion host.
-
Log in to the bastion host via SSH as
cloud_user
using the public IP. -
Install the MySQL command line
sudo yum install mysql
-
Connect to MySQL:
mysql --user=wpuser --password=Password1 --host=<RDS ENDPOINT NAME>
-
At the MySQL prompt, switch to the WordPress database:
use wordpressdb;
-
Delete a critical table:
drop table wp_posts;
-
-
Challenge
Restore an RDS Database from a Snapshot
Use the snapshot you created to create a new database with all the data from before it was corrupted.
- In the RDS console, navigate to snapshots.
- Note the snapshot creation time.
- Navigate to Databases, and select wordpress-database
- Under Actions, select Restore to point in time.
- Select a custom restore time, and enter the point in time you want to restore from.
- Name the recovered database instance "ordpress-recovery"
- Select availability zone -east-1b
- Launch the database instance.
-
Challenge
Rename Database Instances
Rename the
wordpress-recovery
instance towordpress-database
, and renamewordpress-database
to something else.- In the RDS console, select the wordpress-database instance, and click Modify.
- Change the DB instance identifier from "wordpress-database" to "wordpress-corrupt".
- Click Continue.
- Select Apply Immediately.
- Click Modify DB Instance.
- Follow the above steps to rename "wordpress-recovery" to "wordpress-database".
- Select the database security group.
- Click Continue.
- Select Apply Immediately.
- Click Modify DB Instance.
- Visit the website and observe that the last known good configuration is present.
What's a lab?
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.

