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


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

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

Start by collecting the DNS endpoint URLs for the read replicas from the RDS console. Choose Instances from the navigation pane, select each read replica, and make note of the DNS endpoint URL, next to Endpoint.

Next, 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, enter a name and comment that are meaningful to you.
    If you do not want the read replicas to be accessible from any external resources, for Type, choose Private Hosted Zone and the VPC in which your read replicas are located. Otherwise, leave Type as Public.
    Note: You must own the domain you specify in the Hosted Zone if you specify Public.
  3. Choose Create.

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

  • For Name, choose any name that’s meaningful to you. 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, enter any numerical value that you like, so long as it is the same value used for each replica’s record set.
  • For Set ID, enter something meaningful to you.
  • For Health Check, it’s optional to configure one (though it’s a best practice). For more information about health checks, 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 will help make sure that requests are distributed roughly equally.

If you need to scale up, you can add more read replicas in response to more connections or high resource utilization without changing your application endpoint. You might also consider incorporating Route 53 health checks to ensure 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