Low-usage virtual machines can quickly skyrocket your cloud computing costs. You can save significant money by identifying low-usage virtual machines and reducing their size.
Azure provides various instance types to cater to different workload requirements and resource types. By allocating VMs according to their specialized purpose and workload requirements, you can avoid idle or unused VM resources and, in turn, significantly save your cloud computing costs.
Calculating and optimizing the costs of your VMs is easier with the right tools and services. Microsoft provides Azure Cost Management, Azure Advisor, and Azure Pricing Calculator.
Defining Low CPU Usage
Azure Advisor identifies underutilized virtual machines by monitoring your virtual machine's usage for seven days. Virtual machines have low usage if their network usage is 7 MB or less and CPU utilization percentage is 5% or less averaged over four or more days.
You can configure the average CPU utilization rule on a per subscription basis. It can be set to 5%, 10%, 15%, or 20% — 5% is the default setting.
View Utilization of an Azure VM
To access a virtual machine's performance or utilization insights, perform the following steps.
- Log in to the Azure portal and select Virtual Machines.
- Select a virtual machine from the list of VMs to view its usage.
- In the Monitoring section, select Insights.
- Select the Performance tab.
The page shows performance utilization charts, CPU Utilization, Available Memory, Logical Disk Space Used, Logical Disk IOPS, Logical Disk MB/s, Max Logical Disk Used, and Bytes Sent and Receive Rate for each logical disk.
Resizing Azure Virtual Machines with Low CPU Usage
There are multiple ways to resize Azure virtual machines. Virtual machines restart while resizing, so scheduling the restart can reduce disruptions caused by the unavailability.
Resizing a Virtual Machine in Azure Advisor
Azure Advisor provides various cost optimization recommendations.
- In the list of recommendations, select the Right-size or shutdown under-utilized virtual machines recommendation.
- In the list of VMs, choose one for resizing and select it. Verify the utilization metrics in the details displayed. The potential yearly savings value shows how much you save by shutting down or removing the VM, not by resizing it.
- Make a note of the current VM's size. Now, close the window to see a list of virtual machines.
- In the list of VMs, select Resize <FromVirtualMachineSKU> to <ToVirtualMachineSKU>.
- Next, there's a list of feasible resize options. Select the cost-effective one that provides the best performance.
- Select Resize option.
A notification appears when the VM resizes effectively.
Resizing a Virtual Machine in Azure Portal
- Log in to the Azure portal.
- Access the virtual machine page.
- Select the size option from the left-hand side menu.
- Choose a new virtual machine size from the list of available sizes.
- Select Resize option.
If the new size is unavailable on the hardware cluster hosting the virtual machine, deallocate the VM before resizing it.
Note: Choose the s version of the virtual machine size that uses premium storage.
Resizing a Virtual Machine in CLI
1. You can view the current size of a VM with az vm show. This script lists the VM size of "blinkVM" in the "blinkResourceGroup" region:
2. View the available VM sizes on the hardware cluster hosting the VM using az vm list-vm-resize-options. This script displays VM sizes for "blinkVM" in the "blinkResourceGroup" region:
3. If the desired VM size is listed, resize the VM with az vm resize. This script resizes "blinkVM" to the "Standard_D3_v2" size:
After the VM restarts, your data disks and OS are remapped. Data on the temporary disk is erased.
4. If the VM size you want is not listed, first deallocate the VM with az vm deallocate. Afterward, you can resize the VM to any available size supported by the region. The following steps deallocate, resize, and start the VM:
Any dynamic IP addresses assigned to the VM are released during deallocation. The OS and data disks are unaffected.
Automate the Resizing Process with Blink
As your business and engineering requirements evolve against internal operational needs and external market developments, your resizing efforts should be just as agile.
Whether you want to aggregate reports on your CPU usage or navigate instance migrations, having an easy way to navigate the steps is critical.
With Blink, you can automate this usage check and use no-code/low-code automations to manage and customize your resizing process.
Get started and create your free Blink account today.