What do you do when you want to run a Virtual Machine to do a job but you don’t mind when that job happens? Wouldn’t it be good if that could be super cheap. With Azure Spot VMs, you can buy spare capacity in Microsoft Azure to run your workloads. When Microsoft need the capacity back, the VM stops.
Do you have services that you need to run but you don’t mind when or how they run so long as they do? Azure Spot VMs, newly announced in preview this week could be just for you.
What is an Azure Spot VM?
An Azure Spot VM is a virtual machine that runs using spare compute capacity in Microsoft Azure providing you with bottom dollar prices in exchange for the fact that the VM might disappear when that capacity is demanded by a fully-paid-up-instance.
Think of Azure Spot VMs like the food at the supermarket that’s about to go out of date. Instead of throwing it away, they offer it up at a discount because selling something at cost or close to cost is better than not selling it at all.
How is a Spot VM priced and charged?
Spot VMs, once public, will use variable pricing to alter the price based on capacity and demand. If you’ve used Uber and seen their demand-based pricing at work where they decrease the pricing when there’s lots of availability and capacity but increase it when there’s not much room, this is the same as that.
During the preview period, dynamic pricing isn’t in effect and the pricing will be set at fixed rates.
If we look at the Microsoft documentation at https://docs.microsoft.com/en-us/azure/virtual-machines/windows/spot-portal we can see that with a Spot VM, we can define a maximum price that we are prepared to pay. When the price peaks above this level, any Spot VMs will be evicted to stop you breaching your billing target.
If you want to run a Spot VM regardless of how much the price flexes, you also have the option to turn off the cost metric and only evict the VM when Azure needs the capacity back.
How does an Azure Spot VM work?
When it’s running, it runs just like any other virtual machine instance. It’s the provisioning and de-provisioning of the virtual machines that differ.
When we provision a virtual machine in Azure, there’s now a new option that we can specify whether or now we want the VM to be based on a Spot Instance. Selecting yes allows us to pick whether we want to use demand-based or demand and price-based eviction as explained above.
When Azure needs that capacity back, the VM becomes evicted but what does this actually mean?
What does evicting an Azure Spot VM mean?
This is the most important aspect of understanding for a Spot VM. A VM is running and doing a job and suddenly, Azure wants the capacity back so what happens?
As of today, there is only one option but going forward, there will be two options. The option today is that the VM is Stopped and Deallocated. The VM is not deleted completely and the OS and any Data Disks remain intact. You have the option to start the VM again in the future in another spot.
The second option, which we have to presume will be lit up either later in the preview or at general availability is delete. With this delete option, you can have the VM entirely destroyed when the Spot VM is evicted.
We can see this second option of delete being really useful and powerful in stateless distributed computing scenarios where you want to throw resource at a processing task to get it finished but there is no persistent data to be saved afterwards.
Where can I find out more?
If you want to find out more about Azure Spot VMs, take a look at the information at https://docs.microsoft.com/en-us/azure/virtual-machines/windows/spot-vms which includes information about eviction policies, charges, and more.
If you are interested in Microsoft Azure, why not take a look at our Cloud Platform solution to see what types of services Arcible can help you to build in Microsoft Azure. You can contact us with any enquiries you may have about Cloud Platform, Consulting, or even Arcible Vision so that we can help you manage your Azure environment.