Amazon RDS Read Replicas provide enhanced performance and durability for RDS database (DB) instances. They make it easy to elastically scale out beyond the capacity constraints of a single DB instance for read-heavy database workloads. You can create 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. Read replicas can also be promoted when needed to become standalone DB instances. Read replicas are available in Amazon RDS for MySQL, MariaDB, PostgreSQL, Oracle, and SQL Server as well as Amazon Aurora.
For the MySQL, MariaDB, PostgreSQL, Oracle, and SQL Server database engines, Amazon RDS creates a second DB instance using a snapshot of the source DB instance. It then uses the engines' native asynchronous replication to update the read replica whenever there is a change to the source DB instance. The read replica operates as a DB instance that allows only read-only connections, applications can connect to a read replica just as they would to any DB instance. Amazon RDS replicates all databases in the source DB instance.
Amazon Aurora further extends the benefits of read replicas by employing an SSD-backed virtualized storage layer purpose-built for database workloads. Amazon Aurora replicas share the same underlying storage as the source instance, lowering costs and avoiding the need to copy data to the replica nodes. For more information about replication with Amazon Aurora, see the online documentation.
Benefits
Enhanced performance
You can reduce the load on your source DB instance by routing read queries from your applications to the read replica. Read replicas allow you to elastically scale out beyond the capacity constraints of a single DB instance for read-heavy database workloads. Because read replicas can be promoted to master status, they are useful as part of a sharding implementation.
To further maximize read performance, Amazon RDS for MySQL allows you to add table indexes directly to Read Replicas, without those indexes being present on the master.
Increased availability
Read replicas in Amazon RDS for MySQL, MariaDB, PostgreSQL, Oracle, and SQL Server provide a complementary availability mechanism to Amazon RDS Multi-AZ Deployments. You can promote a read replica if the source DB instance fails, and you can set up a read replica with its own standby instance in different AZ. This functionality complements the synchronous replication, automatic failure detection, and failover provided with Multi-AZ deployments.
Designed for security
When you create a read replica for Amazon RDS for MySQL, MariaDB, PostgreSQL, Oracle, and SQL Server Amazon RDS sets up a secure communications channel using public key encryption between the source DB instance and the read replica, even when replicating across regions. Amazon RDS establishes any Amazon Web Services security configurations, such as adding security group entries, needed to enable the secure channel.
You can also create read replicas for your Amazon RDS for MySQL, MariaDB, PostgreSQL, Oracle, and SQL Server database instances encrypted at rest with Amazon Key Management Service (KMS).
Setup
Using the Amazon Web Services Management Console, you can easily add read replicas to existing DB Instances. Use the "Create Read Replica" option corresponding to your DB Instance in the Amazon Web Services Management Console. Amazon RDS for MySQL, MariaDB and PostgreSQL allow you to add up to 15 read replicas to each DB Instance. Amazon RDS for Oracle and SQL Server allow you to add up to 5 read replicas to each DB Instance.
Amazon RDS for MySQL, MariaDB, PostgreSQL, and Oracle offer you two SSD-based choices for database storage: General Purpose and Provisioned IOPS. Read replicas for these engines need not use the same type of storage as their master DB Instances. You may be able to optimize your performance or your spending by selecting an alternate storage type for read replicas. For more information see read replicas documentation for Amazon RDS for MySQL, MariaDB, PostgreSQL, Oracle, and SQL Server as well as Amazon Aurora.
Read replicas, Multi-AZ deployments, and multi-region deployments
Amazon RDS read replicas complement Multi-AZ deployments. While both features maintain a second copy of your data, there are differences between the two:
Multi-AZ deployments |
Multi-Region deployments |
Read replicas |
Main purpose is high availability |
Main purpose is disaster recovery and local performance |
Main purpose is scalability
|
Non-Aurora: synchronous replication; Aurora: asynchronous replication |
Asynchronous replication |
Asynchronous replication |
Non-Aurora: only the primary instance is active; Aurora: all instances are active |
All regions are accessible and can be used for reads |
All read replicas are accessible and can be used for readscaling |
Non-Aurora: automated backups are taken from standby; Aurora: automated backups are taken from shared storage layer |
Automated backups can be taken in each region |
No backups configured by default |
Always span at least two Availability Zones within a single region |
Each region can have a Multi-AZ deployment |
Can be within an Availability Zone, Cross-AZ, or Cross-Region |
Non-Aurora: database engine version upgrades happen on primary; Aurora: all instances are updated together |
Non-Aurora: database engine version upgrade is independent in each region; Aurora: all instances are updated together |
Non-Aurora: database engine version upgrade is independent from source instance; Aurora: all instances are updated together |
Automatic failover to standby (non-Aurora) or read replica (Aurora) when a problem is detected |
Aurora allows promotion of a secondary region to be the master |
Can be manually promoted to a standalone database instance (non-Aurora) or to be the primary instance (Aurora)
|
You can combine read replicas with other Amazon RDS features to enjoy the benefits of each. For example, you can configure a source database as Multi-AZ for high availability and create a read replica (in Single-AZ) for read scalability.
With RDS for MySQL, MariaDB, PostgreSQL, and Oracle, you can also set the read replica as Multi-AZ, allowing you to use the read replica as a DR target. When you promote the read replica to be a standalone database, it will already be Multi-AZ enabled.