Many Azure users have wondered: does Azure charge for stopped VMs? If you are using Azure and leave VMs running, you may get a shock on your cloud bill – and even some stopped Azure VMs can contribute. That’s why it’s important to stop your resources when they’re not in use. For example, by leaving a non-production VM running 24/7 when it’s only used 12 hours/day on weekdays, you’re wasting 65% of the cost. Simply by turning these off when not in use, you can reduce your bill significantly.
But, first, make sure you understand the difference between two states in Azure: “stopped” and “stopped (deallocated)” so you know what it actually means to “flip the switch” on your Azure VMs. One option will still charge for compute resources, while the other option frees you from paying for the compute resources to help you reduce your overall cost on your Azure stopped VM billing.
How Azure Stopped VM Cost Works
Let’s say you created a VM in Azure that was stopped, and did not think it was running. However, when you received your Azure billing statement, you noticed Azure stopped VM was still incurring compute charges. That would mean your VM is in the “stopped” state rather than “stopped (deallocated).
Let’s look at these two options to further explain the difference between them for better understanding of Azure VM cost when stopped. In order to “shut down” a VM running in Microsoft Azure, the two options available are Stopped or Stopped (Deallocated).
Using the Stopped Option:
When you shut down a VM from within the OS, it goes into the “stopped” state. This option will essentially “turn off” or power down the VM, and stop it from running. However, the resources are not released. Azure stopped deallocated billing means that even though the VM is not running, you will still be paying for the Azure VM compute resources (hardware allocation) in the datacenter.
Your VM might use this state if:
- You need to manually shut down the OS temporarily, perhaps to reconfigure an application running on the VM.
- You want to run other tools that shut down the OS like, Sysprep on a Windows VM.
- An application or OS problem could shut down the OS unexpectedly.
- Azure periodically stops each VM for a short time to perform routine, planned maintenance in an Azure data center, before restarting the VM.
In this case, the OS in the VM is stopped and the VM services are unavailable, but the VM continues to reserve the compute and network resources that Azure provisioned. If the VM doesn’t restart immediately as part of another operation, then Azure shows the VM status as “Stopped” in the Azure Management Portal or other Azure management tools.
While the VM is Stopped, Azure continues to charge for the VM core hours, based on the size of the VM and the image you selected to create it. You will continue to accrue charges for the VM’s cloud service and the storage needed for the VM’s OS disk and any attached data disks, however, the temporary (scratch) disk storage on the VM is free. You will also not be able to connect to it remotely, and service endpoints on the VM will not accept network traffic. Unless you group the VM in an availability set with VMs performing similar work or configure load-balanced endpoints, the workload that the VM runs will be unavailable.
Using the Stopping (Deallocating) Option:
On the other hand, you can stop all charges for a VM by using the stopped (deallocated) state. In order to use this option, you will have to go into the Azure Portal (or use the Azure CLI or Azure PowerShell) and use Azure to stop the VM. Instead of just shutting down the Operating System, Azure will also deallocate the compute resources allocated for the VM. This releases the compute resources to be used for another customer. It will cause Azure to no longer charge you for the compute resources, and Azure will report the status of the VM as being in a “Stopped (Deallocated)” state.
Basically, you or Azure shuts down the VM by using Azure tools or processes to:
- Minimize costs, but want to be able to resume work with it later, you can shut down the VM by selecting the VM in the Management Portal and clicking shut down.
- Configure the VM in an availability set configured for autoscaling, Azure could shut it down in a scale-down action.
- Or, in specific situations, if Azure detects that the VM is not available or healthy because of problems like faulty hardware, Azure shuts down the VM and migrates it to different hardware.
By stopping (deallocating) a VM, you not only stop the VM’s OS, you also free up the hardware and network resources Azure previously provisioned for it – that’s the deallocation part. You will also release the internal dynamic IP (DIP) address, as well as the public virtual IP (VIP) address, unless you configured static addresses for the VM. When you restart the VM, it will then pick up a new public VIP (if it is not joining a cloud service that already has one) as well as a new DIP.
The VM’s OS and data disks remain intact in Azure storage and can be used to restart the VM later. However, the temporary (scratch) disk associated with the VM is released and any data on that disk could be lost. If the VM doesn’t restart immediately as part of another operation. Azure shows a VM status of Stopped (Deallocated) in the Azure Management Portal or other Azure management tools.
Azure doesn’t charge for the VM core hours while it is Stopped (Deallocated). However, you continue to accrue charges for the Azure storage needed for the VM’s OS disk and any attached data disks. Just like a Stopped VM, if the VM is Stopped (Deallocated), you cannot connect to it remotely, and service endpoints on the VM will not accept network traffic. Unless you group the VM in an availability set with VMs performing similar work or configure load-balanced endpoints, the workload that the VM runs will be unavailable.
Automatically Save on Azure Costs
Shutting down a VM to put it in the Stopped (Deallocated) status is a great way to save cost on Azure VMs. The next step is determining which VMs you can stop and when you can stop them.
While you can attempt to do this manually, it is unlikely you’ll want to rely on a manual process. The best information comes from your VM tags, telling you which VMs are for dev, test, staging, QA, and other non-production purposes, and are therefore good candidates to turn off nights and weekends to reduce costs. Even better is the actual utilization data from your resources to show when resources can safely be shut down based on your past patterns.
The ParkMyCloud platform can help you easily manage these cost optimization tasks and more. It can automatically manage the scheduling and rightsizing of your VMs, provides user governance with robust reporting and easy-to-use UI, discover unnecessary volumes/snapshots with your utilization data, access multiple accounts and cloud providers.
Give it a try with a 14-day free trial. It takes about 15 minutes to get set up, and you can start optimizing your Azure spend today.