Deploying Amazon RDS Multi-AZ and Read Replica, Simulate Failover

Lab Details

  1. This lab walks you through the steps to launch an Amazon Aurora RDS DB instance with multi-AZ enabled. We will also simulate a database failover from one AZ to another.

  2. You will practice using Amazon Aurora.

  3. Duration: 1 hour 30 minutes

  4. AWS Region: US East (N. Virginia) us-east-1

Introduction

What is Amazon RDS?

Amazon RDS

  • Amazon Relational Database Service (Amazon RDS)  is a Relational Database service that offers high availability and throughput.

  • Amazon RDS comes with great features that include Multi-AZ feature and Read Replica that ensures no data loss.

  • Amazon RDS also provides you high scalability where you can scale up and scale down depending on your needs.

  • Amazon RDS provides you with six familiar database engines which include MySQL, Amazon Aurora, PostgreSQL, MariaDB, Oracle Database and SQL Server.

Multi-AZ

  • Multi-Availability zone ( Multi-AZ ) is a feature that comes with Amazon RDS that  provides you with high availability and durability for Database instances.

  • When we are opting for the Multi-AZ database instance, it will automatically create a Primary DB instance and parallelly replicate the data to the standby instances in different availability zones in that region. However, we can't access the standby instances, unlike primary instances.

  • The main purpose of Multi-AZ is to provide a failover option for primary RDS instances.

  • Amazon RDS uses the Failover mechanism for Oracle, MYSQL, MariaDB and PostgreSQL instances.

  • The RDS Failover process happens automatically and is managed by AWS  without human intervention.

  • Amazon RDS uses the concept of SQL Mirroring for Replicating data to standby instances in the different availability zones and both primary and standby instances use the same endpoint.

Reasons for Failover

  • The failover process will take place due to one of the following reasons occurring in the primary instances:

  • Host Failure 

  • DB instance class modification.

  • Instance rebooting

  • Availability zone failure

  • RDS maintenance     

Conditions for enabling Multi-AZ on RDS

  • minimum of two different availability zones should be present in a DB subnet group where you are launching your Primary DB instance.

Amazon Aurora and Read Replica

  • Amazon Aurora is the DB instance, which is a little different when comparing to the above-mentioned Instance types.

  • Aurora uses the concept of a DB cluster where the primary instance replicates its data across different availability zones.

  • In the case of a primary instance failure, Aurora automatically launches its primary instance from the replicated instance in a different availability zone.

  • Multi-AZ on Aurora clusters makes RDS replicate or provision a replica of the master database to a different availability zone within a Region.

Architecture Diagram

    

Task Details

  1. Launching Lab Environment

  2. Launch an EC2 Instance

  3. Create a Security Group for RDS instance

  4. Create an Amazon Aurora database with Multi-AZ enabled

  5. Connecting to the Aurora (MySQL) database on RDS

  6. Connecting the EC2 Server to RDS

  7. Execute Database Operations via SSH

  8. Forcing a Failover to Test Multi-AZ

  9. Testing the Failover Condition

  10. Validation of the lab

  11. Deleting AWS resources