Introduction & HA Overview
Aurora Single Master
Aurora Multi Master
The course is part of these learning paths
Interested in learning about Amazon Aurora?
Amazon Aurora is a next generation cloud native relational database, providing unrivalled performance and availability features!!
This course explores the various configuration options and techniques that you can use to create highly available Amazon Aurora databases. It starts off by looking at the high availability options available within Amazon Aurora, before diving deeper into more specific features, such as single and multi master setups, read replicas, and how Aurora can be provisioned serverless. Each new topic is accompanied by a real-world demonstration to help you better understand the concepts presented within the course.
For any feedback or questions relating to this course, please contact us as firstname.lastname@example.org.
- Understand how to provision and configure Amazon Aurora in a manner that ensures it is highly available and able to serve all read and write requests.
This course is intended for those responsible for architecting Aurora database setups, with an emphasis on high availability.
To get the most from this course, you should be familiar with basic SQL database concepts. If required, consider taking our "Database Fundamentals for AWS" course first.
The following GitHub repository is referenced within this course:
Let's take a quick look at a demo that shows how easy it is to set up and use a single master Aurora database with multiple read replicas.
In this example, I’ll perform the following sequence:
- Launch a single master Aurora MySQL database cluster with a single read replica within the AWS RDS console.
- Connect to the master and create a new MySQL database named demo, and within it create a new table named course.
- Confirm that when connecting using the writer connection endpoint that SQL inserts can be performed successfully.
- Confirm that when connecting using the reader connection endpoint that SQL inserts cannot be performed.
- Use the AWS RDS console to add an additional read replica to demonstrate how easy it is to scale out read capacity.
- Connect to the new read replica and confirm that the data has been successfully replicated and can be returned.
- Perform a failover - converting one of the read replicas into the primary.
Ok, let's begin. Starting off in the AWS RDS console - I’ll create a new Amazon Aurora MySQL single master with multiple readers database.
Under the Database features, I’ll select the “One writer and multiple readers” option. I’ll set the DB cluster identifier to be “cloudacademy-db-singlemaster”. I’ll configure the credentials to be admin with a password of cloudacademy. For instance size - I’ll select the burstable classes option and then simply choose the smallest size - which happens to be the db.t2.small instance.
Under the Availability and Durability section, I’ll choose the option to create and deploy a read replica.
I’ll then deploy it into an existing Multi AZ VPC. For security groups - I’ll simply allocate an existing one which allows inbound TCP connections to the default Mysql port 3306. Connections will be made from an existing bastion host which has the standard MySQL client already installed on it.
Ok with all that in place, I can now go ahead and click on the “Create Database” button at the bottom. Provisioning is fairly quick and takes just a matter of minutes to complete.
Now that the database is ready I’ll take a copy of the writer connection endpoint. Next, I’ll jump into my local terminal and connect to the bastion host using SSH.
Once connected I’ll use the MySQL client utility to connect to the master database instance using the writer connection endpoint just copied. Once authenticated into the master database instance - I’ll simply create a new database named demo and then create a new course table within it. With the course table created I’ll confirm that I can perform inserts to confirm that writes can be performed - which is indeed the case.
Next, let's now try connecting via the reader connection endpoint - and perform the same inserts. This time as expected we are unable to perform inserts since the reader connection endpoint connects to the read replica.
Next - I’ll add an additional read replica into the cluster. To do so I’ll jump back into the AWS RDS console and here I’ll select the “cloudacademy-db-singlemaster” database and then under the Actions drop down, select the Add Reader option. Within the Add Reader section, I’ll leave all of the defaults as is and give the new read replica the identifier “cloudacademy-db-replica” and then click the Add reader button at the bottom.
Refreshing the current page you can now see that the Aurora database cluster consists of a single master and 2 read replicas.
Checking the new read replica status we can see that it is still in Creating status. We need to wait until it reaches the Available status - once it does I’ll copy the instance endpoint and then connect to it using the MySQL client on the bastion host. Once connected I’ll simply perform a select all on the course table to confirm that the data has been successfully replicated - which it has.
Finally, I’ll jump back into the RDS console. With the new read replica still selected, I’ll perform a failover to it - by selecting the failover option within the Actions dropdown menu. On the confirmation page, I’ll proceed by clicking the failover button. This kicks off the failover which will take a minute or 2 to show up within the current page. Let’s now refresh it to confirm that the cloudacademy-db-replica has now been promoted to the role of writer which it has - and that the original master is now a read-only as per the reader role which has been allocated to it.
In summary, this demonstration highlighted the following:
- How to provision a new Aurora MySQL single master database with multiple read replicas.
- Confirmed that writes can only be made against the master and that the read replicas are for reading only.
- How to add an additional read replica into the database cluster and have data automatically replicated into it.
- And how to perform a failover from the master to one of the read replicas.
If you’ve followed along, don’t forget to terminate your database cluster to avoid ongoing charges.
Jeremy is a Content Lead Architect and DevOps SME here at Cloud Academy where he specializes in developing DevOps technical training documentation.
He has a strong background in software engineering, and has been coding with various languages, frameworks, and systems for the past 25+ years. In recent times, Jeremy has been focused on DevOps, Cloud (AWS, GCP, Azure), Security, Kubernetes, and Machine Learning.
Jeremy holds professional certifications for AWS, GCP, and Kubernetes.