0
0
AzureConceptBeginner · 3 min read

What is Spot VM in Azure: Definition and Use Cases

An Azure Spot VM is a virtual machine that uses unused Azure capacity at a discounted price. It can be evicted when Azure needs the capacity back, making it ideal for flexible, interruptible workloads.
⚙️

How It Works

Imagine you want to rent a car only when it's not being used by others. Azure Spot VMs work similarly by using leftover cloud capacity that is not currently in demand. This means you get a big discount, but your VM can be taken away if someone else needs that capacity.

When you create a Spot VM, you agree that Azure can stop your VM at any time if it needs the resources. This is called eviction. You can choose how Azure should handle eviction, like stopping or deleting the VM. This setup is perfect for jobs that can pause and resume without problems.

💻

Example

This example shows how to create an Azure Spot VM using Azure CLI with eviction policy set to 'Deallocate'.

bash
az vm create \
  --resource-group myResourceGroup \
  --name mySpotVM \
  --image UbuntuLTS \
  --size Standard_DS1_v2 \
  --priority Spot \
  --eviction-policy Deallocate \
  --max-price -1 \
  --admin-username azureuser \
  --generate-ssh-keys
Output
Virtual machine 'mySpotVM' created successfully with Spot priority and eviction policy set to Deallocate.
🎯

When to Use

Use Azure Spot VMs when you have workloads that can handle interruptions without losing progress. Examples include:

  • Batch processing jobs like video rendering or data analysis
  • Testing and development environments where uptime is not critical
  • Stateless applications that can restart quickly
  • Big data workloads that can checkpoint progress

Spot VMs help save costs significantly but are not suitable for critical applications that require guaranteed uptime.

Key Points

  • Spot VMs use unused Azure capacity at a discount.
  • They can be evicted anytime when Azure needs resources.
  • Eviction policies include Deallocate or Delete.
  • Best for flexible, interruptible workloads.
  • Not recommended for critical or stateful applications.

Key Takeaways

Azure Spot VMs offer discounted compute by using spare capacity with possible eviction.
They are ideal for workloads that can tolerate interruptions and resume later.
Eviction policies control what happens when Azure reclaims the VM.
Spot VMs are not suitable for critical applications needing guaranteed uptime.
Use Spot VMs to reduce cloud costs for batch, testing, or stateless workloads.