Microsoft announces Spot VMs in Azure, using this feature customers can take benefit of Azure’s unused capacity at lowest cost. Spot VMs replaces the Low-priority VMs. Azure Spot VMs can be used for testing purposes, batch processing jobs, large compute workloads, and more. Don’t get confused about this feature, it’s not a big deal, we will discuss this feature in this blog
To clear about this feature, we are going to talk over some of the topics given below.
Microsoft announced a Spot VMs mainly for utilizing their unused capacity with the lowest amount than pay as you go. The amount of available capacity can vary depends on region, size, time and more. But one thing we need to remember, Azure will evict our VMs at any time.
Both are not much distinct, but the difference is Spot VMs have no SLA (Service Level Agreement, its commitment between service providers and users), and our VMs will get evicted at any time.
When creating VM in the Azure portal you can view the Azure Spot instance option, if toggle this option to yes, you can see two types of Eviction.
In this Capacity only type your max price is set to pay as you go rate, and Microsoft will evict our VM when they need the capacity for pay as you go workloads.
In this Price or capacity type, you have a good option to decide the Max price that you want to pay per hour. If you decide you want to spend only a fixed amount and don’t want to spend more for testing purpose, in this case you can select Price or capacity type.
Azure recommends to select the max price, and also having chance for getting increase in cost of the instance, in such a situation our VMs get evicted. And Azure will also evict when Azure needs a capacity for pay as you go workloads.
Azure will evict our VMs when our capacity or price is met. When Azure evict our VM it will send a notification through Azure Scheduled Events that says “your VM are being evicted and you have 30 seconds to save your positions and complete shutdown tasks”. Then after 30 seconds, VM moved to deallocate state, which means VM gets evicted and then we need to redeploy the evicted VM.
So, it’s time to see when our VM gets evicted, and how we can save our VM without eviction, let’s talk over the scenario.
Our VMs gets evicted for two reason
For example, look at the below image. During deployment, I select the max price which is Canada central ($0.02220), but currently, the price of the VM gets increased than the max price we set early, in such a state our VM gets evicted.
If you set the maximum price to -1, then our VM will not get evicted for pricing reason, because -1 is considered as a current price up to price for standard VM.
|When our VM get deployed||When our VM is not deployed|
|Selecting the Max price greater than the current price.||Setting Max price, which is lesser than the current price, it shows error, that max price needs to be greater than the current price.|
|Restarting the evicted VM: Selecting the Max price greater than the current price.||Restarting the evicted VM: Setting the Max price, that is lesser than the current price, it shows an error, that the max price needs to be greater than the current price|
And two more scenario we meet:
Your last visit:x