AWS RDS MySQL Multi AZ setup and Read Replicas

Stefan Pöltl
4 min readFeb 23, 2021
Master and secondary replica RDS instances

In this post we take a look what AWS RDS offers to be a high performant and resilient database system. RDS has two capabilities called Multi AZ and read replicas to get this done.

What means multi AZ on RDS?

  • Feature to keep your database service running and make it resilient
  • Another RDS instance(replica) gets configured to work in another availability zone but in the same region as your primary instance
  • Basically it’s a failover option for your primary RDS instance
  • It’s not a read replica!
  • Data replications works synchroniously between availability zones
  • MySQL, Oracle, PostgreSQL and MariaDB support failover mechanism that is managed completely by AWS

What happens on failover?

AWS updates the DNS record in 60 to 120 seconds and points it to the failover replica.

When gets a failover scenario triggered?

  • Patching maitenance
  • Failure in the availablity zone
  • Host failure
  • DB instance class gets modified
  • Instance rebooted with failure
  • AWS triggers an event “RDS-EVENT-0025” when the failover is done (SNS Notification possible)

How to enable the multi-az option on my db?

With the AWS CLI it’s really easy:

aws rds modify-db-instance --db-instance-identifier my-db --multi-az

In the configuration tab in the management console you can see the following on your db instance:

Multi-AZ enabled and secondary zone is set

Test failover

First of all we need to check the current availability zones with the aws cli:

aws rds describe-db-instances --db-instance-identifier my-db --output json --query='DBInstances[*].[AvailabilityZone,SecondaryAvailabilityZone]'

--

--