Home > front end >  Which Endpoint should be used as hostname when connecting with Aurora DB
Which Endpoint should be used as hostname when connecting with Aurora DB

Time:01-24

I'm currently trying to connect to Aurora DB. I know that I should use the endpoint as the hostname but the problem is Aurora has 4 endpoints.

Cluster Endpoints: Reader and Writer Instance Endpoints: Reader and Writer

Which should I use?

CodePudding user response:

The cluster's writer endpoint connects to the primary instance and can be used for both write and read operations. For the reader endpoint, if the cluster has no replicas, then it also points to the primary instance and thus, is equivalent to the writer endpoint. If there are replicas, then it will load balance read operations across the replicas. Therefore, if you're doing a high volume of reads, it's best to use the reader endpoint to reduce load on the primary instance and keep it free for writes.

Instance endpoints connect to individual instances (either the primary or a replica). You should use it if you want full control over how reads are distributed across the replicas. For writes, since both the writer endpoint and the primary instance endpoint connect to the primary instance, there is no functional difference between the two.

To be clear, an instance does not have both a read and write endpoint. There is only one endpoint, and it acts as a read endpoint if the instance itself is a reader. In other words, the instance endpoint of a replica is a read endpoint, and the endpoint of the primary instance is a write endpoint. The exception to this is Multi-Master Aurora, where all instances are writers.

More info here: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.Overview.Endpoints.html

  • Related