Skip to content

Commit 6f607f7

Browse files
authored
Merge pull request #283601 from am4234m/patch-3
Update spot-vms.md
2 parents be3e710 + 09bda91 commit 6f607f7

File tree

3 files changed

+193
-3
lines changed

3 files changed

+193
-3
lines changed

articles/virtual-machines/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,8 @@
10111011
href: ./linux/spot-template.md
10121012
- name: Spot Priority Mix
10131013
href: /azure/virtual-machine-scale-sets/spot-priority-mix?toc=/azure/virtual-machines/toc.json
1014+
- name: Spot Placement Score (Preview)
1015+
href: /azure/virtual-machines/spot-placement-score.md
10141016
- name: VM size recommendation
10151017
href: /azure/virtual-machine-scale-sets/spot-vm-size-recommendation?toc=/azure/virtual-machines/toc.json
10161018
- name: Error codes
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
---
2+
title: Spot Placement Score (Preview)
3+
description: Learn how to use Azure Spot Placement Score to evaluate deployment success.
4+
author: am4234m
5+
ms.author: aparnamishra
6+
ms.service: azure-virtual-machines
7+
ms.subservice: azure-spot-vm
8+
ms.topic: how-to
9+
ms.date: 08/11/2024
10+
ms.reviewer: ju-shim
11+
---
12+
13+
14+
# Spot Placement Score (Preview)
15+
16+
> [!IMPORTANT]
17+
> The Spot Placement Score feature is currently in PREVIEW. See the [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/) for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability.
18+
19+
Spot Placement Score evaluates the likelihood of success for individual Spot deployments by considering parameters like desired Spot Virtual Machine (VM) count, VM size, and your deployment region or zone. This feature enables you to generate a placement score to deploy a desired number of Spot Virtual Machines (VMs) across various combinations of regions, zones, and VM sizes. By inputting lists of up to eight regions and five VM sizes, you can obtain placement scores categorized as either High, Medium, or Low. A score of High indicates that the deployment is highly likely to succeed while a score of Low indicates that the deployment has a low chance of success. These scores are based on analyses of Spot capacity allocation probability and the survivability of the specified number of Spot VMs within each region and VM size combination. This functionality enhances deployment planning by providing predictive insights into deployment success and optimizing resource allocation for your Spot VMs.
20+
21+
Using Spot Placement Score, you can achieve the following:
22+
23+
- A clear evaluation of how likely your Spot deployment is to succeed based on specified parameters.
24+
25+
- Identify the most suitable combination of regions and VM sizes to maximize Spot VM availability and survivability based on placement scores.
26+
27+
- Improve the overall success rate of deploying Spot VMs by applying data-driven placement scores, reducing the risk of capacity issues or failures during deployment.
28+
29+
## Cost
30+
31+
There are no costs associated with this feature.
32+
33+
## Considerations
34+
35+
- Spot placement scores serve purely as a recommendation based on certain data points like eviction rate and VM availability. A high placement score doesn't guarantee that the Spot request will be fully or partially fulfilled.
36+
37+
- Placement Scores are only valid at the time when it's requested. The same Placement Score isn't valid at a different time of the same day or another day. Any similarities are purely coincidental.
38+
39+
- The Spot Placement Score is only relevant if the Spot request has the same configuration as the Spot Placement Score configuration; desired count, VM size, location, and zone. In all other circumstances, the likelihood of getting available Spot capacity won't align with the placement score generated by the tool.
40+
41+
- Spot Placement Scores don't consider other constraints, such as Virtual Machine Scale Sets `SinglePlacementGroup`.
42+
43+
- A subscription's available Spot VM quota needs to be checked or requested separately.
44+
45+
- Spot Placement Score supports both regionally and zonally scoped placement score.
46+
47+
- Spot Placement Score API internally calls other GET APIs and is part of your GET call quota.
48+
49+
- A score of **High** or **Medium** doesn't guarantee allocation success or no evictions.
50+
51+
52+
## Configure your Spot Placement Score
53+
Configure your Spot Placement Score by defining your Spot specific requirements:
54+
- Number of desired Spot VMs
55+
- Up to five VM sizes
56+
- Up to eight regions
57+
- Availability zones
58+
59+
We recommend that the placement scores for each combination of subscription, desired count, region, zone, and VM size are cached, to avoid calling the API with the same configuration frequently within a short period of time. The suggested cache TTL is a minimum of 15 minutes and a maximum of 30 minutes.
60+
61+
### [Azure portal](#tab/portal)
62+
63+
Find the Spot Placement Score in the Spot tab of the Virtual Machine Scale Sets creation process in the Azure portal. The following steps instruct you on how to access this feature during that process.
64+
65+
1. Log in to the [Azure portal](https://portal.azure.com).
66+
67+
1. In the search bar, search for and select **Virtual Machine Scale Sets**.
68+
69+
1. Select **Create** on the **Virtual Machine Scale Sets** page.
70+
71+
1. In the **Spot** tab, turn on the Spot option under the **Save money with Spot** section.
72+
73+
1. Fill out the *Size*, *Region*, *Availability Zones*, and *Initial instance count* fields in the **Your Placement Score** section.
74+
75+
1. Click on **Save + Apply** to receive your placement score for this configuration.
76+
77+
### [REST API](#tab/rest-api)
78+
79+
Use the following REST API to get your Spot Placement Score. The Placement Score API supports the following versions: *2024-03-01-preview* and *2024-06-01-preview*. You need to add the Role-Based Access Control (RBAC) role "Compute Recommendations Role" and select the members to enable the subscription they want to run the API on (/azure/role-based-access-control/role-assignments-portal).
80+
81+
```
82+
POST https://management.azure.com/subscriptions/{subscription}/providers/Microsoft.Compute/locations/{region}/placementScores/spot/generate?api-version={api-version}
83+
```
84+
85+
```json
86+
{
87+
"desiredLocations": "",
88+
"desiredSizes": [{
89+
"sku": ""
90+
}],
91+
"desiredCount": ""
92+
}
93+
```
94+
Some important terminology to consider:
95+
96+
**Restricted SKU** is returned if the Spot VM SKU isn't available for the subscription.
97+
98+
**Data Not Found** is returned when the data necessary to generate a score or recommendation is either not found in upstream databases, or is found but the data lifespan is greater than what our service considers "fresh".
99+
100+
### [Azure CLI 2.0](#tab/cli)
101+
102+
Access Spot Placement Score using Azure CLI command [az compute-recommender spot-placement-recommender](/cli/azure/compute-recommender#az-compute-recommender-spot-placement-recommender).
103+
104+
```azurecli-interactive
105+
az compute-recommender spot-placement-recommender \
106+
--availability-zones <> \
107+
--desired-count <> \
108+
--desired-locations <> \
109+
--desired-sizes <> \
110+
--ids <> \
111+
--location <> \
112+
--subscription <> \
113+
```
114+
115+
### [Azure PowerShell](#tab/powershell)
116+
117+
Access the Spot Placement Score using Azure PowerShell command [Invoke-AzSpotPlacementScore](/powershell/module/az.compute/invoke-azspotplacementscore) to call the API endpoint. Replace all parameters with your specific details:
118+
119+
```azurepowershell-interactive
120+
Invoke-AzSpotPlacementScore
121+
-Location <String>
122+
-SubscriptionId <String>
123+
-AvailabilityZone
124+
-DesiredCount <Int32>
125+
-DesiredLocation <String[]>
126+
-DesiredSize <IResourceSize[]>
127+
```
128+
129+
---
130+
131+
## Examples
132+
133+
The following examples have scenario assumptions and a table with the results score to help you understand how Spot Placement Score works.
134+
135+
### Scenario 1
136+
This table is an example of a request returning regionally scoped placement scores for multiple desired VM sizes and regions.
137+
138+
The following scenario assumptions apply to this example:
139+
- **Desired locations:** `westus`, `eastus`
140+
- **Desired sizes:** `Standard_D2_v2`, `Standard_D4_v2`
141+
- **Desired count:** 100
142+
- **Availability zones:** False
143+
144+
| SKU | Region | Availability zone | Is quota available? | Placement score |
145+
|-----------------------------------|-------------|---------------------|--------------------|-------------------|
146+
| Standard_D2_v2 | westus | False | True | High |
147+
| Standard_D4_v2 | westus | False | True | Low |
148+
| Standard_D2_v2 | eastus | False | True | Medium |
149+
| Standard_D4_v2 | eastus | False | True | High |
150+
151+
### Scenario 2
152+
This table is an example of a request returning zonally scoped placement scores for multiple desired VM sizes and regions.
153+
154+
The following scenario assumptions apply to this example:
155+
- **Desired locations:** `westus`, `eastus`
156+
- **Desired sizes:** `Standard_D2_v2`, `Standard_D4_v2`
157+
- **Desired count:** 100
158+
- **Availability zones:** True
159+
160+
| SKU | Region | Availability zone | Is quota available? | Placement score |
161+
|-----------------------------------|-------------|---------------------|--------------------|-------------------|
162+
| Standard_D2_v2 | westus | 1 | True | Medium |
163+
| Standard_D2_v2 | westus | 2 | True | Medium |
164+
| Standard_D2_v2 | westus | 3 | True | Medium |
165+
| Standard_D4_v2 | westus | 1 | True | High |
166+
| Standard_D4_v2 | westus | 2 | True | High |
167+
| Standard_D4_v2 | westus | 3 | True | High |
168+
| Standard_D2_v2 | eastus | 1 | True | Low |
169+
| Standard_D2_v2 | eastus | 2 | True | Low |
170+
| Standard_D2_v2 | eastus | 3 | True | Low |
171+
| Standard_D4_v2 | eastus | 1 | True | Medium |
172+
| Standard_D4_v2 | eastus | 2 | True | Medium |
173+
| Standard_D4_v2 | eastus | 3 | True | Medium |
174+
175+
176+
## Troubleshooting
177+
178+
| Status code | Type | Condition |
179+
|-----------------------------------|-------------|---------------------|--------------------|
180+
| 200 | Successful request | Spot Placement Score operations complete successfully. |
181+
| 400 | Bad error request | At least one required input parameter isn't present, or the values of the provided parameters aren't valid. Produces a detailed error message about the failed request. |
182+
| 429 | Too many requests | Unable to generate placement score due to hitting a rate limit. |
183+
| 500 | Internal server error | The placement score generation failed. Produces a detailed error message about the failed request. |
184+
185+
## Next steps
186+
187+
> [!div class="nextstepaction"]
188+
> [Learn about Spot Priority Mix](../virtual-machine-scale-sets/spot-priority-mix.md)

articles/virtual-machines/spot-vms.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ ms.author: jushiman
66
ms.service: azure-virtual-machines
77
ms.subservice: azure-spot-vm
88
ms.topic: how-to
9-
ms.date: 06/14/2024
10-
ms.reviewer: cynthn
9+
ms.date: 08/05/2024
10+
ms.reviewer: ju-shim
1111
---
1212

1313

@@ -79,7 +79,7 @@ With variable pricing, you have option to set a max price, in US dollars (USD),
7979
You can see historical pricing and eviction rates per size in a region in the portal while you are creating the VM. After selecting the checkbox to **Run with Azure Spot discount**, a link will appear under the size selection of the VM titled **View pricing history and compare prices in nearby regions**. By selecting that link you will be able to see a table or graph of spot pricing for the specified VM size. The pricing and eviction rates in the following images are only examples.
8080

8181
> [!TIP]
82-
> Eviction rates are quoted _per hour_. For example, an eviction rate of 10% means a VM has a 10% chance of being evicted within the next hour, based on historical eviction data of the last 28 days.
82+
> Eviction rates are quoted _per hour_. For example, an eviction rate of 10% means a VM has a 10% chance of being evicted within the next hour, based on historical eviction data of the last 7 days.
8383
8484
**Chart**:
8585

0 commit comments

Comments
 (0)