I have been using Amazon RDS MySQL for several years in many projects. One of the best points of using AWS RDS instead of running your instance on EC2 is maintenance and easy management. RDS Multi-AZ is a very good feature in RDS, when you run an instance in with Multi-AZ option, RDS automatically creates another instance in another Availability Zone and automatically replicates between them.
If the main instance encounters any problems or errors, you and your customer will not feel any service disruption as traffic will automatically be redirected to another instance until the master instance is recovered successfully.
Also, Multi-AZ features are very useful when you want to upgrade your instance type (hardware resource).
In this article, I want to talk about increasing your capacity when your business grows.
You have two options in RDS:
Increase your instance type ( CPU, RAM, etc. ..)
Add Multi instances and divide traffic between instances.
In RDS service, you can easily create read replicate instance from the master instance with just a few clicks.
But after you create read replicate instances, what you need to do is divide traffic between them.
Available solution is to use a proxy such as HAProxy, which is very popular.
But there is also a simpler solution;
Check that the instance has been created and is working.
After a few minutes, your read replica becomes available for read (read only), and you can use it. To check that everything is ok we connect to the instance with user and password to the endpoint of the new instance.if you can connect to the new instance and everything is ok, we go forward to the next step.
Final Check now checks that the DNS service is working properly. Use the ping command to ping db.mydomain.com. Each time you ping you must receive random instance IP address of your different instances.
Step 11: the Last Step, As the last step for write and update, use main instance Endpoint’s URL and all the other for reading Use db.mydomain.com instead of the endpoint address of each instance.
If some of your instances have more powerful hardware (CPU, RAM), you can set more weight for higher powered instance. For example, if you have one master with a very high throughput and two read replica which have very low resource levels. You can set weight for the master to 50 and set 25 for each read replica. Based on this setting, out of every 10 read requests 5 are sent to the master and 2 or 3 are sent to each of the replica instances.