Search code examples
amazon-web-servicesamazon-rdsdatabase-replication

Does AWS load-balance connections between master and read-replica DB


I created a read-replica for an RDS instance, Does AWS handles the load-balancing automatically or it needs another configuration or implementation in the code ? and if so Is there a reference for that ?

Edit for more clarification When I create a read-replica how it's going to work and handle requests ? I'm asking because it gives me an endpoint, so there must be a sort of implementation for it work properly right? (alongside the master RDS)


Solution

  • Amazon provides connection load balancing for RDS Aurora database clusters, via a specific load-balanced endpoint. For any other RDS database configuration you will have to handle the connections yourself.

    Edit for more clarification When I create a read-replica how it's going to work and handle requests ? I'm asking because it gives me an endpoint, so there must be a sort of implementation for it work properly right? (alongside the master RDS)

    At that point you just have 2 database servers, and each server has a separate endpoint URL that you can connect to. Amazon is keeping the data between those servers in sync for you, that's all. There is no load balancing happening here. You seem to be making an assumption that there is more going on here than there actually is. If you are using an RDS database engine other than Aurora, you will have to implement the load balancing yourself.