Amazon RDS, as a managed service, takes care of the scaling of the database so that the database can fulfill the increasing demands of your applications. RDS Autoscaling can bring you much more benefits. So, in this post, I’ll be sharing my experience of setting up AutoScaling for RDS instance. The experience is very smooth and it worked like a breeze. I would like to share my experience here, so you could also get the benefits of the RDS Auto Scaling.
Let me share a little more about the case. Our RDS instance usage spiked once in a while which forced us to keep our RDS 2x size than what is required for my client’s business. Then I decided to implement autoscaling in RDS, and you won’t believe what was the result.
It saved more than 50% of the cost of my client!
Understanding RDS Auto Scaling
Auto Scaling enables us to automatically scale up the capacity accordingly to the growing workload of the database with zero downtime. Before setting up RDS auto-scaling, we will build the RDS server with capacity and memory which is based on the application demands which we anticipate. If the workload is beyond our anticipation then we have to manually upgrade the capacity and memory of the RDS server which results in the application downtime.
The major drawback in the manual intervention is that over usage of the database resources results in server downtime and underutilization results in the higher usage cost. With RDS autoscaling feature we can set a minimum and maximum limit so that Autoscaling will take care of the rest.
AWS has recently published a very informative post about Amazon RDS now supports Storage Autoscaling.
AWS Auto Scaling continuously monitors our RDS server and scales up or scales down the server automatically accordingly to the workload. Auto Scaling works with the old and new database servers which can be enabled for the existing servers with zero additional charges. The usage charge of the RDS server is reduced due to this because Auto Scaling gives us the advantage of paying for the resources which we use.
Steps to Setup RDS Auto Scaling in AWS
Now, when we’ve built an RDS server, let’s move to the steps that you need to follow to set up RDS Auto Scaling in AWS.
Step 1: Logging in
Log in to the AWS console by clicking the URL and provide the valid credentials.
Navigate to RDS by AWS services→ Database→ RDS
Step 3: Creating a Database
Create a database by clicking on the Create Database icon in the RDS Dashboard
Note: To enable Auto Scaling for the existing RDS we need to navigate to the RDS dashboard→ Snapshots→ Select the RDS snapshot which we have to launch→ Actions→ Restore Snapshot and after doing this skip to Step 6.
Step 4: Choosing an RDS Engine
Choose an RDS engine from the following. Here, I’m choosing Amazon Aurora.
Step 5: Choosing the MYSQL Version
After choosing the Engine, choose the version for MYSQL. Here I’m choosing MYSQL V 5.6
Step 6: MYSQL Configuration
In the database configuration, choose Serverless
Step 7: Database Settings
Provide the required details such as DB Cluster Identifier, Master Username, and Master password and also confirm the same master password and then click on the Next.
Step 8: Configuration of Database Advanced Settings
Provide the value for Minimum Aurora Capacity Unit and Maximum Capacity Unit. The minimum and maximum capacity should be mentioned in units and 1 unit represents 2 GB.
Step 9: Database Additional Configuration Settings
In the additional configuration, setting provide the Backup Retention Period for 7 days
Step 10: Configuring Database Network Security Group
In the Network and Security group choose the desired VPC (either Default or Custom) and also choose the same VPC for the Security group. Before launching the serverless database ensure to enable the Enable Deletion Protection for protecting the server from accidental termination and then click the Create Database icon.
Step 11: Launching the Database
After launching the database we can find the database in the RDS dashboard
Step 12: Condition for Auto Scaling
AWS has fixed a constant value for Autoscaling up and down which is as given below
Condition for Scale-Up: It will scale-up the server if the CPU usage is greater than 70% and the connections are greater than 90% for continuously 3 minutes
- CPU > 70%
- Connections > 90%
Condition for Scale Down: It will scale-down the server if the CPU usage is less than 30% and the connections are less than 40% for continuously 15 minutes
- CPU < 30%
- Connections < 40%
Step 13: Limitations of Serverless Database
There are few limitations in setting up the Serverless RDS database such as
- There is only Cluster Parameter group and there is no DB parameter Group
- We have to only use the default port 3306 and we won’t be able to change the port number
- We cannot restart the DB
- It will work only inside the VPC network, not in other networks such as VPN and VPC peering networks
- We can only modify the following Cluster parameters such as character_set_server, collation_server, lc_time_names, lower_case_table_names, time_zone, the other parameters are the default
- The Binlogs are disabled
Step 14: Available Event Notifications in Serverless RDS
Right now Amazon serverless supports only 3 notification events such as Failover, Failure, and Notification
Step 15: Logs and Events
The number of times the event scale up and scale down is available in RDS Dashboard→ DB Instance→ Select the RDS→ Logs and Events
So, we have set up the Autoscaling using RDS serverless. You can scale your RDS configuration up or down to meet the increasing demands of your applications. RDS manages the heavy lifting in scaling your database and allows you to focus more on your applications.
So, it’s all about my experience of implementing RDS Auto Scaling in AWS. If you are looking for any help or consulting services related to Amazon RDS, you can contact us. We would be happy to help you to accomplish the desired task.
Thank you for reading! If you have any questions regarding RDS Auto Scaling, write them in the comment section below. In case you have already set up RDS Auto Scaling in AWS, please share your experience with us in the comment section.