DEV Community

Rajit Paul
Rajit Paul

Posted on

Modify RDS Instance Type using Lambda during peak hours with Cloudwatch Events

Hi Folks, hope you are doing good.
Use-case: To modify RDS Instance Type to facilitate load during peak hours using Lambda and Cloudwatch Events

Create a Lambda Function:

  • Author from scratch
  • Function Name - your desired name
  • Runtime - Python 3.9
  • Architecture - x86_64
  • Permissions - Create a new role with basic Lambda Function

Code - (

Additional IAM Policy for RDS Modify Access:
Policy Json - (

  • Add this as an inline policy to the Lambda Default Role

Amazon EventBridge (Cloudwatch Events):
Create a new rule
Rule Name - Desired Rule Name
Pattern - Schedule - Cron Expression (Cronex - 55 7 ? 2 7 * (Every Saturday at 7:55 GMT) - Choose your cron expression according to your requirement
Cron Expression Help - (
Select Targets - Target - Lambda Function - Select your function.
Create Cloudwatch Event

We have automated the RDS Instance Type modification, the Cloudwatch Event shall trigger the Lambda Function at the desired time and modify the RDS Instance to an upgraded Instance type, you can also use this for downgrade db instance.

Top comments (0)