As many of them are using RDS, its usage cost will end up like below for Multi-zone Availability with on-demand DB instance

  • USD 0.34 per RDS db.r5.large Single-AZ instance hour running Aurora Postgresql with on-demand DB instance

So 24hrs * 30 days = 720 hrs

For single instance 720 hrs * 0.34 = $244.8

For Multi-AZ : 244.8 * 2 = $489.6

If we run only during certain peak times like ( Mon — FRI 9 AM — 6 PM as per our convenience) and shut down during the rest of the time in sbx/testing environment, the billing amount will reduce.

I have written a python lambda function to start and stop the RDS instance and created cloud watch events to execute the lambda.

PFB GitHub path for the src and CF file.

https://github.com/.../infrastructure/rds-auto-start-stop

We have used the cluster name as a parameter in the CF template, so from Dev to QA to UAT I can change the DB name in the environment variable without having to change the code.

#AWS #RDS #Costing #CloudWatchEvents