Joe shows you how to
distribute read requests
across multiple RDS read replicas

requests-rds-read-replicas-Joe

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

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 Instances 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 Hosted Zones pane of the Route 53 console.
  2. Choose Create Hosted Zone. For 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.
  3. 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, type a name. You will use this as the endpoint URL to access the read replicas.
  • Set Type to CNAME.
  • For TTL value, you can set this to any value that is appropriate for your needs. This effectively 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, type a value, as long as you use the same value for each replica’s record set.
  • For Set ID, type a name.
  • For Health Check, it’s optional to configure one (though it’s best practice). For more information, see Amazon Route 53 Health Checks and DNS Failover.

After configuring the record set, choose Create.

Repeat these steps to create a record set for each additional read replica. Make sure that they all 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 page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2016-12-23

Updated: 2018-04-10