Skip to content

How Can I Automate RDS Compute Scaling Using CloudWatch Alarms, SNS, and Lambda?

0

I am currently using an Amazon RDS instance with the instance type db.m5.large and manually scaling the compute capacity up and down as needed. I would like to automate this process using CloudWatch alarms, SNS, and Lambda so that my database scales based on CPU utilization or memory usage.

I understand that Amazon RDS does not support compute auto-scaling natively, but I would like to implement a solution where:

CloudWatch monitors CPU or memory usage and triggers an alarm when it exceeds or falls below a threshold. SNS notifies a Lambda function when the alarm is triggered. Lambda modifies the RDS instance class to scale up or down based on predefined rules. Can AWS provide guidance or best practices on implementing this? Are there any limitations or considerations I should be aware of?

1 Answer
0
Accepted Answer

Hello.

If you are using RDS MySQL etc., I thought it would be better to migrate to Aurora Serverless and use a mechanism that automatically scales up ACU etc.
Aurora Serverless can automatically scale up or scale down within a set range depending on the load.
It's probably possible to automatically scale up using Lambda, but it's not recommended as it's too complex to manage in code.
https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless-v2.setting-capacity.html

When using Lambda, steps such as stopping RDS, changing the instance size after stopping, and starting after changing are required, but if any one of these APIs fails, processing will stop at that point.
Automating scale-up with Lambda is not recommended because there are many considerations, as you also need to consider recovery in case of processing failure (notification in case of error, etc.).

EXPERT
answered a year ago
EXPERT
reviewed a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.