How to get list of virtual machine sizes which supports spot instace ?

Prajyot Halingale 0 Reputation points
2023-05-02T04:22:51.5533333+00:00

Hi all,

I am trying to get a list of virtual machine sizes which supports Azure spot instances in a given location.

I have tried below API :

GET https://management.azure.com/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/._../vmSizes?api-version=2023-03-01

result of the above API was :

 {
      "name": "Standard_B1ls",
      "numberOfCores": 1,
      "osDiskSizeInMB": 1047552,
      "resourceDiskSizeInMB": 4096,
      "memoryInMB": 512,
      "maxDataDiskCount": 2
    }

I cannot see a tag for the spot instance in the above response. Can you please help me with this?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,787 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Luke Murray 11,076 Reputation points MVP
    2023-05-02T20:57:12.44+00:00

    Hi, Prajyot

    Check out Azure Price - https://azureprice.net/?tier=spot

    You can adjust the VM sizes to include spot compatible VMs.

    0 comments No comments

  2. Aammir M B 0 Reputation points
    2023-09-01T11:46:04.3633333+00:00

    You can run below Resource Graph Query
    Below query extract all D services VMs supporting SPOT for European region.

    SpotResources 
    | where type =~ 'microsoft.compute/skuspotpricehistory/ostype/location' 
    | where sku.name matches regex @'(?i)Standard+_(?i)D[0-9]+_v[0-9]'
    | where properties.osType in~ ('linux','windows')
    | where location in~ ('westeurope', 'norteurope') 
    | project skuName = tostring(sku.name), osType = tostring(properties.osType), location, latestSpotPriceUSD = todouble(properties.spotPrices[0].priceUSD)
    | order by latestSpotPriceUSD asc
    
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.