Hello community!

Today I would like to tell and show the creation of a
copy of the RDS instance read-only. For many, it is no secret that when working with
high-loaded projects , solutions are created when information is written only in one place, and you can read it from many sources.
AWS RDS MySQL offers this solution, so to speak, out of the box. In the console or through the CLI (API) you are invited to create a replica. What happens under the hood?
- An image of an existing server is created. This operation can affect I / O, as you can imagine. Do not make an image in a loaded clock.
- From the image, a new instance starts, which is configured and becomes a replica in read-only mode - RO.
Allowed to create
up to 5 replicas from one server. Replicas, as well as the main instance, can be created using
MultiAZ deployments to increase resiliency. In this case, if the replica fails, the RDS Endpoint automatically switches to an instance clone in another zone.
')
It turns out that we can store
up to 12 copies of data
within one region , but use 1 server for read / write operations and up to 5 read-only. Why I noted that data can be stored within the region? Because replicas can not be created in other regions.
Replicas can be of
different types with the main server. It is worth noting that the
stack for the database is to keep the same size , so that there are no problems with disk overflow. If you have increased the disk on the main, it is worth doing the same steps on the replicas.
So how can we create a cue from the
CLI ? Everything is very simple:
$ aws rds create-db-instance-read-replica --availability-zone us-east-1d --source-db-instance-identifier main --db-instance-identifier second
Here we create a new replica in the
US-EAST-1D zone from the
main server. The replica name will be
second .
Everything looks simple on the
web console too:

Click Create Read Replica and see:

Later we will have 3 servers in different availability areas:

Additional materials about Read Replica:
aws.amazon.com/rdsdocs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ReadRepl.htmlwww.mysqlperformanceblog.com/2012/12/20/how-to-stop-slave-on-amazon-rds-read-replica