Amazon Aurora cluster has only one primary compute instance by default which performs read/write operations. We can gain high scalability and availability for database clusters by adding one or more Aurora Replicas to the cluster. Usually, we create Aurora replicas in different Availability Zones and by this, our database can work without being stopped even in the infrastructure problem in the primary Availability zone.
In this blog, we will show how to configure an Amazon Aurora cluster to create a high-availability database. We will use Amazon Aurora with MySQL and will create an Aurora cluster via the Amazon RDS.
What is Amazon Aurora?
Amazon Aurora is a relational database service by AWS with PostgreSQL and MySQL compatibility. It is a fully managed AWS service that helps you save time by automating time-consuming tasks such as backup, recovery, failure detection, and repair.
What is a High Availability Database?
A high-availability database includes computing nodes replicated across multiple availability zones(AZ) to increase read scalability and failover protection.
Now let’s create a High Availability database cluster with Amazon Aurora
- Login to your AWS Console and open Amazon RDS.
- From the Amazon RDS console, Choose the Region in which you want to create the DB instance, then click on Create database.
- On the create database page, Choose Standard Creation Method, and then for Engine type, choose Amazon Aurora and also select the addition that you want.
- Enter the name of your Database Cluster Identifier, Master User name, and Password. (Remember the password for future reference)
- Leave the default settings for capacity type and engine version. Amazon Aurora charges per hour according to instance type. Choose db.t2.small to keep the cost low. (1 vCPU, 2GiB ram)
- Select No under Multi-AZ deployment. Disable the Delete Protection and leave everything as default.
- Click on Create Database. Your Database instance will appear in the list of databases in the RDS Console.
Creating an Aurora Replica for High Availability
We can increase the compute availability by adding up to 15 Read Replicas in different AZs within a region.
- Select our database from the RDS console and take a note of AZ under networking.
- Create a Replica by selecting Actions> Add reader.
- Make sure you select a different AZ from the primary DB. Select the same settings for this instance as the previous one and enter a unique of this read replica DB instance.
- Click on Add reader.
You will see in the database list that a new replica has been created with a reader role. You will also see multiple availability zones attached to it. You have successfully achieved high availability on the compute layer for your DB instance.