Use Spot VMs in Azure

Using Spot VMs allows you to take advantage of our unused capacity at a significant cost savings. At any point in time when Azure needs the capacity back, the Azure infrastructure will evict Spot VMs. Therefore, Spot VMs are great for workloads that can handle interruptions like batch processing jobs, dev/test environments, large compute workloads, and more.

The amount of available capacity can vary based on size, region, time of day, and more. When deploying Spot VMs, Azure will allocate the VMs if there is capacity available, but there is no SLA for these VMs. A Spot VM offers no high availability guarantees. At any point in time when Azure needs the capacity back, the Azure infrastructure will evict Spot VMs with 30 seconds notice.

Eviction policy

VMs can be evicted based on capacity or the max price you set. When creating a Spot VM, you can set the eviction policy to Deallocate (default) or Delete.

The Deallocate policy moves your VM to the stopped-deallocated state, allowing you to redeploy it later. However, there is no guarantee that the allocation will succeed. The deallocated VMs will count against your quota and you will be charged storage costs for the underlying disks.

If you would like your VM to be deleted when it is evicted, you can set the eviction policy to delete. The evicted VMs are deleted together with their underlying disks, so you will not continue to be charged for the storage.

You can opt-in to receive in-VM notifications through Azure Scheduled Events. This will notify you if your VMs are being evicted and you will have 30 seconds to finish any jobs and perform shutdown tasks prior to the eviction.

Option Outcome
Max price is set to >= the current price. VM is deployed if capacity and quota are available.
Max price is set to < the current price. The VM is not deployed. You will get an error message that the max price needs to be >= current price.
Restarting a stop/deallocate VM if the max price is >= the current price If there is capacity and quota, then the VM is deployed.
Restarting a stop/deallocate VM if the max price is < the current price You will get an error message that the max price needs to be >= current price.
Price for the VM has gone up and is now > the max price. The VM gets evicted. You get a 30s notification before actual eviction.
After eviction the price for the VM goes back to being < the max price. The VM will not be automatically re-started. You can restart the VM yourself, and it will be charged at the current price.
If the max price is set to -1 The VM will not be evicted for pricing reasons. The max price will be the current price, up to the price for standard VMs. You will never be charged above the standard price.
Changing the max price You need to deallocate the VM to change the max price. Deallocate the VM, set a new max price, then update the VM.

Limitations

The following VM sizes are not supported for Spot VMs:

  • B-series
  • Promo versions of any size (like Dv2, NV, NC, H promo sizes)

Spot VMs can be deployed to any region, except Microsoft Azure China 21Vianet.

The following offer types are currently supported:

  • Enterprise Agreement
  • Pay-as-you-go
  • Sponsored
  • For Cloud Service Provider (CSP), contact your partner

Pricing

Pricing for Spot VMs is variable, based on region and SKU. For more information, see VM pricing for Linux and Windows.

You can also query pricing information using the Azure retail prices API to query for information about Spot pricing. The meterName and skuName will both contain Spot.

With variable pricing, you have option to set a max price, in US dollars (USD), using up to 5 decimal places. For example, the value 0.98765would be a max price of $0.98765 USD per hour. If you set the max price to be -1, the VM won't be evicted based on price. The price for the VM will be the current price for spot or the price for a standard VM, which ever is less, as long as there is capacity and quota available.

Pricing and eviction history

You can see historical pricing and eviction rates per size in a region in the portal. Select View pricing history and compare prices in nearby regions to see a table or graph of pricing for a specific size. The pricing and eviction rates in the following images are only examples.

Chart:

Screenshot of the region options with the difference in pricing and eviction rates as a chart.

Table:

Screenshot of the region options with the difference in pricing and eviction rates as a table.

Frequently asked questions

Q: Once created, is a Spot VM the same as regular standard VM?

A: Yes, except there is no SLA for Spot VMs and they can be evicted at any time.

Q: What to do when you get evicted, but still need capacity?

A: We recommend you use standard VMs instead of Spot VMs if you need capacity right away.

Q: How is quota managed for Spot VMs?

A: Spot VMs will have a separate quota pool. Spot quota will be shared between VMs and scale-set instances. For more information, see Azure subscription and service limits, quotas, and constraints.

Q: Can I request for additional quota for Spot?

A: Yes, you will be able to submit the request to increase your quota for Spot VMs through the standard quota request process.

Q: Where can I post questions?

A: You can post and tag your question with azure-spot at Q&A.

Next steps

Use the CLI, portal, ARM template, or PowerShell to deploy Spot VMs.

You can also deploy a scale set with Spot VM instances.

If you encounter an error, see Error codes.