Last updated on May 26, 2023
Every AWS service offering comes with a pay-as-go pricing model, empowering businesses, small or large, to be flexible at experimenting and making changes as they build their products to market. This pricing model is similar to riding an Uber, where you only pay for the distance covered, or to electric bills where you’re charged based on actual energy consumption. Of course, the more devices you have running, the higher your monthly bill will be. Cloud computing, like any other utility, should be treated the same way.Â
Just as we are told to unplug appliances when not in use, removing/stopping unused resources is a common strategy for reducing expenditures in AWS. While this may not apply to critical resources that must be online 24/7, shutting down non-production resources and restarting them only during work hours is a straightforward yet effective way of avoiding unnecessary charges.
In this article, we’ll look at implementing an automated solution for stopping/starting non-production RDS instances on schedule using the combination of Amazon EventBridge and AWS Lambda. Stopping RDS instances can be done manually through the RDS management console. With that said, you could assign someone in your team to turn off all RDS instances you have in your test environment before clocking out and have them restart once access is needed the following day. This process might be tolerable for a handful of databases; however, with several test databases to manage, clicking each of them through the console can get tedious and become a time-consuming task. It won’t also help if you’re someone like me who tends to forget things once in a while, hence, automation is the way to go.
Before we get into the implementation details, let’s have a quick overview of the general billing concept in Amazon RDS. RDS instances are billed for DB instance hours, provisioned storage, backup storage, I/O requests, provisioned IOPS, and data transfer. Out of these 6, provisioned storage and DB instance hours (compute time) account for most of RDS costs.
Note that we can only control the number of instance hours accrued over time. You’d have to pay for storage regardless of whether your DB instance is stopped or running. The only way to truly eliminate storage costs is to terminate your database instances.
Below is the overview of the solution that we’ll be building. In this post, we’ll assume that all test RDS instances are located in the N. Virginia region. Having a common region for test resources makes management much easier. In addition, we consider the standard working hours (9AM-5PM) during which the instances must remain active.
The solution comprises 5 components, which are briefly described as follows:
AWS, Azure, and GCP Certifications are consistently among the top-paying IT certifications in the world, considering that most companies have now shifted to the cloud. Earn over $150,000 per year with an AWS, Azure, or GCP certification!
Follow us on LinkedIn, YouTube, Facebook, or join our Slack study group. More importantly, answer as many practice exams as you can to help increase your chances of passing your certification exams on your first try!
View Our AWS, Azure, and GCP Exam Reviewers Check out our FREE courses



























