Amazon RDS Read Replicas
Amazon RDS Read Replicas provide enhanced performance and durability for Amazon 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, Amazon RDS for MariaDB, Amazon RDS for PostgreSQL, Amazon RDS for Oracle, and Amazon RDS for 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 of Amazon RDS Read Replicas
Setup
Using the AWS 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 AWS Management Console. Amazon RDS for MySQL, Amazon RDS for PostgreSQL, Amazon RDS for MariaDB, and Amazon RDS for SQL Server allow you to add up to 15 read replicas to each DB Instance. Amazon RDS for Oracle allow you to add up to 5 read replicas to each DB Instance.
Amazon RDS for MySQL, Amazon RDS for PostgreSQL, Amazon RDS for MariaDB, and Amazon RDS for 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 primary 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, Amazon RDS for MariaDB, Amazon RDS for PostgreSQL, Amazon RDS for Oracle, and Amazon RDS for 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: synchronous 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 read scaling |
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 primary |
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. Or you can use Aurora Global Database to replicate data from your Multi-AZ Aurora deployment into additional regions.
With RDS for MySQL, RDS for MariaDB, RDS for PostgreSQL, and RDS for 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.