Azure Cost Optimization Tips

Cloud is cost efficient. You pay for what you use. Yet for many organizations, pay more than what they actually use. The “If it ain’t broke, why fix it?” mentality is the rationality why cost optimization is often overlooked so long as operations are running smooth and if not addressed will eventually lead to bloated monthly billings. You should consider these Azure cost optimization tips to reduce unnecessary cloud consumption and improve your return on investment.

Preliminary

Root cause analysis is the means to get to the underlying cause of the problem. You should first know how your Azure monthly billing is segregated into. Azure Cost Management provides a thorough breakdown on the type of azure resource and the granularity to pin point the exact resource that is contributing to your monthly billing. By identifying the top N resources, you can then effectively prioritize which resources to optimize.

Azure Cost Management : Cost Analysis

Right-sizing

It is a common migration approach that if my application is running fine on-premise on a server with an X amount of vCPU and RAM, then I should deploy the same on the cloud. Well, the cost difference of having a VM with 8 GB RAM vs 16 GB RAM can cause your running costs to double in some instances. Right-sizing Azure VMs is an extremely important activity in the effort of migrating or setting up your infrastructure on Azure that is often ignored post-deployment stage. That is where Azure Monitor comes into play.

Monitor Metrics : Percentage CPU (Max) for the past 30 days

The two metrics to analyse from Azure Monitor Metrics are the Percentage Memory (RAM) and the Percentage CPU used. The combination of both provides insight as to whether a VM is underutilized, overutilized or rightly sized when it comes to its provisioned specs. It is important that the aggregation be set to ‘Maximum’ and not ‘Average’ as we want to consider the peak achieved when deciding whether to resize the VMs. Typically, if max utilization of both are well under 50% in a set timeframe, it is safe to downsize to one SKU lower without suffering from performance issues.

Orphaned Disks

Orphaned Disks are Managed Disks that are basically unattached to any resources like virtual machines, which means that they are sitting in the Azure Subscription, incurring storage costs. There are several reasons of which an orphan disk might reside in one’s Azure Subscription. For example, any deleted virtual machine in Azure Portal, by default, will retain its Data and OS disks to prevent data loss due to unintentional deletion of VMs – unless you change your default termination policy.

Azure Disks : Unattached Managed Disks

It must be removed separately, otherwise monthly payment for the unattached disks will continue. Deletions however are permanent, and unrecoverable once a disk is deleted. Another reason an orphan disk might reside in one’s Azure Subscription is that it functions as a backup managed disk for a VM. Hence, regular audits of the storage disks are an important housekeeping task to save on unnecessary cloud storage costs.

Automating Start/Stop

Depending on your environment, this method may or may not be applicable, as they are meant for non-critical workloads. This feature will provide cost savings for the compute costs of the VMs (Note that storage costs will continue regardless of the state of the VMs). Typically, VMs that are utilized for Dev / Test environments would be applicable.

Azure Automation : Setting job schedules

Using Automation runbooks, we can have user-defined jobs to automatically start or stop VMs based on CPU utilization, by tags or schedules. A good example would be to automate VMs to only run during working hours and stopped on weekends. Thank you for reading and I hope these tips will give you some insight on how cost optimization can be done on your Azure environment, stay tuned for more posts!

Leave a Reply

Your email address will not be published.