View the preemption rate and pricing for Spot VMs

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:

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.

$${preemptionHistory}=\frac{\text{Total preempted Spot VMs in a day}}{\text{Total Spot VMs that stopped running in a day}}$$

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

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.capacityHistory on 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,PRICE and --region flags:

    gcloud beta compute advice capacity-history \
        --provisioning-model=SPOT \
        --machine-type=MACHINE_TYPE \
        --types=PREEMPTION,PRICE \
        --region=REGION
    
  • To view preemption rate in a zone, include the --types=PREEMPTION and --zone flags:

    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 within REGION, 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