Skip to content

Commit c780a0b

Browse files
author
Julia Shimanskiy
committed
Spot - ARG - pricing history and eviction rate
1 parent 4eca576 commit c780a0b

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

articles/virtual-machines/spot-vms.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ With variable pricing, you have option to set a max price, in US dollars (USD),
7272

7373
## Pricing and eviction history
7474

75+
### Portal
76+
7577
You can see historical pricing and eviction rates per size in a region in the portal. Select **View pricing history and compare prices in nearby regions** to see a table or graph of pricing for a specific size. The pricing and eviction rates in the following images are only examples.
7678

7779
**Chart**:
@@ -82,7 +84,42 @@ You can see historical pricing and eviction rates per size in a region in the po
8284

8385
:::image type="content" source="./media/spot-table.png" alt-text="Screenshot of the region options with the difference in pricing and eviction rates as a table.":::
8486

87+
### Azure Resource Graph
88+
89+
You can programmatically access relevant Spot VM SKU data through [Azure Resource Graph](/azure/governance/resource-graph/overview). Get pricing history in the last 90 days and eviction rates for the last 28 trailing days to identify SKUs that better meet your specific needs.
90+
91+
Key benefits:
92+
- Query Spot eviction rates and the last few months of Spot prices programmatically through ARM or the [ARG Explorer in Azure portal](/azure/governance/resource-graph/first-query-portal)
93+
- Create a custom query to extract the specific data relevant to your scenario with the ability to filter across a variety of parameters, such as SKU and region 
94+
- Easily compare data across multiple regions and SKUs 
95+
- Find a different Spot SKU or region with a lower price and/or eviction rate 
96+
97+
Try out the following sample queries for Spot pricing history and eviction rates using the [ARG Explorer in Azure portal](/azure/governance/resource-graph/first-query-portal). Spot pricing history and eviction rates data is available in the `SpotResources` table. 
98+
99+
**Spot pricing history sample query**:
100+
101+
```sql
102+
SpotResources
103+
| where type =~ 'microsoft.compute/skuspotpricehistory/ostype/location'
104+
| wheresku.namein~ ('standard_d2s_v4', 'standard_d4s_v4')
105+
| whereproperties.osType=~ 'linux'
106+
| where location in~ ('eastus', 'southcentralus')
107+
| project skuName = tostring(sku.name), osType = tostring(properties.osType), location, latestSpotPriceUSD = todouble(properties.spotPrices[0].priceUSD)
108+
| order by latestSpotPriceUSD asc
109+
```
110+
111+
**Spot eviction rates sample query**:
112+
113+
```sql
114+
SpotResources
115+
| where type =~ 'microsoft.compute/skuspotevictionrate/location'
116+
| wheresku.namein~ ('standard_d2s_v4', 'standard_d4s_v4')
117+
| where location in~ ('eastus', 'southcentralus')
118+
| project skuName = tostring(sku.name), location, spotEvictionRate = tostring(properties.evictionRate)
119+
| order by skuName asc, location asc
120+
```
85121

122+
Alternatively, try out the [ARG REST API](/rest/api/azure-resourcegraph/) to get the pricing history and eviction rate history data.
86123

87124
## Frequently asked questions
88125

0 commit comments

Comments
 (0)