Read Replicas( RDS )

Learn via video courses


Amazon RDS allows us to create replicas of database instances known as RDS Read Replicas. These read replicas support only read operations and can be created in one or more AWS regions which can be the same or different from the AWS region of the primary database instance, depending on need. RDS Read Replicas in AWS can be created for various database engines like PostgreSQL, MySQL, MariaDB etc.

Introduction to Amazon RDS Read Replicas

Amazon RDS Read Replicas is a feature of Amazon RDS that helps to replicate the primary Database within the same or different AWS regions. This replication process is asynchronously from the primary database to the RDS Read Replicas, i.e., when the primary database gets affected for any reason, RDS Read Replicas acts as the primary database. The diagram below explains the working of RDS Read Replicas. Amazon RDS

The main aim of the Amazon RDS Read Replicas is to give users fault-tolerant access to data, even after any failure or disruption in the primary database. Fault-Tolerant, Load Balancing, Scalability, and Multiple Source Support are the benefits of using RDS Read Replicas.

RDS Read Replica in AWS creates a read-only version of the primary database. Amazon RDS uses PostgreSQL, MySQL, Aurora, and MariaDB engines to create RDS Read Replicas from a source DB instance.

Creating an RDS Read Replica

Let's look at the steps to create an RDS Read Replica. Before creating a replica, first, we have to build a primary/source DB instance.

Create a MySQL DB Instance

Follow these steps to create a MySQL DB instance.

  1. Sign in to the AWS Management Console, search for the RDS service, and click on the service that appears on the list. sign in rds

  2. In the Amazon RDS, scroll down the page and click the Create Database button. Create Database

  3. We are redirected to the Create Database page. Here we need to fill in the details required for creating the database. For the creation method, we select the Standard Create option, and from the list of database engines, we will choose MySQL as we are creating a MySQL Database instance. creation method

  4. Next, Choose the Free tier template from the template section. free-tier

  5. Scroll down and set the name of the DB instance identifier. Give the administrator name and password to enjoy the admin privileges for the DB instances. instance identifier

  6. In the storage configuration, allocate 20 GiB and set the maximum threshold frequency to 22 GiB. maximum threshold

  7. Leave all the other configurations as default and click on Create database. click on Create database

  8. It will take a few minutes to create the database, and the status of the database will change from Creating to Available. available

Create an RDS Read Replica

  1. Select the created database and click on Actions. Choose Create read replica from the Action menu and click it. creating RDS Read Replica
  2. It redirected to the Create read replica DB instance page. creating RDS Read Replica step-2
  3. We can set the region and Availability zone. Here, we create the replica in the same region. creating-rds-read-replica-step-3
  4. Choose the Read replica source and set the name of the DB instance identifier. creating-rds-read-replica-step-4
  5. Leave all the other configurations as default and click on Create read replica. creating-rds-read-replica-step-5
  6. It will take a few minutes to create the replica, and its status changes from Creating to Available. creating-rds-read-replica-step-6

We successfully created a read replica of the DB instance.

Creating RDS Read Replica in a Different AWS Region

In the previous section, we created a read replica of a DB instance in the same region. Let's create a cross-region read replica.

  1. Select the primary DB instance and click on Actions. Click on Create read replica from the Actions menu. creating-rds-in-different-aws-region
  2. It redirected to the Create read replica DB instance page. creating-rds-in-different-aws-region-step-2
  3. In the Network & Security, choose a different AWS region and a DB subnet group. creating-rds-in-different-aws-region-step-3
  4. Choose the Read replica source and set the name of the DB instance identifier. creating-rds-in-different-aws-region-step-4
  5. Leave all the other configurations as default and click on Create read replica. creating-rds-in-different-aws-region-step-5
  6. It will initiate the creation of a replica in the different regions. Click on Close. creating-rds-in-different-aws-region-step-6
  7. Click on the region name and open the other region in a new tab. creating-rds-in-different-aws-region-step-7
  8. We will see a replica is creating the other region. creating-rds-in-different-aws-region-steps-8
  9. Go back to the previous tab. Here, we saw two connections are established from the primary database, one from the replica in the same region and the other from the replica in a different region. creating-rds-in-different-aws-region-steps-9
  10. After a few minutes, the cross-region replica of the database is created and in Available status. creating-rds-in-different-aws-region-step-10

We successfully created a Read Replica in a different AWS Region.

Read Replicas Monitoring

AWS provides the feature to monitor the status of RDS Read Replica in various ways. Follow the given steps to use the replica monitoring feature.

  1. Go to the Replication section of the Connectivity & Security tab in the read replica details. Read Replicas Monitoring

This status of the Replication state can be:

  • Replicating
  • Replication degraded
  • Error
  • Terminated
  • Stopped
  • Replication stop point set
  • Replication stop point reached
  1. Click on the Monitoring tab to see the Graphical representation of the usage provided by Amazon Cloudwatch. read-replicas-monitoring-step-2

Read Replica Deletion & DB Failover

Read Replica Deletion

We can delete an RDS Read Replica using the same mechanism to delete a DB instance.

Let's delete the created RDS Read Replica.

  1. Select the RDS Read Replica instance and click the Actions button. Click on Delete from the Actions menu. Read Replica Deletion
  2. Type delete me in the box and click Delete. read-replica-deletion-step-2
  3. Deleting that Read Replica in AWS will take some time. After a few minutes, the RDS Read Replica instance is successfully deleted. read-replica-deletion-step-3

DB Failover

Now, think about a situation when the primary DB instance fails or get crashes. What happened to its RDS Read Replica? This is the case of DB Failover. In this case, the RDS Read Replica created from the primary DB instances got converted into the standalone DB instance. Let's see this case with hands-on experience. In our case, we have a primary DB instance and created an RDS Read Replica. Let's delete the primary DB instance.

Follow these Steps:

  1. Select the primary DB instance and click on the Actions button. Click on Delete from the Actions menu. delete the primary DB instance
  2. Mark the Checkbox accordingly and click on the Delete button. delete-the-primary-db-instance-step-3
  3. After a few minutes, we saw that the RDS Read Replica Role is converted into an instance from Replica, and the Primary DB instance is deleted. delete-the-primary-db-instance-step-5

Read Replica Storage & Compute Requirements

  • By default, the configuration (storage type) of the read replica is the same as the database instance from which the replica is created.
  • The storage and compute resources of the read replica are the same as the source database instance from which it is replicated.
  • Having similar configuration and resources allows the RDS Read Replica in AWS to function properly.
  • In case the source database instance is scaled, the RDS Read Replicas should also be scaled accordingly.

Read Replicas Promotion

We learn about the RDS Read Replicas in aws and create the replica in the same region and the cross-region. Let's learn how to promote an RDS Read Replica.

As the name suggests, promotion means to upgrade, i.e. we can promote an RDS Read Replica to become the standalone DB instance. Read Replicas Promotion The figures show After promoting a read replica, the Amazon RDS Read Replica is promoted to the Amazon RDS DB instance.

We perform RDS Read Replica promotion for the following reason:

  • To perform DDL operations
  • It helps in the Sharding of the database.
  • To implement failure recovery.

Let's do a hands-on demo to convert the replica into a DB instance using the RDS Read Replica Promotion.

Follow these steps:

  1. Earlier, we created an RDS Read Replica in another region. Go to that page and select the RDS Read Replica. Click the Actions button and choose Promote from the Actions menu. read-replicas-promotion-step-1
  2. It will redirect to the Promote read replica page. Set the Backup retention period. read-replicas-promotion-step-2
  3. Leave other configurations as default and click on Promote read replica. read-replicas-promotion-step-3
  4. In a few minutes, the Role changes from Replica to Instance, i.e. now, this became a standalone DB instance from an RDS Read Replica. read-replicas-promotion-step-4

Cross-Region Read Replicas

AWS provides the feature to create the RDS Read Replica across different regions.

  • MariaDB, MySQL, Oracle, and PostgreSQL support the cross-region read replicas but are not supported by the SQL server.
  • Cross-Region RDS Read Replicas improve the disaster recovery capabilities and reduces RTO and RPO.
  • It helps to migrate the data from a data center in one region to another region.
  • We can create a cross-region RDS Read Replica from a source RDS DB instance. This database should not be a replica of another RDS DB instance.
  • Due to the restriction on the amount of access control list (ACL) entries for a VPC, RDS cannot guarantee more than five Cross-region Read Replica instances.
  • The RDS Read Replica uses the default security group.
  • If we delete the source of the cross-region RDS Read Replica, then,
    • For MariaDB, MySQL, and Oracle DB instance RDS Read Replica is promoted.
    • In the case of the PostgreSQL DB instance, the RDS Read Replica is set to terminate.

Read Replica Features & Limitations

Features of RDS Read Replica

Let's discuss some of the features of RDS read replicas in AWS concerning PostgreSQL and MySQL/MariaDB.

S No.FeaturesPostgreSQLMySQL/MaraiDB
1.Replication MethodPhysicalLogical
2.Transaction LogsIt has a parameter named wal_keep_segments, which decides the number of logs to keepBinary logs which are not applied doesn't get deleted
3.Replica operationHere replica can only execute read operationHere, we can enable writer mode for the replica, after which the replica can perform write operation as well
4.Backups for ReplicasWe can create a backup by creating snapshots, but cannot enable automatic backupsWe can enable automatic backups for MySQL and MariaDB Read replicas
5.Parallel ReplicationIt does not allow for parallel replication. It is capable of supporting only a single process handling the replication.For any version of MariaDB read replica parallel replication process is supported. For MySQL version 5.6 or greater, that supports parallel replications.

Limitations of RDS Read Replicas

Let's explore some of the limitations of RDS Read Replicas in AWS.

  • Circular Replication
    • There are three kinds of replication, single, parallel and circular.
    • RDS Read replicas support single and parallel replication processes but do not support circular replication.
  • Repliaction Chain
    • We can create RDS read replicas from primary database instances and other RDS read replicas.
    • However, we have a limitation to this. There can be a maximum of four instances involved in the replication chain. This is to avoid the lag experienced in the read replicas replicated from other read replicas.
  • Replicate Back
    • Suppose we create a read replica named Read_Replica_1 from a database instance. After some time, if we make changes to the database instance, we do not have any configuration to replicate the Read_Replica_1 to the database instance.
    • To have a read replica with the latest changes, we need to create a new read replica, say Read_Replica_2.

RDS Read Replicas Use Cases

Let's discuss the use case of the RDS Read Replicas in AWS.

  • Reading Database Workload:
    • For database workloads where only reading operation is required, we can scale using RDS read replicas in AWS instead of creating single DB instances.
  • Read Requests:
    • In some cases, the single database instance can be under maintenance or suspension due to an increase in space consumption by I/O backups.
    • In such cases, the database instances cannot respond to further requests, be they read or write requests.
    • To resolve this, we can use RDS Read Replicas, as the read requests can be redirected to the read replicas, and they can respond to the requests.
    • One of the drawbacks of redirecting the read requests to read replica is that the data might not be up-to-date.
  • Reporting:
    • In some scenarios like business report generation or data warehouse work, only read requests are made to the database instances.
    • Here, instead of increasing the workload on database instances, we can use RDS read replicas in AWS.
  • Disaster Recovery:
    • If we have only one primary database instance that fails, read replicas can be used to recover the data loss. It serves as a backup in cases of disaster.
    • Another case is that the primary DB instance is located in a region where a natural disaster hits. Here, if the read replicas are created in another AWS region, they can serve as backups.


  • Amazon RDS helps us to create read replicas of primary database instances. These replicas are capable of performing read operations.
  • RDS read replicas are helpful in disaster recovery and addressing read requests when the primary database is busy or not functioning.
  • Read replicas in RDS supports single process and parallel process replication, but not circular replication.
  • It creates physical replication for PostgreSQL-based database instances and logical replication for MySQL/MariaDB based instances.
  • Replicas are created with the same computing and storage resources for the replica to function properly.
  • Using the AWS Management Console, we can configure things to be done in case of database instance failover.