AWS RDS Read Replica

How to Create an AWS RDS Read Replica?

 

Keep in Mind

It’s not possible to create a read replica in another AWS account from that of the source DB instance.

Using the Console

For creating an AWS RDS read replica out of a source SQL Server, Oracle, MySQL, MariaDB or PostgreSQL DB instance, follow the below steps:

  1. Login to the AWS Management Console. Then, head straight to the Amazon RDS console using the following link https://console.aws.amazon.com/rds/.
  2. From navigation pane, click on the option Databases.
    AWS RDS Read Replica - Databases

    AWS RDS Read Replica – Databases

     

  3. Select which SQL Server, Oracle, MySQL, MariaDB or PostgreSQL DB instance you’d like to utilize to be the source for a read replica.
  4. In the section of Actions, click on the option Create read replica.
    AWS RDS Read Replica - Create Read Replica

    AWS RDS Read Replica – Create Read Replica

     

  5. In the section of DB instance identifier, fill in a specific name for the read replica.
    AWS RDS Read Replica - Identifier

    AWS RDS Read Replica – Identifier

     

  6. Select your required instance specifications. It is recommended that you utilize the exact DB instance class as well as storage type to be the source DB instance for the read replica.
  7. In the section of Multi-AZ deployment, click on the option Yes for creating a standby of your replica in a different AZ to get failover support for your replica.

    AWS RDS Read Replica - Multi AZ

    AWS RDS Read Replica – Multi AZ

Keep in Mind

When you create a read replica to be a Multi-AZ DB instance does not depend on the fact that if the source database is a Multi-AZ DB instance or not.

  1. For creating an encrypted read replica:
    AWS RDS Read Replica - Encryption

    AWS RDS Read Replica – Encryption

    1. Click on the option Enable encryption.
    2. In the section of Master key, select the AWS KMS key identifier of the CMK.

Keep in Mind

Your source DB instance needs to be encrypted.

  1. Fill in other options, like storage autoscaling.
  2. Click on the option Create read replica.

 

How to Promote an AWS RDS read replica to be a standalone DB instance?

 

Using the Console

For the sake of promoting an AWS RDS read replica to a DB instance, follow the below listed steps:

  1. Login to the AWS Management Console. Then, head straight to the Amazon RDS console using the following link https://console.aws.amazon.com/rds/.
  2. From the Amazon RDS console, click on the option Databases.

You will now see the Databases pane displayed. Every read replica displays Replica in the Role column.

  1. Select the read replica which you’d like to promote.
  2. In the section of Actions, click on the option Promote.
  3. From the page called Promote Read Replica, fill in the backup retention period and the backup window for your promoted DB instance.
  4. As soon as all the settings are perfectly set, click on the option Continue.
  5. From the acknowledgment page, click on the option Promote Read Replica.

 

How to Create an AWS RDS read replica in another AWS Region?

Below you can learn how it is possible to create a read replica from a source PostgreSQL, Oracle, MariaDB or MySQL DB instance in another AWS Region.

Using the Console

It is possible to create a read replica across Regions through the Management Console.

For the sake of creating an AWS RDS read replica across Regions using the console, follow the steps listed below:

  1. Login to the AWS Management Console. Then, head straight to the Amazon RDS console using the following link https://console.aws.amazon.com/rds/.
  2. From navigation pane, click on the option Databases.
  3. Select which PostgreSQL, Oracle, MariaDB or MySQL DB instance you’d like to utilize to be the source for a read replica.
  4. In the section of Actions, click on the option Create read replica.
  5. In the section of DB instance identifier, fill in a name for the read replica.
  6. Click on Destination Region.
  7. Select all the instance specifications you’d like to use. It is recommended that you utilize the exact DB instance class as well as the same storage type for your read replica.
  8. For creating an encrypted read replica in a different AWS Region:
    1. Click on the option Enable encryption.
    2. In the section of Master key, select the AWS KMS key identifier of the CMK of the destination Region.

Keep in Mind

For creating an encrypted AWS RDS read replica, the source DB instance needs to be encrypted.

  1. Fill in the remaining different options, like storage autoscaling.
  2. Click on the option Create read replica.

 

Examples of Cross-Region replication:

 

Example One: Creating a cross-Region read replica located outside of a VPC

Below is an example for creating a read replica in the region of “us-west-2” from a source DB instance located in the region of “us-east-1”. This read replica will get created outside of a VPC:

Unix, Linux or macOS:

aws rds create-db-instance-read-replica \

–db-instance-identifier SimCoProd01Replica01 \

–region us-west-2

–source-db-instance-identifier arn:aws:rds:us-east-1:123456789012:db:SimcoProd01

Windows:

aws rds create-db-instance-read-replica ^

–db-instance-identifier SimCoProd01Replica01 ^

–region us-west-2

–source-db-instance-identifier arn:aws:rds:us-east-1:123456789012:db:SimcoProd01

 

Example Two: Creating a cross-Region read replica inside a VPC

In this example we are going to create a read replica in the region of “us-west-2” from a source DB instance located in the region of “us-east-1”. This read replica will get created in the VPC associated with the set DB subnet group:

Unix, Linux or macOS:

aws rds create-db-instance-read-replica \

–db-instance-identifier SimCoProd01Replica01 \

–region us-west-2

–db-subnet-group-name my-us-west-2-subnet

–source-db-instance-identifier arn:aws:rds:us-east-1:123456789012:db:SimcoProd01

Windows:

aws rds create-db-instance-read-replica ^

–db-instance-identifier SimCoProd01Replica01 ^

–region us-west-2

–db-subnet-group-name my-us-west-2-subnet

–source-db-instance-identifier arn:aws:rds:us-east-1:123456789012:db:SimcoProd01

 

How to Monitor your AWS RDS read replication?

It is possible for you to monitor the status of an AWS RDS read replica in multiple ways. The Amazon RDS console will display the status of a read replica under the section of Availability and durability in the read replica details. For seeing the details of a read replica, select the name of your needed read replica out of the listed instances on the Amazon RDS console.

AWS RDS Read Replica - Status

AWS RDS Read Replica – Status

It is as well possible to view the status of a read replica utilizing the following command: “CLI describe-db-instances”, or using the RDS API “DescribeDBInstances” operation.

A status of an AWS RDS read replica may be 1 of the below listed:

  • Replicating: It is successfully replicating.
  • Error: There is an error that happened with the replication.
  • replication degraded (SQL Server): Replicas are now getting data from the primary instance, yet 1 or more databases might not be receiving updates.
  • stopped (MariaDB or MySQL): Replication was stopped due to a customer-initiated request.
  • replication stop point set (MySQL): A customer-initiated stop point has been set with the mysql.rds_start_replication_until stored procedure and replication is taking place.
  • terminated (MariaDB, MySQL, or PostgreSQL): Replication has been terminated.
  • replication stop point reached (MySQL): A customer-initiated stop point has been set with the mysql.rds_start_replication_until stored procedure and replication gets stopped due to reaching the stop point.

You can learn about Option groups with the How to Manage Your AWS RDS Option Group article.

AWS RDS DB Instance


AUTHOR