Welcome to fellow AWS Cloud aspirants for a basic AWS Cost optimization post with brief points & an architecture diagram for the same.
Intention is to highlight scope & potential of applying cost optimization in non production workloads as well. This example, is considering a web application tier in Public Subnet, business logic tier & RDS backed database in individual private subnets
Above is a basic representation of a simple web application with business & database tier implementation. Below is the order to save costs
- Resources EC2, RDS should be created with Key,Value tags for this design to work. To enforce this, the user or source which creates these resources should be attached with IAM policy aws:RequestTag condition(s)
- Assume that these resources are now created with resource tag(Key:Value)
- Create a Amazon Event bridge rule with cron scheduler time defined as according to your nature of business purpose
- Prepare a python boto or any other script to start & stop these instances & RDS instances according to cron scheduler and key value tags defined with the respective resources
- Watch the cost being saved from the moment this setup is up & running
While the steps & logic looks simpler, this is extremely basic aspect of implementing cost savings. Wondering how? Well, Non production workloads are not expected to run always and hence those can be always stopped and started on weekdays when team or developers actually need
For example, let us say, I am running 1 c5a large instance, as per above architecture
Ec2 Run Time: 24*30(let us assume 30 days a month running for 24 hours) = 720 hours of EC2/RDS uptime
Team/Developer work time: 4 weeks(a Month timeline) * 40(5 days, 8 hours a week) = 160 Hours
Idle time = 720–160 = 560 Hours
What if I told, that you can save up on 560 idle hours? let see with real estimate now
AWS online pricing calculator, takes 730 hours for a month and estimates 112.42/month cost for c5a.xlarge instance usage. So if we stop & stop for 730–160 hours, 570 hours of savings is almost 78% will be $87.7 in savings per month and stand to pay $24.72. Isnt this huge? After all, money saved is money earned
To add up, please see the estimate of Amazon RDS(MySQL) cost for a month, without opting for Proxy usage, Single Zone, Opted out RDS Insights
Idea is to emphasize the importance of potential of implementing this cost saving during the design phase of architecting cloud solutions. In a improvised design, we can opt for reserved/savings plan instances and we will see about those enhancements & various other scenarios, in the upcoming posts
Happy learning !!
Hey talented devs! If you’ve ever published on Dev.to, you may be eligible for your special Dev.to drop. Don’t miss this opportunity HERE. wallet connection required. – Admin