Monday, 12 May 2025

Reduce Wastages for Non Prod Environment

Hi and welcome back to my blog

It's roughly two years since I last blogged, and during that period, I've been busy with family and personal matters. But today I got some time to spare and share

As cloud engineers, platform engineers, or simply "cloud magicians" such as myself, we've seen the shift: more workloads in the cloud means more to manage. And yes, with that comes more cloud consumption.

Increased workload equals increased consumption and it does to some extent. With a new mindset, however, comes FinOps.

What is FinOps?

FinOps is an operational framework and cultural practice which maximizes the business value of cloud and technology, enables timely data-driven decision making, and creates financial accountability through collaboration between engineering, finance, and business teams.  (https://www.finops.org/introduction/what-is-finops/)


As we are able to appreciate the cloud's scalability and elasticity, we should also be cautious with costs. Non-prod environments are ideal for this kind of optimization for the following reasons:

1 . Multiple Environments of “Non Prod”

Most companies have multiple non-prod environment (SIT, UAT, PreProd)

2. Internal Use Only

These kinds of systems are typically internal-facing, and therefore scheduled downtime after work hours does not impact end-users.

3. Freedom to Experiment

You can try out optimization methods without committing your App teams or affecting production workloads.


The Goal: 🠟 Wastage 🠟 Cost 

1. Run Only During Working Hours

Instead of running services 24/7 (730 hours/month), I reduced this to roughly 180 hours/month (Mon to Fri, 9 AM to 6 PM).

 2. Automate Start/Stop

     2.1 automated the start and shutdown of the environment through scheduled pipelines

     2.2 no manual intervention needed with cron job like 0 9 * * 1-5 or you can set the time if your         automation tools support that. 

 3. Transparency across the teams

Since the automation is pipeline-based, there is full transparency. The teams can look back in history to confirm what was triggered, when, and by whom (or what) this goes to App Team , FinOps Team and Cloud team in some cases.

Sample calculation 

 

With breaking a bit of sweat because of try and error for this pipeline and try to get the right parameter and command , cost can be reduce up to 75 % . 

so if you are running service like  Application Gateway and Azure Database for MySQL , you may try this Azure Command 

1 . https://learn.microsoft.com/en-us/cli/azure/network/application-gateway?view=azure-cli-latest#az-network-application-gateway-start

2. https://learn.microsoft.com/en-us/azure/mysql/flexible-server/how-to-restart-stop-start-server-cli#start-a-stopped-server

Or Make an API CALL

1. https://learn.microsoft.com/en-us/rest/api/application-gateway/application-gateways/start?view=rest-application-gateway-2024-05-01&tabs=HTTP

2. https://learn.microsoft.com/en-us/rest/api/mysql/flexibleserver/servers/start?view=rest-mysql-flexibleserver-2024-06-01-preview&tabs=HTTP

Apart of this , if your organization strive for ESG on Cloud, this might help also , i have not deep dive into that but let see 😁