Cost Optimization: AWS Oracle RDS Scheduled Shut/Start

Hi Everyone!!

Today in this article, I will write a cost reduction technique on AWS when running Oracle RDS.  It is common to see full sized non production databases environments sitting idle 24/7 in on premises, needing operational resources with day to day maintenances. With RDS, new database provisioning is done in minutes than days. With Lot of agility that RDS brings into the mix, pay as you go on cloud computing resources makes lot of sense, and shut the resources down when not required. Technique used in this article can be used for any RDS or even with DBs running on EC2s.This will reduce the cost of using the service by 70%. Wow...!! yes, running service 50 hours vs 168 hours. 

One of the technique to cut cost is to shut down a DEV/Proof Of Concepts databases outside of business hours. No DBA Operational hours needed for this solution. That's lot of savings.  yes, can't be implemented for all databases.  And Application services can be stopped before DB goes down and can be started after DB comes back online to save even further on running app infrastructure resources. Remember RDS can't be down for more than 7 days, it will be coming up automatically. If you are doing this on EC2, then enable auto restart setup Oracle must be made inside EC2. Understood, critical project databases cant be stopped that needs to serve developers/testers having tech/functional teams working across multiple geographical locations.

Some limitations on this.

  1. You can't stop a DB instance that has a read replica, or that is a read replica.
  2. You can't stop an Amazon RDS for SQL Server DB instance in a Multi-AZ configuration.
Not a big deal right?  why would some one have muti AZ on dev or POC environment. And same true for RDS with read replica, unless you are doing POC on RDS read replica ;-)

Remember - we are saving here compute costs of RDS, still allocated storage cost will be incurred whether you shutdown the instance or not on schedules.

There are several solutions available. 

1. AWS Lambda and Amazon EventBridge 

2. AWS Systems Manager

3. Instance Scheduler on AWS



My Personal choice would be to go with AWS Systems Manager. If you are on the region that doesn't support Systems manager yet, you can go for the other two. Play around and setup the architecture that suits the grand scheme of things that's happening in your organization. 

DO NOT hesitate to embrace the new model of dropping and recreating the lower environments when there is a period of non-utilization. That saves lot of money for the organization. Techniques like snap and recreate or drop and clone from prod can be utilized. Or new build can be done using cloud formation templates or terraform IaaC. With Agility cloud brings no need of spending hours to setup the new environments. In a matter of mins, new RDS can be provisioned. 

Another technique would be to keep subset of data in non prod environments from prod than having full set of data for development work. Some cases, it can't be done like Oracle E-Business Suite apps where schema's are tied together. 

Want to hear better than these solutions?? Do you want to see a feature like a Car saves gas by stopping when you are in Red Signal and starts when Green Signal comes? Like when there are no DB sessions, DB pauses and wakes up when someone needs it?? Go for Amazon Aurora Serverless option!!. Yes it does what you are looking for.. 

Further Reading References:


https://aws.amazon.com/blogs/database/schedule-amazon-rds-stop-and-start-using-aws-lambda/

https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/automatically-stop-and-start-an-amazon-rds-db-instance-using-aws-systems-manager-maintenance-windows.html

https://aws.amazon.com/blogs/database/schedule-amazon-rds-stop-and-start-using-aws-systems-manager/

https://aws.amazon.com/solutions/implementations/instance-scheduler/

Schedule auto restart using git repo 

https://github.com/barryw/terraform-aws-rds-scheduler/tree/master


No comments: