Proposed Pull Request Change

title description author ms.author ms.service ms.subservice ms.topic ms.date ms.update-cycle ms.custom ms.reviewer
Spot Placement Score Learn how to use Azure Spot Placement Score to evaluate deployment success. cynthn cynthn azure-virtual-machines azure-spot-vm how-to 11/13/2024 180-days portal cynthn
📄 Document Links
GitHub View on GitHub Microsoft Learn View on Microsoft Learn
Content Truncation Detected
The generated rewrite appears to be incomplete.
Original lines: -
Output lines: -
Ratio: -
Raw New Markdown
Generating updated version of doc...
Rendered New Markdown
Generating updated version of doc...
+0 -0
+0 -0
--- title: Spot Placement Score description: Learn how to use Azure Spot Placement Score to evaluate deployment success. author: cynthn ms.author: cynthn ms.service: azure-virtual-machines ms.subservice: azure-spot-vm ms.topic: how-to ms.date: 11/13/2024 ms.update-cycle: 180-days ms.custom: portal ms.reviewer: cynthn # Customer intent: As a cloud architect, I want to evaluate the Spot Placement Score for my virtual machine deployments so that I can optimize resource allocation and improve the likelihood of successful Spot VM deployments across regions and sizes. --- # Spot Placement Score 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 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. Using Spot Placement Score, you can achieve the following: - A clear evaluation of how likely your Spot deployment is to succeed based on specified parameters. - Identify the most suitable combination of regions and VM sizes to maximize Spot VM availability based on placement scores. - 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. ## Cost There are no costs associated with this feature. ## Considerations - Spot placement scores serve purely as a recommendation based on certain data points like Spot VM availability. A high placement score doesn't guarantee that the Spot request will be fully or partially fulfilled. - 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. - 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. - Spot Placement Scores don't consider other constraints, such as Virtual Machine Scale Sets `SinglePlacementGroup`. - A subscription's available Spot VM quota needs to be checked or requested separately. - Spot Placement Score supports both availability zone-scoped and regional (nonzonal) placement score. - Spot Placement Score API internally calls other GET APIs and is part of your GET call quota. - A score of **High** or **Medium** doesn't guarantee allocation success or no evictions. - This feature is available for all public Azure regions at this time. ## Configure your Spot Placement Score Configure your Spot Placement Score by defining your Spot specific requirements: - Number of desired Spot VMs - Up to five VM sizes - Up to eight regions - Availability zones 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. ### [Azure portal](#tab/portal) 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. 1. Log in to the [Azure portal](https://portal.azure.com). 1. In the search bar, search for and select **Virtual Machine Scale Sets**. 1. Select **Create** on the **Virtual Machine Scale Sets** page. 1. In the **Spot** tab, turn on the Spot option under the **Save money with Spot** section. 1. Fill out the *Size*, *Region*, *Availability Zones*, and *Initial instance count* fields in the **Your Placement Score** section. 1. Click on **Save + Apply** to receive your placement score for this configuration. ### [REST API](#tab/rest-api) Use the following REST API to get your Spot Placement Score. The Placement Score API supports the following version: *2025-06-05*. 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). ``` POST https://management.azure.com/subscriptions/{subscription}/providers/Microsoft.Compute/locations/{region}/placementScores/spot/generate?api-version={api-version} ``` ```json { "desiredLocations": [""], "desiredSizes": [{ "sku": "" }], "desiredCount": "", "availabilityZones": "" } ``` Some important terminology to consider: **Restricted SKU** is returned if the Spot VM SKU isn't available for the subscription. **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". ### [Azure CLI 2.0](#tab/cli) Access Spot Placement Score using Azure CLI command [az compute-recommender spot-placement-recommender](/cli/azure/compute-recommender#az-compute-recommender-spot-placement-recommender). ```azurecli-interactive az compute-recommender spot-placement-recommender \ --availability-zones <> \ --desired-count <> \ --desired-locations <> \ --desired-sizes <> \ --location <> \ --subscription <> \ ``` ### [Azure PowerShell](#tab/powershell) Access the Spot Placement Score using Azure PowerShell command [Invoke-AzSpotPlacementScore](/powershell/module/az.compute/invoke-azspotplacementscore) to call the API endpoint. The placement scores can be found under the "PlacementScore" property in the response object. Replace all parameters with your specific details: ```azurepowershell-interactive Invoke-AzSpotPlacementScore -Location <String> -SubscriptionId <String> -AvailabilityZone -DesiredCount <Int32> -DesiredLocation <String[]> -DesiredSize <IResourceSize[]> ``` --- ## Examples The following examples have scenario assumptions and a table with the results score to help you understand how Spot Placement Score works. ### Scenario 1 This table is an example of a request returning regional (nonzonal) scoped placement scores for multiple desired VM sizes and regions. The following scenario assumptions apply to this example: - **Desired locations:** `westus`, `eastus` - **Desired sizes:** `Standard_D2_v2`, `Standard_D4_v2` - **Desired count:** 100 - **Availability zones:** False | SKU | Region | Availability zone | Is quota available? | Placement score | |-----------------------------------|-------------|---------------------|--------------------|-------------------| | Standard_D2_v2 | westus | False | True | High | | Standard_D4_v2 | westus | False | True | Low | | Standard_D2_v2 | eastus | False | True | Medium | | Standard_D4_v2 | eastus | False | True | High | ### Scenario 2 This table is an example of a request returning availability zone-scoped placement scores for multiple desired VM sizes and regions. The following scenario assumptions apply to this example: - **Desired locations:** `westus`, `eastus` - **Desired sizes:** `Standard_D2_v2`, `Standard_D4_v2` - **Desired count:** 100 - **Availability zones:** True | SKU | Region | Availability zone | Is quota available? | Placement score | |-----------------------------------|-------------|---------------------|--------------------|-------------------| | Standard_D2_v2 | westus | 1 | True | Medium | | Standard_D2_v2 | westus | 2 | True | Medium | | Standard_D2_v2 | westus | 3 | True | Medium | | Standard_D4_v2 | westus | 1 | True | High | | Standard_D4_v2 | westus | 2 | True | High | | Standard_D4_v2 | westus | 3 | True | High | | Standard_D2_v2 | eastus | 1 | True | Low | | Standard_D2_v2 | eastus | 2 | True | Low | | Standard_D2_v2 | eastus | 3 | True | Low | | Standard_D4_v2 | eastus | 1 | True | Medium | | Standard_D4_v2 | eastus | 2 | True | Medium | | Standard_D4_v2 | eastus | 3 | True | Medium | ## Troubleshooting | Status code | Type | Condition | |-----------------------------------|-------------|---------------------|--------------------| | 200 | Successful request | Spot Placement Score operations complete successfully. | | 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. | | 429 | Too many requests | Unable to generate placement score due to hitting a rate limit. | | 500 | Internal server error | The placement score generation failed. Produces a detailed error message about the failed request. | ## Next steps > [!div class="nextstepaction"] > [Learn about Spot Priority Mix](../virtual-machine-scale-sets/spot-priority-mix.md)
Success! Branch created successfully. Create Pull Request on GitHub
Error: