Enabling MultiAZ and Deploying a Read Replica with AWS RDS

Hands-On Lab

 

Photo of Trent Hayes

Trent Hayes

Training Architect

Length

00:30:00

Difficulty

Intermediate

Welcome to this live AWS environment where we will be working with the Relational Database Service (RDS). NOTE: This lab will take 15 minutes to spin up. This activity will provide you with hands-on experience with: 1) Enabling Multi-AZ and Backups 2) Creating a read replica 3) Promoting a read replica 4) Updating the RDS endpoint in Route53 Multi-AZ and read replicas serve different purposes with RDS. Multi-AZ is strictly for failover, as the standby instances cannot be read from by an application. Read replicas are used for improved performance and migrations. With read replicas, you can write to the primary database and read from the read replica. Because a read replica can be promoted to be the primary database, it makes for a great tool in disaster recovery and migrations. Good luck and enjoy the Learning Activity!

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Enabling Multi-AZ and Deploying a Read Replica with AWS RDS

Introduction

In this lab, we'll work with the Relational Database Service (RDS). Multi-AZ and read replicas serve different purposes in RDS. Multi-AZ is strictly for failover, as standby instances cannot be read by applications. Read replicas are used for improved performance and migrations. With read replicas, you can write to the primary database and read from the read replica. Because a read replica can be promoted to the primary database, it's a great tool for disaster recovery and migrations.

This activity will provide you with hands-on experience with:

  • Enabling Multi-AZ and backups
  • Creating a read replica
  • Promoting a read replica
  • Updating an RDS endpoint in Route53

Log in to the AWS live environment with the cloud_user credentials provided on the lab page.

Make sure you are using us-east-1 as your region throughout the lab.

Note: RDS is not a fast service, so be patient when spinning up or making changes to resources during this lab.

Multi-AZ and Read Replica Deployment

Enable Multi-AZ Deployment on the Primary RDS Database

Open a Web Page to Monitor Progress

  1. Navigate to EC2, and then click Load Balancers in the sidebar.
  2. Copy the DNS name of the load balancer.
  3. Open a new browser tab, and enter the DNS name. We'll use this web page to test failovers and promotions in this lab.

Enable Multi-AZ to Make the Database Fault Tolerant

  1. In the AWS console, navigate to RDS, and click Instances in the sidebar.
  2. Click the listed database instance.
  3. Scroll down to the Details section, and click Modify.
  4. In the Instance Specifications section, click Yes for Multi-AZ deployment.
  5. In the Backup section, change Backup retention period to 1 day.
  6. Click Continue.
  7. In the Scheduling of Modifications section, select Apply immediately, and then click Modify DB Instance. It will take a few minutes for the modification to finish.
  8. Use the web page to monitor the outage (normally about 30 seconds).
  9. Once the instance shows Multi-AZ is enabled, select the instance, click Instance actions, and select Reboot.
  10. Select Reboot With Failover?, and click Reboot.
  11. Refresh the application in the browser. We'll eventually get a gateway timeout. Refresh again to see the application come back. This shows us the standby Multi-AZ instance has become the primary.
  12. Back in the RDS dashboard, click Events in the sidebar to see what happened and the timing.

Create a Read Replica of the RDS Database

  1. Click the circle to the left of the database instance to select it.
  2. Click Instance actions.
  3. Select Create read replica.
  4. In the Network & Security section, choose US East (N. Virginia) for Region.
  5. In the Settings section, enter a DB instance identifier (e.g., "wordpress-rr").
  6. Leave the rest of the default settings as they are.
  7. Click Create read replica. It will take a few minutes to complete and for its status to become available.

Promote the Read Replica to the Primary Database

  1. Once the read replica is available, click the circle to the left of it to select it.
  2. Click Instance actions.
  3. Select Promote read replica.
  4. Leave the default Preferences as they are, click Continue, and then click Promote Read Replica.
  5. Use the web page to monitor for downtime.
  6. After a few minutes, once the read replica is available, click to open it.
  7. In the Connect section, copy the endpoint.

Alter the CNAME DNS Record Set in Route 53 to Point to the New Primary Database's Endpoint

  1. Open Route 53 in a new browser tab.
  2. Click Hosted zones.
  3. Click sysopsdatabase.com.
  4. Click the sysopsdatabase.com record.
  5. In the Value box, enter the read replica endpoint you copied a minute ago. Click Save Record Set.
  6. Use the web page to monitor for downtime.

Conclusion

Congratulations on completing this lab!