Creating a read replica - Amazon Relational Database Service
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Creating a read replica

You can create a read replica from an existing DB instance using the Amazon Web Services Management Console, Amazon CLI, or RDS API. You create a read replica by specifying SourceDBInstanceIdentifier, which is the DB instance identifier of the source DB instance that you want to replicate from.

When you create a read replica, Amazon RDS takes a DB snapshot of your source DB instance and begins replication. The source DB instance experiences a very brief I/O suspension when the DB snapshot operation begins. The I/O suspension typically lasts about one second. You can avoid the I/O suspension if the source DB instance is a Multi-AZ deployment, because in that case the snapshot is taken from the secondary DB instance.

An active, long-running transaction can slow the process of creating the read replica. We recommend that you wait for long-running transactions to complete before creating a read replica. If you create multiple read replicas in parallel from the same source DB instance, Amazon RDS takes only one snapshot at the start of the first create action.

When creating a read replica, there are a few things to consider. First, you must enable automatic backups on the source DB instance by setting the backup retention period to a value other than 0. This requirement also applies to a read replica that is the source DB instance for another read replica. To enable automatic backups on an RDS for MySQL read replica, first create the read replica, then modify the read replica to enable automatic backups.

Note

Within an Amazon Web Services Region, we strongly recommend that you create all read replicas in the same virtual private cloud (VPC) based on Amazon VPC as the source DB instance. If you create a read replica in a different VPC from the source DB instance, classless inter-domain routing (CIDR) ranges can overlap between the replica and the RDS system. CIDR overlap makes the replica unstable, which can negatively impact applications connecting to it. If you receive an error when creating the read replica, choose a different destination DB subnet group. For more information, see Working with a DB instance in a VPC.

There is no direct way to create a read replica in another Amazon Web Services account using the console or Amazon CLI.

To create a read replica from a source DB instance
  1. Sign in to the Amazon Web Services Management Console and open the Amazon RDS console at https://console.amazonaws.cn/rds/.

  2. In the navigation pane, choose Databases.

  3. Choose the DB instance that you want to use as the source for a read replica.

  4. For Actions, choose Create read replica.

  5. For DB instance identifier, enter a name for the read replica.

  6. Choose your instance configuration. We recommend that you use the same or larger DB instance class and storage type as the source DB instance for the read replica.

  7. For Amazon Web Services Region, specify the destination Region for the read replica.

  8. For Storage, specify the allocated storage size and whether you want to use storage autoscaling.

    If your source DB instance isn't on the latest storage configuration, the Upgrade storage file system configuration option is available. You can enable this setting to upgrade the storage file system of the read replica to the preferred configuration. For more information, see Upgrading the storage file system for a DB instance.

  9. For Availability, choose whether to create a standby of your replica in another Availability Zone for failover support for the replica.

    Note

    Creating your read replica as a Multi-AZ DB instance is independent of whether the source database is a Multi-AZ DB instance.

  10. Specify other DB instance settings. For information about each available setting, see Settings for DB instances.

  11. To create an encrypted read replica, expand Additional configuration and specify the following settings:

    1. Choose Enable encryption.

    2. For Amazon KMS key, choose the Amazon KMS key identifier of the KMS key.

    Note

    The source DB instance must be encrypted. To learn more about encrypting the source DB instance, see Encrypting Amazon RDS resources.

  12. Choose Create read replica.

After the read replica is created, you can see it on the Databases page in the RDS console. It shows Replica in the Role column.

To create a read replica from a source DB instance, use the Amazon CLI command create-db-instance-read-replica. This example also sets the allocated storage size, enables storage autoscaling, and upgrades the file system to the preferred configuration.

You can specify other settings. For information about each setting, see Settings for DB instances.

Example

For Linux, macOS, or Unix:

aws rds create-db-instance-read-replica \ --db-instance-identifier myreadreplica \ --source-db-instance-identifier mydbinstance \ --allocated-storage 100 \ --max-allocated-storage 1000 \ --upgrade-storage-config

For Windows:

aws rds create-db-instance-read-replica ^ --db-instance-identifier myreadreplica ^ --source-db-instance-identifier mydbinstance ^ --allocated-storage 100 ^ --max-allocated-storage 1000 ^ --upgrade-storage-config

To create a read replica from a source MySQL, MariaDB, Oracle, PostgreSQL, or SQL Server DB instance, call the Amazon RDS API CreateDBInstanceReadReplica operation with the following required parameters:

  • DBInstanceIdentifier

  • SourceDBInstanceIdentifier