This document explains how to view the preemption rate and pricing for Spot VMs.
Before you create Spot VMs, you can view the historical and current preemption rates and pricing for the machine type that you want your Spot VMs to use. Viewing this data helps you compare the stability and cost of different machine types and locations to find the best fit for your workload and budget.
If you want to view real-time data about Spot VMs, then see the following instead:
To view the current cost of Spot VMs, see Spot VMs pricing.
To view if capacity is available in the zone where you want to create Spot VMs, see View the availability of Spot VMs.
Limitations
You can't view the preemption rate and pricing trend for N1 machine types that have GPUs attached, custom machine types, or TPUs.
Understand preemption rate and pricing for Spot VMs
When you send a request to the advice.capacityHistory API, the output shows
the following metrics. By understanding these metrics, you can view and compare
the preemption rate trend and pricing trend across machine types and zones, and
then use this data to inform your decisions when you create
Spot VMs.
Historical preemption rate
The historical preemption rate (preemptionHistory) shows the daily preemption
rates for your specified machine type and zone over the past 30 days.
Compute Engine sets the data boundaries for this rate at midnight Pacific Time
(PT). The preemption rate for the current day might change throughout the day.
Compute Engine calculates the preemption rate by dividing the number of Spot VMs preempted in a day across Cloud de Confiance by S3NS by the number of Spot VMs that stopped running that same day, as shown in the following formula. These stops include when users or programmatic actions (such as limited runtimes) suspend, stop, or delete Spot VMs, or when Compute Engine preempts them.
The preemption rate ranges from 0.00 to 1.00. For example, a rate of 0.50
indicates that, among the Spot VMs with a specific machine type
and in a specific zone that stopped running that day across Cloud de Confiance,
Compute Engine preempted 50% of them.
Historical pricing
The historical pricing (priceHistory) shows the price changes in USD for
your specified machine type and region over the past year. Each entry
indicates the hourly price for the time interval when that price was active.
Compute Engine sets price changes at midnight (00:00 AM) PT. If data is
unavailable, then the time intervals have gaps.
Before you begin
- The
advice.capacityHistoryAPI includes AI zones by default in its output. To help ensure that you can create Spot VMs in AI zones if the API recommends that you create VMs in one of these zones, verify that AI zones are enabled for your project. -
If you haven't already, set up authentication.
Authentication verifies your identity for access to Cloud de Confiance by S3NS services and APIs. To run
code or samples from a local development environment, you can authenticate to
Compute Engine by selecting one of the following options:
Select the tab for how you plan to use the samples on this page:
gcloud
-
Install the Google Cloud CLI, and then sign in to the gcloud CLI with your federated identity. After signing in, initialize the Google Cloud CLI by running the following command:
gcloud init - Set a default region and zone.
REST
To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
Install the Google Cloud CLI, and then sign in to the gcloud CLI with your federated identity.
For more information, see Authenticate for using REST in the Cloud de Confiance authentication documentation.
-
Required roles
To get the permissions that
you need to view the preemption rate and pricing of Spot VMs,
ask your administrator to grant you the
Compute Viewer (roles/compute.viewer) IAM role on the project.
For more information about granting roles, see Manage access to projects, folders, and organizations.
This predefined role contains the permissions required to view the preemption rate and pricing of Spot VMs. To see the exact permissions that are required, expand the Required permissions section:
Required permissions
The following permissions are required to view the preemption rate and pricing of Spot VMs:
-
To view the preemption rate and pricing of Spot VMs:
compute.advice.capacityHistoryon the project
You might also be able to get these permissions with custom roles or other predefined roles.
View the preemption rate and pricing for Spot VMs
To view the historical preemption rate and pricing for Spot VMs, you must specify the machine type, and the region or zone, where you want to create VMs. Based on the results, you can either create the Spot VMs, or view the preemption rate and pricing in another location or for a different machine.
To view the preemption rate and pricing for Spot VMs, select one of the following options:
gcloud
To view the preemption rate and pricing for Spot VMs, use the
gcloud beta compute advice capacity-history command.
Based on your use case, include the following flags:
To view preemption rate and pricing in a region, include the
--types=PREEMPTION,PRICEand--regionflags:gcloud beta compute advice capacity-history \ --provisioning-model=SPOT \ --machine-type=MACHINE_TYPE \ --types=PREEMPTION,PRICE \ --region=REGIONTo view preemption rate in a zone, include the
--types=PREEMPTIONand--zoneflags:gcloud beta compute advice capacity-history \ --provisioning-model=SPOT \ --machine-type=MACHINE_TYPE \ --types=PREEMPTION \ --zone=ZONE
Replace the following:
MACHINE_TYPE: the machine type that you want your Spot VMs to use.REGION: the region where you want to create Spot VMs.ZONE: the zone where you want to create Spot VMs.
The output is similar to the following:
location: https://compute.s3nsapis.fr/compute/beta/projects/example-project/zones/us-central1-a
machineType: n2-standard-32
preemptionHistory:
- interval:
endTime: "2026-04-21T07:00:00Z"
startTime: "2026-04-20T07:00:00Z"
preemptionRate: 0.52
- interval:
endTime: "2026-04-22T07:00:00Z"
startTime: "2026-04-21T07:00:00Z"
preemptionRate: 0.64
...
priceHistory:
- interval:
endTime: "2026-05-11T07:00:00Z"
startTime: "2026-04-27T07:00:00Z"
listPrice:
currencyCode: "USD"
nanos: "478720000"
- interval:
endTime: "2026-05-12T07:00:00Z"
startTime: "2026-05-11T07:00:00Z"
listPrice:
currencyCode: "USD"
nanos: "502720000"
...
REST
To view the preemption rate and pricing for Spot VMs, make a
POST request to the
beta advice.capacityHistory method.
Based on your use case, make one of the following requests:
To view preemption rate and pricing in a region, make the following request:
POST https://compute.s3nsapis.fr/compute/beta/projects/PROJECT_ID/regions/REGION/advice/capacityHistory { "types": [ "PREEMPTION", "PRICE" ], "instanceProperties": { "scheduling": { "provisioningModel": "SPOT" }, "machineType": "MACHINE_TYPE" } }To view preemption rate in a zone, make the following request:
POST https://compute.s3nsapis.fr/compute/beta/projects/PROJECT_ID/regions/REGION/advice/capacityHistory { "types": [ "PREEMPTION" ], "instanceProperties": { "scheduling": { "provisioningModel": "SPOT" }, "machineType": "MACHINE_TYPE" }, "locationPolicy": { "location": "zones/ZONE" } }
Replace the following:
PROJECT_ID: the ID of your project.REGION: the region where you want to create Spot VMs.MACHINE_TYPE: the machine type that you want your Spot VMs to use.ZONE: the zone, which must be withinREGION, where you want to create Spot VMs.
The output is similar to the following:
{
"machineType": "n2-standard-32",
"location": "https://compute.s3nsapis.fr/compute/beta/projects/example-project/regions/us-central1",
"preemptionHistory": [
{
"interval": {
"startTime": "2026-04-20T07:00:00Z",
"endTime": "2026-04-21T07:00:00Z"
},
"preemptionRate": 0.52
},
{
"interval": {
"startTime": "2026-04-21T07:00:00Z",
"endTime": "2026-04-22T07:00:00Z"
},
"preemptionRate": 0.64
},
...
],
"priceHistory": [
{
"interval": {
"startTime": "2026-04-27T07:00:00Z",
"endTime": "2026-05-11T07:00:00Z"
},
"listPrice": {
"currencyCode": "USD",
"nanos": "478720000"
}
},
{
"interval": {
"startTime": "2026-05-11T07:00:00Z",
"endTime": "2026-05-12T07:00:00Z"
},
"listPrice": {
"currencyCode": "USD",
"nanos": "502720000"
}
},
...
]
}
What's next
Learn how to create and use Spot VMs.
Learn more about the best practices for Spot VMs.