How Does Azure Price Spot Instances?
Azure lets you buy spare capacity at a lower price—up to 90% less than the pay-as-you-go market price. However, once Azure needs this spare capacity back, your spot instances (which Azure calls spot VMs) will be terminated, with an advance warning of only 30 seconds. This can make it challenging to use this Azure pricing model for mission critical and production workloads.
Because of their unreliable nature, spot instances are typically used for stateless applications, batch processing, or development and testing scenarios, where it is acceptable to have an application instance fail. It is possible to use spot instances on Azure for stateful and mission critical applications, but this requires careful management, and the use of automated cloud optimization tools.
In this article, you will learn:
- Azure Spot Instances Pros and Cons
- Azure Spot Pricing
- How Azure Spot VM Eviction Works
- Azure Spot VMs Eviction History
- Automating Azure Spot VMs with Spot by NetApp
Spot instances are a very compelling pricing option on Azure, but before using it, you need to consider its pros and cons.
Azure spot instances pros
The obvious pro of spot instances is their low price, which may be discounted at up to 90% of pay-as-you-go rates. Other advantages include:
- Useful for a variety of workloads that can withstand interruption
- Can be used as part of Virtual Machine Scale Sets (VMSS)
- Can be combined with pay-as-you-go VMs to improve reliability (for example, running 5 pay-as-you-go VMs to guarantee baseline application capacity and adding spot instances for peak capacity).
Azure spot instances cons
- Spot VMs do not provide any availability guarantees
- Spot VMs are evicted based on capacity or current market price with only 30 seconds notice
- After VMs are evicted, they are not automatically turned back on when capacity is available or prices go down
- Low cost B-series VMs and promo VM types such as Dv2 or NV are not supported
- You cannot convert a spot VM to a regular VM
Learn more in our detailed guide to Azure spot instances
Azure has separate pricing for individual spot VMs and spot VMs used as part of Virtual Machine Scale Sets (VMSS).
Azure offers a wide range of VM types and sizes, with support for multiple operating systems, databases, and hardware configurations. Current generation VMs offer auto-scaling and load balancing at no additional cost.
Spot instances let you purchase unused VM capacity at up to 90% less than the pay-as-you-go price. Actual discount rates vary depending on regions, VM type, and other factors.
Examples of Virtual Machines Spot Pricing
The following examples show the comparative price of pay-as-you-go and spot VMs, for Linux VMs, in the West US region. Azure prices are subject to change—for the latest costs see the official pricing page.
|Spot Price||Spot Discount|
|Av2 A1||Cost-effective VM for light workloads||$0.036/hour||Starting from $0.005/hour||Up to 86%|
|Fsv2 F2s||Compute-optimized VM with Xeon Platinum 8168 CPU||$0.0846/hour||Starting from $0.0102/hour||Up to 88%|
|Dv3 D2||General-purpose VM with Xeon processor||$0.096/hour||Starting from $0.0125/hour||Up to 87%|
|Ev3 E2||VM with Xeon processor and a larger amount of system memory||$0.126/hour||Starting from $0.016/hour||Up to 88%|
Spot Virtual Machine Scale Sets
Virtual Machine Scale Sets (VMSS) can help you build scalable applications. This service lets you deploy and manage several VMs as a single group.
VM Scale Sets are deployed by Azure Resource Manager (ARM), Azure’s infrastructure as code (IaC) framework. VMSS comes with Azure load balancing and auto scaling capabilities built in. Currently, you can run VMSS with VMs with plain Linux or Windows, or custom machine images.
There are two modes of operations when using VM scale sets:
- Scale Set VMs—let you create and manage groups of identical VMs.
- Single VMs—let you create a VMSS based on a new VM, as it is created, to create replicas of the VM for high availability.
VMSS are available on all Azure Linux or Windows VM sizes. You are billed for deployed Azure VMs and related resources your VMs use, such as networking and storage. There is no additional charge for the VMSS service itself. However, you should note that for some VM types, spot pricing for VMSS offers smaller discounts than regular VMs.
Examples of Virtual Machines Scale Sets Spot Pricing
The following examples show the comparative price of spot vs pay-as-you-go VMs within a VMSS. Prices shown are for Linux VMs in the West US region.
|Spot Price||% Discount|
|Av2 A1||$0.036/hour||Starting from $0.0088/hour||Up to 76%|
|Fsv2 F2s||$0.0846/hour||Starting from $0.0288/hour||Up to 66%|
|Dv3 D2||$0.096/hour||Starting from $0.0452/hour||Up to 53%|
|Ev3 E2||$0.126/hour||Starting from $0.0354/hour||Up to 72%|
Related content: Read our guide to Azure autoscaling
Azure spot VMs may be terminated according to current price or available capacity—in Azure, this process is called “eviction”. When you create an Azure Spot VM, you can select one of two eviction policies:
- Deallocate—this is the default policy, which pauses a spot VM when capacity is reclaimed or when price is exceeded, allowing you to redeploy it later. Keep in mind that you are still charged for storage costs of the managed disks used by the VM.
- Delete—completely deletes the spot VM and its attached storage.
You can use Azure Scheduled Events to to set up in-VM notifications, and alert applications running on a VM when it is about to be evicted. You receive 30 seconds notice before the VM is evicted, and you can use this time to shut down applications and save results of operations performed on the VM.
You can use the Azure Portal to see information about VMs, including eviction rates by VM size and historical prices.
Select the View Price History to compare historical spot prices and eviction rates for different Regions and VM sizes. This can help you identify spot VMs that are more attractive for you, because they potentially have a lower price or a lower chance of eviction.
If you are looking to broaden your usage of Azure spot VMs for even mission-critical workloads, Spot by NetApp’s Elastigroup and Ocean products enable you to do so for non-containerized and AKS workloads respectively.
By leveraging proprietary, predictive algorithms that consider both current spot market activity and historical trends, Spot by NetApp will spin up new replacement spot instances in advance while gracefully draining at-risk ones. If spot instances are not available, the workload will be moved to pay-as-you-go instances. In those situations, Spot by NetApp will move workloads back to spot instances as soon as they become available.