Try for free Book a demo

How to Save on Azure Costs with Auto-Stop VMs

Azure Cost Management

7 Mins Read | Last modified on September 20th, 2024

auto shutdown Azure VM when idle featured image

A virtual machine (VM) functions similarly to a physical computer, but it exists as a digital counterpart. Like physical computers, VMs have memory, CPUs, and disks for storing data and files. Additionally, they can connect to the internet. Essentially, a VM is a software-based computer that operates as code on physical servers.

A cloud enterprise often incurs high costs for VM resources, as pricing varies based on the service tier. It is generally observed that virtual machines used for non-production environments are generally active only during business hours. Running these VMs during off-hours results in substantial Azure expenses.

Even though you only pay for what you use, keeping track of the cost spent across your Azure resources is essential to avoid sudden spikes in your Azure cost. Because over-provisioning resources or leaving services unattended during non-working hours can quickly escalate your Azure spending, you might even end up paying for unused resources as well.

That is why cost optimization is critical for an organization leveraging Azure. Particularly when Virtual Machines (VMs) are employed as a scalable computing resource for hosting or developing applications, keeping track of individual machine usage and its metrics is vital. It is the key to containing the cost, enhancing the operational efficiency, and ultimately elevating the business performance.

How to optimize cost of Azure VM?

Idle virtual machines often run at full capacity, inefficiently using CPU, memory, and network resources. This unproductive high utilization leads to higher-than-expected costs, quickly depleting your Azure budget.

Numerous factors affect virtual machine idleness. The significant ones include:

  • VM resources become idle when no active services are running in cases when the workload is low (or) during off-peak hours.
  • Under- or over-utilization of VM resource resources may result in performance degradation, eventually leading to prolonged inactivity.
  • The idle time of a virtual machine (VM) is directly affected by the state of the resources it uses for networking and storage, such as SQL Server.

The main objective of managing the cost spent on VMs is finding the factors that influence a VM’s idleness. Once these inactive VMs are terminated during off-peak hours, the resources assigned to them can be dynamically distributed according to demand, lowering the need for over-provisioning, and promoting effective resource utilization.

What are the options to auto stop Azure VMs?

Azure provides two popular ways to schedule virtual machine (VM) shutdowns during off-peak hours.

Auto shutdown feature in Azure Portal

1. Azure has an integrated feature that allows you to schedule the shutdown of your virtual machine (VM) for a specific time and time zone. To access this feature, use the path below for an Azure virtual machine resource: Operations -> Auto-shutdown.

You can also specify a Webhook URL and an email address to receive alert notifications before auto-shutdown.

You can use this feature to customize the shutdown time for each distinct virtual machine. The major drawback is that setting it up when using various virtual machines can be challenging. Restarting them one at a time each day is also tiresome.

2. Microsoft Azure provides Azure Automation, a tool for automating labor-intensive processes, cloud, and configuration services.

You can use Azure Automation to create a runbook that outlines a step-by-step process for automatically shutting down your VMs at a specified time.
The challenge with Azure Automation is that only all your VMs can be scheduled to stop simultaneously. Practically speaking, this can only be helpful in some business scenarios.

The only other option available when using Azure Automation is to start and stop VMs with specific tags using a runbook you create. The drawback of this option is that you are forced to rely only on your Runbooks regarding your VM status, which may contain bugs and coding errors that prevent your virtual machines from operating correctly.

Cutting Azure costs by implementing auto-shutdown for VM using Turbo360

Turbo360’s Cost Analyzer is an Azure cost optimization tool that opens new possibilities for managing all your Azure expenses, creating optimization schedules to start, stop, and change the service tier of compatible resources during business hours, and monitoring your Azure budget for any spikes.

Cost Optimization is a crucial component integrated into Cost Analyzer that enables you to schedule your Azure services to run/stop (or) change the service tier during business and off-peak hours.

Cost Analyzer supports various Azure services for integrating with optimization schedules. The following Azure services are compatible integrating with optimization schedules:

  • App Service Plan
  • Cosmos SQL Container
  • Cosmos SQL Database
  • Cosmos Table
  • Data Factory Pipeline
  • Logic App
  • SQL Database
  • SQL Elastic Pool
  • Synapse Pipeline
  • Virtual Machines
  • Virtual Machine Scale Set

Let me showcase the potential savings on costs associated with scheduling VM Auto-shutdown using Turbo360’sTurbo360’s Cost Analyzer.

Assume your enterprise application uses over 500 VMs and is distributed across different Azure subscriptions. Shutting down all idle VMs is necessary to optimize your Azure expenditure.

To get insights into your Azure spending, you must create a cost management group with access to all your subscriptions.

In a cost management group, navigate the following path to create an optimization schedule for your preferred time zone: Optimization -> Schedules -> Add.

Auto-shutdown VMs by implementing Scheduling feature in Turbo360

The setup wizard presents a screen with options to fill in all the essential information, such as the schedule name, time zone selection, and a brief description that helps you quickly determine the schedule’s purpose.

Adding the VM optimization schedule

The next screen allows you to configure the time to stop the VM. Optimal business hours are usually between 8 a.m. and 5 p.m., regardless of different time zones.

Mark non-business hours in red for each day of the week. Estimated savings are the potential savings that can be achieved with the help of this configuration.

Add VM optimization schedule using Turbo360

You can select your virtual machine resources on the next screen to schedule Auto-shutdown. The resources are listed based on the subscription selection.

Set Start and Deallocate as the Up and Down configuration values, respectively. The Up and Down configuration values are applied based on the Up and Down hours specified in the schedule configuration.

Setting up VM scheduling

You can set up notification services to which the scheduling alert will be sent on the following screen. Various notification services are integrated with Turbo360, making it feasible for users to receive all their business notifications in one place without accessing the application.

The list of supported notification services includes:

  • ServiceNow
  • SMTP
  • PagerDuty
  • Microsoft Teams
  • Azure DevOps
  • Opsgenie
  • Operations Management Suite
  • WebHook
  • Twilio
  • Slack

VM scheduling notification channels

The schedule summary, which includes all pertinent information like the number of scheduled resources, potential cost savings, and configured notification services, is displayed on the final screen. To complete the schedule set up, click Create Optimization schedule.

Summary report of VM scheduling provided by Turbo360

You are all set! You will be notified through the notification services when the configured virtual machine resources are automatically stopped and restarted during scheduled downtime and uptime.

The critical benefits extracted from the above scenario when using Turbo360 over Azure are:

  • Several virtual machines can be scheduled to auto-shutdown and restart simultaneously.
  • The downtime and uptime can be scheduled for multiple virtual machines collectively or separately.
  • The potential cost savings achieved by automatically shutting down idle VMs using Optimization schedules are displayed right in front of you, facilitating the strategizing of your Azure spending.
  • You can also have insights on the cost savings when configuring the remaining virtual machines according to your schedule configuration.

To Summarize

With business organizations turning to cloud computing to manage all their applications and data, virtual machines are increasingly used. Since VMs account for a significant amount of Azure spending, shutting down unused VMs during non-productive hours is imperative because the spending could be more effective.

Control over your Azure expenses can only be achieved by implementing an automated process to shut down all idle VMs during off-peak hours.

Related reading

This article was originally published on Feb 20, 2024. It was most recently updated on Sep 20, 2024.

Advanced Cloud Management Platform - Request Demo CTA

Related Articles