As Cloud services are gaining popularity, many organizations are moving their infrastructure to the cloud to leverage high computational power, ease of management, and high-security measures. Amazon RDS is one such service that provides Relational Database service over the Cloud.

This blog discusses Amazon RDS, its features, and how you can implement Amazon RDS Read Replicas to balance the load. It provides 4 easy methods using which you can set up your Replication process. Read along to learn more about the topic and choose the method that suits you the most!

What is Amazon RDS?

Amazon Web Services offers Amazon RDS as a fully managed Relational Database service. Amazon RDS allows you to choose from six popular Database engines, including Maria DB, MySQL, PostgreSQL, Amazon Aurora, Oracle DB, and MS SQL.

You can use your existing SQL scripts, code, applications with the Amazon RDS with the added advantage of Scalability, Provisioning, Backup, Recovery, Security, and Maintenance. When you use Amazon RDS, you don’t have to worry about the other factors mentioned above, as AWS fully manages these RDS and is easy to set up.

Amazon RDS also provides a feature called Replication that allows you to copy the data from one Database to another to improve the performance and better failover capability.

Migrate Your SQL Server Data with Hevo

Are you looking for an ETL tool to migrate your SQL Server data? Migrating your data can become seamless with Hevo’s no-code intuitive platform. With Hevo, you can:

  • Automate Data Extraction: Effortlessly pull data from various sources and destinations with 150+ pre-built connectors.
  • Transform Data effortlessly: Use Hevo’s drag-and-drop feature to transform data with just a few clicks.
  • Seamless Data Loading: Quickly load your transformed data into your desired destinations, such as BigQuery.
  • Transparent Pricing: Hevo offers transparent pricing with no hidden fees, allowing you to budget effectively while scaling your data integration needs.

Try Hevo and join a growing community of 2000+ data professionals who rely on us for seamless and efficient migrations.

Get Started with Hevo for Free

What is Amazon RDS Read Replication?

Replication means a continuous copy of the data from one Database (master/publisher) to another Database (slave/subscriber). The slave/subscriber Databases can be on the same server or different servers and contain the replica of the master database.

The main aim of replication is to provide fault-tolerant access to data in case of failure of the master. Also, load balancing and routing some of the queries to the subscriber database to reduce the load on the primary Database.

Amazon RDS Read Replication is a feature on Amazon RDS that allows you to create one or more read copies of the primary Database within the same or different AWS region. The data from the master database is asynchronously copied to these slave or secondary databases. 

The various benefits of using RDS read replicas are:

  • Fault-Tolerant: By creating the exact copies of the data to different servers, you can ensure the availability of the data in case of any failure occurs as Read Replicas help to maintain a copy of databases in a different region for disaster recovery. 
  • Load Balancing: You can route the queries that only require read access to the data to these read replicas and hence reduce the load from the primary Database. One or more replicas of a given source DB Instance and serve high-volume application read traffic from multiple copies of your data, thereby increasing aggregate read throughput.
  • Scalability: Read Replicas allows you to scale the clusters that can be used for the efficient performance of read-heavy Database workload. They also allow elastic scaling beyond the capacity constraints of a single DB instance for read-heavy database workloads.
  • Multiple Source Support: You can utilize any of the available DB as Read replicas are available in RDS for MySQL, MariaDB, PostgreSQL, Oracle, and SQL Server as well as Aurora.

Amazon RDS Read Replicas basically allow you to have a read-only copy of your Database(DB). When a Read Replica is created, you are required to first specify an existing DB instance as the source.

Then Amazon RDS takes a snapshot of the source instance and creates a read-only instance from the snapshot. 

Amazon RDS uses the PostgreSQL, MySQL, Aurora, and MariaDB engines’ built-in replication functionality to create a particular type of DB instance called a read replica from a source DB instance.

Understanding Amazon RDS Promote Read Replicas

You can promote a MySQL, MariaDB, Oracle, PostgreSQL, or SQL Server read replica into a standalone DB instance. When you promote a read replica, the DB instance is rebooted before it becomes available.

Some reasons that you might want to promote a read replica are as follows:

  • Performing DLL Operations: You can perform DLL operations on a read replica once the read replica is in sync with its primary DB instance. Then you may promote the Amazon RDS Read Replicas and direct your applications to use the promoted instance.
  • Sharding: Sharding refers to breaking up a large Database into several smaller Databases. You can then create read replicas corresponding to each of your shards (smaller Databases) and promote them when you decide to convert them into standalone shards. 
  • Implementing Failure Recovery: You can use Amazon RDS Read Replicas promotion as a data recovery scheme if the primary DB instance fails. This approach complements synchronous replication, automatic failure detection, and failover.

You can find detailed information regarding Amazon RDS Promote Read Replicas here.

Read Replica Deletion & DB Failover

  • Read Replicas need to be explicitly deleted, by using the same mechanisms used for deleting a DB instance.
  • If the source instance of a multi-AZ deployment fails over to the standby, any related Read Replicas can be switched to utilize the secondary as their replication source.
  • If the source DB instance gets deleted without getting rid of the replicas, each replica gets promoted to a single, standalone AZ DB instance.

Read Replica Storage & Compute requirements

  • For replication to work properly, every Read Replica needs to have the same amount of storage and compute resources as the DB instance.
  • By default, a Read Replica gets created with the same storage type as the source DB instance.
  • Read Replicas need to be scaled accordingly if the source DB instance is scaled.

Cross-Region Read Replicas

  • Cross-region Read Replicas are not supported for SQL Server but are supported for MariaDB, MySQL, Oracle, and PostgreSQL.
  • These Read Replicas are gonna help you improve migration from a data center in one region to another region and your disaster recovery capabilities (reduces RPO and RTO). Cross-region Read Replicas also allow you to scale read operations into a region closer to the end-users.
  • You can create Cross-region Read Replicas from a source RDS DB instance that isn’t a Read Replica of another RDS DB instance.
  • A source DB instance can have cross-region Read Replicas in various AWS regions.
  • RDS cannot guarantee more than five Cross-region Read Replica instances, owing to the limit on the number of access control list (ACL) entries for a VPC.
  • Read Replicas leverage the default security group and the default DB parameter group and DB option group for the mentioned DB engine.
  • The replicas lags are higher for Cross-region Replicas. This lag time is because of the longer network channels between regional data centers.

Read Replica Features & Limitations

  • DB instance cannot be configured to serve as a replication source for an existing DB instance; a new Read Replica can be created only from an existing DB instance. For instance, if MyDBInstance is replicated to ReadReplica1, ReadReplica1 cannot be configured to replicate back to MyDBInstance.
  • RDS doesn’t support circular replication.
  • You can create a Read Replica from other replicas as well. However, the replica lag would be higher for these instances and there cannot be more than four instances involved in a replication chain.

RDS Read Replicas Use Cases

  • Serving read traffic while the source DB instance is unavailable. For instance, if the source DB instance cannot take I/O requests due to backups I/O suspension or scheduled maintenance, the read traffic cannot be redirected to the Read Replicas. However, the data might turn out to be stale.
  • Scaling beyond the I/O or compute capacity of a single DB instance for read-heavy database workloads. This, in turn, redirects the excess traffic to Read Replicas.
  • Implementing disaster recovery by promoting the read replica to a standalone instance as a disaster recovery solution, in case the primary DB fails.
  • Data Warehousing or Business Reporting scenarios where business reporting queries can be performed against a Read Replica, as opposed to the primary production DB instance.

Methods to Implement Amazon RDS Read Replicas

There are 4 ways, by which you can create Replica’s, let’s see all of them one by one:

Method 1: Implement RDS Read Replicas from AWS Console

To create RDS read replicas from AWS Console, follow the below step by step guide – 

Login Page - Amazon RDS Read Replicas
  • Step 2: On the RDS console, it is displayed, head out to the navigation pane and choose Databases.
Console AWS RDS - Amazon RDS Read Replicas
  • Step 3: From the database, choose the source server DB instance that can be – MySQL, MariaDB, Oracle, PostgreSQL, or SQL Server DB.
  • Step 4: Once you select the source DB, head out to the Actions tab, and choose to Create read replica.
Create Read Replicas - Amazon RDS Read Replicas
  • Step 5: After the successful selection, you need to choose the instance configuration. The ideal recommendation is to select the same instance and storage type as source DB.
  • Step 6: Adjust the other setting as needed. For more information, refer to the official Amazon Read Replica page and choose the database for a detailed explanation, here.
  • Step 7: After this, choose to Create a Read Replica

That’s it, Amazon will start the processing and soon the Read Replica will be created.

Method 2: Implement RDS Read Replicas from AWS CLI

AWS CLI Logo - Amazon RDS Read Replicas

Creating a Read Replica from the CLI is very straightforward. Follow the below steps to create a Read Replica from CLI.

  1. Install the AWS CLI on your machine. Follow the detailed guide on AWS CLI Installation, here.
  2. Configure the Secret key and the Access key.
  3. Execute the below command on CLI to create Read Replica.

For Linux:

aws rds create-db-instance-read-replica --db-instance-identifier myreadreplica --source-db-instance-identifier mydbinstance

For Windows:

aws rds create-db-instance-read-replica --db-instance-identifier myreadreplica --source-db-instance-identifier mydbinstance

Method 3: Implement RDS Read Replicas using RDS API

You can also use the programming interface and call the RDS API to create the Read Replica.

Below is the sample of the POST request to create an RDS Read Replica:

https://rds.amazonaws.com/

?Action=CreateDBInstanceReadReplica
&DBInstanceIdentifier=myreadreplica
&SourceDBInstanceIdentifier=mydbinstance
&Version=2012-01-15
&SignatureVersion=2
&SignatureMethod=HmacSHA256
&Timestamp=2012-01-20T22%3A06%3A23.624Z
&AWSAccessKeyId=<AWS Access Key ID>
&Signature=<Signature>

Method 4: Implement RDS Read Replicas using Hevo Data

Hevo Data, a No-code Data Pipeline, helps you directly transfer data from 150+ data sources to databases such as SQL Server, Data Warehouses, BI tools, or a destination of your choice in a completely hassle-free & automated manner.

Hevo Data takes care of all your data preprocessing needs and lets you focus on key business activities and draw a much powerful insight on how to generate more leads, retain customers, and take your business to new heights of profitability.

The following steps are required for RDS Read Replication using Hevo Data:

Step 1: Log in to your Redshift Dashboard and select the cluster that you want to Replicate as shown in the below image.

Cluster Selection Image
Image Source

After this, you need to configure your Cluster with Hevo.

Step 2: Configure your Amazon Redshift account as a destination for the Cluster Selected in the previous step. This is shown in the below image.

Configuring Redshift as Destination
Image Source

That’s it! Your Replication process will now begin automatically using Hevo Data Pipeline.

Conclusion

This blog discussed Amazon RDS, its features, and 4 different ways to create and implement Amazon RDS Read Replicas.

This blog provides a brief introduction of numerous concepts related to it & helps the users understand them better. These methods, however, can be challenging especially for a beginner.

However, suppose you’re looking for an easy solution. In that case, you can try Hevo Data, a No-code Data Pipeline, which can help you replicate data in real-time without having to write any code.

Looking for a better way to manage your work? Get started with a free Hevo trial.

Vishal Agrawal
Technical Content Writer, Hevo Data

Vishal Agarwal is a Data Engineer with 10+ years of experience in the data field. He has designed scalable and efficient data solutions, and his expertise lies in AWS, Azure, Spark, GCP, SQL, Python, and other related technologies. By combining his passion for writing and the knowledge he has acquired over the years, he wishes to help data practitioners solve the day-to-day challenges they face in data engineering. In his article, Vishal applies his analytical thinking and problem-solving approaches to untangle the intricacies of data integration and analysis.