How can I distribute read requests across multiple Amazon RDS read replicas?

Last updated: 2019-07-19

How can I distribute read requests across multiple Amazon Relational Database Service (Amazon RDS) read replicas?

Short Description

You can use Amazon Route 53 weighted record sets to distribute requests across your read replicas. Within a Route 53 hosted zone, create individual record sets for each DNS endpoint associated with your read replicas and give them the same weight. Then, direct requests to the endpoint of the record set.


Find the DNS endpoint URLs for the read replicas

  1. Open the Amazon RDS console.
  2. Choose Databases from the navigation pane, and then select each read replica.
  3. Note (or copy) the DNS endpoint URL, next to Endpoint.

Create a Route 53 hosted zone

Note: If you already have a hosted zone, you can skip this step

  1. Open the Route 53 console, and choose Hosted zones from the navigation pane.
  2. Choose Create Hosted Zone.
  3. For Domain Name and Comment, type a name and a comment. To block access to the read replicas from external resources, for Type, choose Private Hosted Zone for the VPC in which your read replicas are located. Otherwise, leave Type set as Public.
    Note: You must own the domain you specify in the Hosted Zone if you specify Public.
  4. Choose Create.

Create the record set

After the hosted zone is created, select it, choose Create Record Set, and use the following attributes:

  • For Name, enter a name. You use this as the endpoint URL to access the read replicas.
  • Set Type to CNAME.
  • For TTL value, set a value that is appropriate for your needs. This determines how often each read replica receives requests.
  • In the Value field, paste the DNS endpoint of the first read replica.
  • For Routing Policy, choose Weighted.
  • In the Weight field, enter a value, as long as you use the same value for each replica's record set.
  • For Set ID, enter a name.
  • It's optional to configure Health Check, but it's best practice. For more information, see Creating Amazon Route 53 Health Checks and Configuring DNS Failover.

After configuring the record set, choose Create.

Repeat these steps to create a record set for each additional read replica. Be sure that the record sets use the same name, the same value for time to live (TTL), and the same value for weight. This helps to distribute requests equally.

You can add more read replicas to respond to more connections or high resource use without changing your application endpoint. You can incorporate Route 53 health checks to be sure that Route 53 directs traffic away from unavailable read replicas.

Did this article help you?

Anything we could improve?

Need more help?