Skip to content

Commit 8aed47d

Browse files
authored
Merge pull request #314716 from psocha/psocha/post-lowpriority-retirement
Update Batch Spot docs following low-priority retirement
2 parents 6a28e9b + 3374a25 commit 8aed47d

4 files changed

Lines changed: 90 additions & 274 deletions

File tree

articles/batch/.openpublishing.redirection.batch.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,11 @@
200200
"redirect_url": "/azure/reliability/reliability-batch",
201201
"redirect_document_id": false
202202
},
203+
{
204+
"source_path_from_root": "/articles/batch/low-priority-vms-retirement-migration-guide.md",
205+
"redirect_url": "/azure/batch/batch-spot-vms",
206+
"redirect_document_id": false
207+
},
203208
{
204209
"source_path_from_root": "/articles/batch/policy-samples.md",
205210
"redirect_url": "/azure/batch/policy-reference",

articles/batch/TOC.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@
118118
href: https://github.com/Azure/Batch/labels/notice
119119
- name: VHD and Managed Images
120120
href: batch-custom-image-pools-to-azure-compute-gallery-migration-guide.md
121-
- name: Low-priority virtual machines
122-
href: low-priority-vms-retirement-migration-guide.md
123121
- name: Classic compute node communication model
124122
href: batch-pools-to-simplified-compute-node-communication-model-migration-guide.md
125123
- name: How-to guides

articles/batch/batch-spot-vms.md

Lines changed: 85 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Run Batch workloads on cost-effective Spot VMs
33
description: Learn how to provision Spot VMs to reduce the cost of Azure Batch workloads.
44
ms.topic: how-to
5-
ms.date: 02/23/2026
5+
ms.date: 04/14/2026
66
ms.custom:
77
# Customer intent: "As a cloud solutions architect, I want to deploy Batch workloads using Spot VMs, so that I can reduce costs while managing jobs with flexible completion times and efficient resource allocation."
88
---
@@ -11,39 +11,13 @@ ms.custom:
1111

1212
Azure Batch offers Spot virtual machines (VMs) to reduce the cost of Batch workloads. Spot VMs make new types of Batch workloads possible by enabling a large amount of compute power to be used for a low cost.
1313

14-
Spot VMs take advantage of surplus capacity in Azure. When you specify Spot VMs in your pools, Azure Batch can use this surplus, when available.
14+
Spot VMs take advantage of surplus capacity in Azure. The amount of surplus capacity that is available varies depending on factors such as VM family, VM size, region, and time of day. When you specify Spot VMs in your pools, Azure Batch can use this surplus, when available.
1515

16-
The tradeoff for using Spot VMs is that those VMs might not always be available, or they might get preempted at any time, depending on available capacity. For this reason, Spot VMs are most suitable for batch and asynchronous processing workloads where the job completion time is flexible and the work is distributed across many VMs.
16+
The tradeoff for using Spot VMs is that these VMs have no SLA and no availability guarantees. Spot VMs can be preempted at any time, including immediately upon VM creation. For this reason, Spot VMs are most suitable for batch and asynchronous processing workloads where the job completion time is flexible and the work is distributed across many VMs.
1717

18-
Spot VMs are offered at a reduced price compared with dedicated VMs. To learn more about pricing, see [Batch pricing](https://azure.microsoft.com/pricing/details/batch/).
19-
20-
## Differences between Spot and low-priority VMs
21-
22-
Batch offers two types of low-cost preemptible VMs:
23-
24-
- [Spot VMs](/azure/virtual-machines/spot-vms), a modern Azure-wide offering also available as single-instance VMs or Virtual Machine Scale Sets.
25-
- Low-priority VMs, a legacy offering only available through Azure Batch.
26-
27-
> [!IMPORTANT]
28-
> Until the low priority to spot VM migration takes place in March 2026, the type of node you get depends on your Batch account's pool allocation mode, which can be set during
29-
> account creation. Batch accounts that use the **user subscription** pool allocation mode always get Spot VMs. Batch accounts that use the **Batch managed** pool allocation mode
30-
> always get low-priority VMs. After the low priority migration in March 2026, spot VMs will be allocated regardless of account type. For more information about the migration,
31-
> see [migrate to Spot VMs in Batch](low-priority-vms-retirement-migration-guide.md).
32-
33-
Azure Spot VMs and Batch low-priority VMs are similar but have a few differences in behavior. Until the migration even in March 2026, the differences are:
18+
If a preemption occurs, the Spot compute node will be evicted and all work that wasn't appropriately checkpointed will be lost. Checkpointing is optional and is up to the Batch end-user to implement. The running Batch task that was interrupted due to preemption will be automatically requeued for execution by a different compute node. A preempted VM may later be restored by the Azure platform, but restoration is only attempted for the first 48 hours after preemption and is not guaranteed to eventually succeed.
3419

35-
| | Spot VMs | Low-priority VMs |
36-
|-|-|-|
37-
| **Supported Batch accounts** | User-subscription Batch accounts | Batch-managed Batch accounts |
38-
| **Available regions** | All regions that support [Spot VMs](/azure/virtual-machines/spot-vms) | All regions except Microsoft Azure operated by 21Vianet |
39-
| **Customer eligibility** | Not available for some subscription offer types. See more about [Spot limitations](/azure/virtual-machines/spot-vms#limitations). | Available for all Batch customers |
40-
| **Possible reasons for eviction** | Capacity | Capacity |
41-
| **Pricing Model** | Variable discounts relative to standard VM prices | Fixed discounts relative to standard VM prices |
42-
| **Quota model** | Subject to core quotas on your subscription | Subject to core quotas on your Batch account |
43-
| **Availability SLA** | None | None |
44-
45-
> [!WARNING]
46-
> After the migration in March 2026, Low priority VMs in Batch will be retired and no longer available.
20+
Spot VMs are offered at a reduced price compared with dedicated VMs. To learn more about pricing, see [Batch pricing](https://azure.microsoft.com/pricing/details/batch/).
4721

4822
## Batch support for Spot VMs
4923

@@ -82,6 +56,16 @@ Keep in mind the following practices when planning your use of Spot VMs:
8256

8357
A Batch pool can contain both dedicated and Spot VMs (also referred to as compute nodes). You can set the target number of compute nodes for both dedicated and Spot VMs. The target number of nodes specifies the number of VMs you want to have in the pool.
8458

59+
Spot VMs might occasionally be preempted. When preemption happens, tasks that were running on the preempted node VMs are requeued and run again when capacity returns. Batch also performs the following behaviors:
60+
61+
- The preempted VMs have their state updated to *Preempted*.
62+
- The VM is effectively deleted, leading to loss of any data stored locally on the VM.
63+
- A list nodes operation on the pool still returns the preempted nodes.
64+
- The pool continually attempts to reach the target number of Spot nodes available. When replacement capacity is found, the nodes keep their IDs, but are reinitialized, going through *Creating* and *Starting* states before they're available for task scheduling.
65+
- Preemption counts are available as a metric in the Azure portal.
66+
67+
### Azure Batch SDK
68+
8569
The following example creates a pool using Azure virtual machines, in this case Linux VMs, with a target of 5 dedicated VMs and 20 Spot VMs:
8670

8771
```csharp
@@ -116,18 +100,6 @@ Pool nodes have a property to indicate if the node is a dedicated or Spot VM:
116100
bool? isNodeDedicated = poolNode.IsDedicated;
117101
```
118102

119-
Spot VMs might occasionally be preempted. When preemption happens, tasks that were running on the preempted node VMs are requeued and run again when capacity returns.
120-
121-
For Virtual Machine Configuration pools, Batch also performs the following behaviors:
122-
123-
- The preempted VMs have their state updated to *Preempted*.
124-
- The VM is effectively deleted, leading to loss of any data stored locally on the VM.
125-
- A list nodes operation on the pool still returns the preempted nodes.
126-
- The pool continually attempts to reach the target number of Spot nodes available. When replacement capacity is found, the nodes keep their IDs, but are reinitialized, going through *Creating* and *Starting* states before they're available for task scheduling.
127-
- Preemption counts are available as a metric in the Azure portal.
128-
129-
## Scale pools containing Spot VMs
130-
131103
As with pools solely consisting of dedicated VMs, it's possible to scale a pool containing Spot VMs by calling the `Resize` method or by using autoscale.
132104

133105
The pool resize operation takes a second optional parameter that updates the value of `targetLowPriorityNodes`:
@@ -136,12 +108,80 @@ The pool resize operation takes a second optional parameter that updates the val
136108
pool.Resize(targetDedicatedComputeNodes: 0, targetLowPriorityComputeNodes: 25);
137109
```
138110

139-
The pool autoscale formula supports Spot VMs as follows:
111+
### Azure CLI
112+
113+
#### Create a new pool with Spot instances:
114+
```azurecli-interactive
115+
az batch pool create \
116+
--id "vmpool" \
117+
--vm-size "Standard_D4s_v3" \
118+
--target-dedicated-nodes 5 \
119+
--target-low-priority-nodes 20 \
120+
--enable-inter-node-communication false \
121+
--image "Canonical:ubuntu-24_04-lts:server" \
122+
--node-agent-sku-id "batch.node.ubuntu 24.04" \
123+
--account-name <your-batch-account-name> \
124+
--account-endpoint "https://<your-batch-account-name>.<region>.batch.azure.com"
125+
```
126+
127+
#### Scale existing pool to use Spot instances:
128+
```azurecli-interactive
129+
az batch pool resize \
130+
--pool-id <existing-pool-id> \
131+
--target-dedicated-nodes 5 \
132+
--target-low-priority-nodes 20 \
133+
--account-name <your-batch-account-name> \
134+
--account-endpoint "https://<your-batch-account-name>.<region>.batch.azure.com"
135+
```
136+
137+
#### Check pool state and node allocation
138+
```azurecli-interactive
139+
az batch pool show \
140+
--account-name <your-batch-account-name> \
141+
--account-endpoint "https://<your-batch-account-name>.<region>.batch.azure.com" \
142+
--pool-id <your-pool-id> \
143+
--query "{State:state, CurrentSpotNodes:currentLowPriorityNodes, TargetSpotNodes:scaleSettings.targetLowPriorityNodes, ResizeErrors:resizeErrors}"
144+
```
145+
146+
### Azure PowerShell
147+
148+
#### Create pool with Spot instances:
149+
```powershell
150+
New-AzBatchPool `
151+
-Id "vmpool" `
152+
-VirtualMachineSize "Standard_D4s_v3" `
153+
-TargetDedicatedComputeNodes 5 `
154+
-TargetLowPriorityComputeNodes 20 `
155+
-VirtualMachineImageId "/subscriptions/{subscription}/resourceGroups/{rg}/providers/Microsoft.Compute/images/{image}" `
156+
-BatchContext $context
157+
```
158+
159+
#### Validate with PowerShell:
160+
```powershell
161+
$pool = Get-AzBatchPool -Id "vmpool" -BatchContext $context
162+
$pool | Select-Object Id, VmSize, @{Name="SpotNodes";Expression={$_.TargetLowPriorityComputeNodes}}, State
163+
```
164+
165+
### Azure portal
166+
167+
1. In the Azure portal, select the Batch account and view an existing pool or create a new pool.
168+
2. Under **Scale**, select either **Target dedicated nodes** or **Target Spot/low-priority nodes**.
169+
170+
:::image type="content" source="media/certificates/low-priority-vms-scale-target-nodes.png" alt-text="Screenshot that shows how to scale target nodes.":::
171+
172+
3. For an existing pool, select the pool, and then select **Scale** to update the number of Spot nodes required.
173+
4. Select **Save**.
174+
175+
### Autoscale with Spot VMs
176+
177+
Besides setting target VM counts directly, you may optionally define an autoscale formula for your pool. The pool autoscale formula supports Spot VMs as follows:
140178

141179
- You can get or set the value of the service-defined variable `$TargetLowPriorityNodes`.
142180
- You can get the value of the service-defined variable `$CurrentLowPriorityNodes`.
143181
- You can get the value of the service-defined variable `$PreemptedNodeCount`. This variable returns the number of nodes in the preempted state and allows you to scale up or down the number of dedicated nodes, depending on the number of preempted nodes that are unavailable.
144182

183+
For more information, see the [Batch Autoscale Guide](batch-automatic-scaling.md).
184+
145185
## Configure jobs and tasks
146186

147187
Jobs and tasks may require some extra configuration for Spot nodes:
@@ -166,12 +206,11 @@ To view these metrics in the Azure portal:
166206
## Limitations
167207

168208
- Spot VMs in Batch don't support setting a max price and don't support price-based evictions. They can only be evicted for capacity reasons.
169-
- Spot VMs are only available for Virtual Machine Configuration pools and not for Cloud Service Configuration pools, which are [deprecated](https://azure.microsoft.com/updates/azure-batch-cloudserviceconfiguration-pools-will-be-retired-on-29-february-2024/).
170209
- Spot VMs aren't available for some clouds, VM sizes, and subscription offer types. See more about [Spot VM limitations](/azure/virtual-machines/spot-vms#limitations).
171210
- Currently, [ephemeral OS disks](create-pool-ephemeral-os-disk.md) aren't supported with Spot VMs due to the service-managed eviction policy of *Stop-Deallocate*.
172211

173212
## Next steps
174213

175214
- Learn about the [Batch service workflow and primary resources](batch-service-workflow-features.md) such as pools, nodes, jobs, and tasks.
176215
- Learn about the [Batch APIs and tools](batch-apis-tools.md) available for building Batch solutions.
177-
- Start to plan the move from low-priority VMs to Spot VMs. If you use low-priority VMs with *Cloud Services Configuration* pools (which are [deprecated](https://azure.microsoft.com/updates/azure-batch-cloudserviceconfiguration-pools-will-be-retired-on-29-february-2024)), plan to migrate to [Virtual Machine Configuration pools](nodes-and-pools.md#configurations) instead.
216+
- For more information about Spot VMs in Azure, including how to view historical pricing and eviction rates, see [Spot Virtual Machines](/azure/virtual-machines/spot-vms).

0 commit comments

Comments
 (0)