In this article, I will share how I reduced 40 % of the Azure cost.
Cloud computing has revolutionized business operations. From small startups to large enterprises, most on-premises systems have transitioned to the cloud. A few years ago, cloud migration projects were the key focus for organizations. However, with global slowdowns and economic challenges, businesses now emphasize reducing cloud infrastructure costs. The same situation happened to me when I had a weekly business discussion with my USA stakeholders. They brought many points on cloud cost.
The summary of the discussion was
- The cloud cost is higher, and it keeps on increasing.
- Is there any way to reduce it
- Can Engineering focus on cost and redesign in a better way?
My first answer was yes, and of course, not the timeline for when it will be done. I said we would come up with an action plan after a discussion with my team in the next 2 weeks.
Now, we started looking at how to optimize cost in Azure.
Understanding the Azure Cost
Understanding the Azure cost is very important as we need to know how much cost we pay to Azure.
Go to Azure Cost Management + Billing tool in the Azure portal. You can see the cost below. This cost can be viewed on each resource level, and historical billing also can be viewed in the Billing tool.
Steps to reduce Azure cost
Monitor and Remove Unused Azure Resources
- Monitor the unused resources; while your team migrates to Azure, they will do a lot of experiments & leave the resource group unused. Later, it comes as a cost in Azure.
- To avoid these, make alerts to notify the team when Azure costs reach a certain limit.
- Use Azure-native tools like Azure Advisor to analyze costs.
- I established a process to monitor the cost by automating the alerts, Every monday we see a cost report in email.
- I Wrote scripts to periodically identify and delete unused resources, such as unattached disks or redundant snapshots.
Right-Sizing Azure Resources
- Choosing right size of VM, Right capability of azure resources are very important as each have different cost.
- I used the Azure pricing calculator to know which capability I needed to use for my requirements.
- I reviewed my cost and Azure resource capability with Azure Cloud Architect, and he helped me adjust some of the resource sizing.
Enable Auto Scaling
- I enabled auto-scaling, which means the resource size will automatically upgrade to the next capability/size when there are more requests for Azure resources.
- I conducted game day with my team in production to check if Auto scaling is working or not.
Leverage Discounts
- Azure gives a large discount if you commit to using Azure resources for a longer time.
- Commit to 1-year or 3-year plans to save up to 72% on capacity costs.
- Monitor utilization percentages in the Reservations section of the Azure portal.
- I discussed with our procurement team to help me get the approval from the CTO to use Azure for 3 years; we got around 50 % discounts on VM and cosmos db.
Optimize Databases
- Our team uses an SQL Server database, which holds large volumes of data, but not all data require the same level of accessibility.
- Azure costs more when you fetch data, but storing data does not cost that much.
- I separated transactional versus historical data into different tables.
- I moved less frequently accessed data to Azure Blob Storage’s Cool or Archive tiers.
- I Implemented Lifecycle Management Policies to automate data transitions between storage tiers.
Optimize Storage Costs
Azure offers multiple storage tiers tailored to different usage patterns
- I discussed with our business stakeholders which data is accessed at which interval. Then, I understood the Data life cycle and decided to map the data storage tiers.
- I created a new resource group and mapped the Hot, Cool, and Archive tiers based on access frequency.
- I deleted unattached disks and redundant snapshots regularly.
- I followed the same strategy with Azure Blob Storage Lifecycle Policies.
Adopt Serverless Architecture
Serverless architectures like Azure Functions and Logic Apps execute only when triggered, reducing compute costs.
- I Used Azure Functions for event-driven processes like order handling.
- I used Azure Logic Apps for workflows and order approval processes in my system.
- I monitored serverless components using Azure Application Insights to understand how they were performing and any steps to optimize further.
Improve Networking Efficiency
- I Optimized the costs at the network layer by reducing unnecessary cross-region traffic.
- I redesigned the services within the same Azure region when possible.
Be Adaptive, Collaborative, and Experimental
- Cost optimization is an ongoing process that requires collaboration across DevOps, finance, and engineering teams.
- I followed the iterative approach to review costs and work on the optimization steps.
- I asked my team to plan and execute optimization tasks in each sprint. In each sprint, work items were split on which component needed to be reviewed.
- On every sprint, this was the priority work, the best Engineer in my team had to work with group of Architects.
- I asked one Engineer in my team to monitor the changes and observe their impact on costs.
- Share learnings and refine best practices over time.
Finally the Result speaks
I regularly shared the progress of the work every week with our stakeholders, and finally, I went to the stakeholders after 2 months (I waited for the cost comparisons for 3 months ) and showed the monthly Azure resources and highlighted with a beautiful graph how Engineering has helped the business and now how the team has reduced almost half of the costs. This was highly appreciated by business.
What do you think about Azure cost optimization? Please share in the comment if you have followed any approach /step to reduce the cost. I am happy to learn from you.
Happy Learning!