Mysql – Why is there a writable instance inside a secondary region for MySQL AWS Aurora Replica

amazon-rdsaws-auroramysql-5.7

I have created two Aurora MySQL clusters with two nodes in two regions using terraform. The secondary region is set up to replicate from primary region using binlog. This seems to be set up correctly, describe-db-clusters shows replication info and Replication source is displayed on the secondary cluster in the Console.

What confuses me is that in the secondary region, there is a write node. I can connect to it, add data to table and it gets propagated back to primary region—and vice versa. I am specifically not using multimaster cluster (which is single-region only anyway) and I am not using global database as I want to scale to more regions. Based on AWS docs, only global database supports write forwarding.

I only tried with manually connecting to the instances using mysql CLI as I want to understand the characteristics before using this with an application.

How is this possible? Is there any documentation? How does this setup handle update conflicts?

Best Answer

When you create Amazon RDS instance it creates default instance with 2 endpoints, a writer and a reader endpoint with MultiAZ. The reader endpoint is always a readonly, and it switches during failover. Its provided by AWS to achieve the high avialablity.