Specifying a minimum CPU platform for VM instances


This page explains how to create or update a virtual machine (VM) instance to use a minimum CPU platform instead of the default platform. Google data centers offer different generations of CPU processors, which determine the minimum CPU platform.

Specifying a minimum CPU platform is useful if your workload requires the performance gains offered by the generation of a specific processor. However, specifying a minimum CPU platform might limit the zones where you can create your VMs.

Each CPU platform supports incremental features like Advanced Vector Extensions—for example, AVX2 and AVX-512. Some fundamental systems-related features like clock speed and memory access seek time can vary among CPU platforms.

Before you begin

When to select a minimum CPU platform

More than likely, you don't need to select a minimum CPU platform. Each Compute Engine zone has a default CPU platform that Google occasionally retires or updates. If you create a VM without a minimum CPU specification, the VM gets the default CPU platform.

Google recommends that you only select a minimum CPU platform if it offers significant performance gains for your workload, or if it provides capabilities such as AVX2 or AVX-512 that your code utilizes. Selecting a minimum CPU platform for your VM introduces constraints that affect your ability to start VMs in zones where some CPU platforms are in limited supply.

How selecting a minimum CPU platform works

When you specify a minimum CPU platform, consider the following:

  • Compute Engine always uses the minimum CPU platform where available.
  • If Google retires or updates a CPU platform in a zone, your VM can continue to run on a more recent CPU platform that's available in that zone if you stop and restart the VM. Retiring CPU platforms occurs infrequently. Google notifies you before it retires or updates a CPU platform.

After you select a minimum CPU platform for a VM, the following behavior occurs:

  • Your VM uses this CPU platform unless you stop the VM and change the CPU platform.
  • During a live migration, your VM retains the selected CPU platform.

Retiring or upgrading a default CPU platform

Occasionally, Google retires a CPU platform or updates the default CPU platform in a particular zone. The following reasons apply:

  • A zone grows in capacity over time and proactively switches to a newer CPU platform as the platform becomes available.
  • Every 3-5 years, Google replaces older CPU platforms with newer platforms, and it updates the default CPU platform to the next newest platform that's available in that zone.

At any time, when a new region or zone is built, it uses the newest CPU platform.

When a zone is retired or a default CPU platform for a zone changes, Google notifies affected customers with a detailed timeline and specific instructions to transition to the newer platform.

VMs never use a platform that's older than the minimum CPU platform that you specify. If Compute Engine transitions your VM to a more recent platform, the cost of the VM doesn't change.

Limitations

  • Different regions and zones support multiple CPU processors.
  • You cannot select a minimum CPU platform for predefined or custom E2 VMs.
  • You cannot select a minimum CPU platform for the following shared-core, general-purpose VMs:
    • e2-micro
    • e2-small
    • e2-medium
    • f1-micro
    • g1-small

Availability of CPU platforms

The availability of CPU platforms varies across zones and is based on the hardware and machine family that is available in each zone. The following list shows the supported minimum CPU platforms and the valid syntax for each platform:

  • 3rd Generation: Intel Xeon (Ice Lake) processors: "Intel Ice Lake"
  • 2nd Generation: Intel Xeon (Cascade Lake) processors: "Intel Cascade Lake"
  • 1st Generation: Intel Xeon (Skylake) processors: "Intel Skylake"
  • Intel Xeon E5 v4 (Broadwell) processors: "Intel Broadwell"
  • Intel Xeon E5 v3 (Haswell) processors: "Intel Haswell"
  • Intel Xeon E5 (Sandy Bridge) processors: "Intel Sandy Bridge"
  • AMD EPYC Rome processors: "AMD Rome"
  • AMD EPYC Milan processors: "AMD Milan"

Consider the following:

  • Only certain zones contain multiple CPU platforms and are available for minimum CPU platform selection. You can view a list of supported platforms for a specific zone by using the gcloud compute zones describe command or by making a request to the API.
  • If you're using sole-tenant nodes, each node uses the CPU platform corresponding to the node type that you defined in the node template. As a result, you cannot specify a minimum CPU platform for VMs that use sole-tenant nodes.

gcloud

  • To view the CPU platforms that are available in your zone, use the gcloud compute zones describe command:

    gcloud compute zones describe ZONE
    

    Replace ZONE with the name of the zone to check for available CPU platforms—for example, us-west1-a.

    The following output from this command lists CPU platforms for the us-west1-a zone:

    gcloud compute zones describe us-west1-a
    availableCpuPlatforms:
    - Intel Skylake
    - Intel Broadwell
    ...
    

API

  • In the Compute Engine API, make a GET request to the zone that you're considering:

    GET https://compute.googleapis.com/compute/v1/projects/myproject/zones/ZONE
    

    Replace ZONE with the name of the zone to check for available CPU platforms.

    The following output from this command lists supported CPU platforms for a zone:

    {
      "kind": "compute#zone",
      "id": "2210",
      "creationTimestamp": "2016-06-10T09:30:55.189-07:00",
      "name": "us-west1-a",
      "description": "us-west1-a",
      "status": "UP",
      "region": "https://www.googleapis.com/compute/v1/projects/myproject/regions/us-west1",
      "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/zones/us-west1-a",
      "availableCpuPlatforms": [
       "Intel Broadwell",
       "Intel Haswell"
      ]
     }

Selecting a minimum CPU platform for a new VM

You can specify a minimum CPU platform during instance creation.

Console

  1. In the Google Cloud console, go to the Create an instance page.

    Go to Create an instance

  2. In the Machine configuration section, expand the CPU platform and GPU section, and then do the following:

    1. In the CPU Platform list, select a platform for the VM's CPU.
  3. Continue with the rest of the VM creation process.

gcloud

  • To create a new VM that uses a minimum CPU platform, use the gcloud compute instances create command and provide the --min-cpu-platform flag:

    gcloud compute instances create INSTANCE \
        --zone=ZONE \
        --min-cpu-platform="PLATFORM"

    Replace the following:

    • INSTANCE: the name of the instance that you want to create
    • ZONE: the name of the zone where you want to create your instance—for example, europe-west1-b
    • PLATFORM: the friendly name of the minimum CPU platform that you want the instance to use—for example, Intel Sandy Bridge

      If you want to clear the minimum CPU platform specification, replace PLATFORM with AUTOMATIC.

      Use the available zones section to determine which platforms are available for each zone.

API

  • In the Compute Engine API, include the minCpuPlatform property as part of the request body.

    For example, a request body might look like this:

    "name": "INSTANCE",
    "machineType": "zones/ZONE/machineTypes/MACHINE_TYPE",
    "minCpuPlatform": "PLATFORM",
    "networkInterfaces": [{
      "accessConfigs": [{
        "type": "ONE_TO_ONE_NAT",
        "name": "External NAT"
       }],
      "network": "global/networks/default"
    }],
    "disks": [{
       "autoDelete": "true",
       "boot": "true",
       "type": "PERSISTENT",
       "initializeParams": {
          "sourceImage": "projects/IMAGE_PROJECT/global/images/family/IMAGE_FAMILY"
       }
     }]

    Replace the following:

    • INSTANCE: the name of the new instance
    • ZONE: the name of the zone where you want to create your VM—for example, europe-west1-b
    • MACHINE_TYPE: the machine type of the new VM
    • PLATFORM: the friendly name of the minimum CPU platform that you want the instance to use—for example, Intel Ivy Bridge

      If you want to clear the minimum CPU platform specification, replace PLATFORM with AUTOMATIC.

    • IMAGE_PROJECT: the image project of the image family

    • IMAGE_FAMILY: the image family of the image to use to create the VM

Setting a minimum CPU platform for an existing VM

You can set a minimum CPU platform for an existing instance. You first stop the instance, and then you set the minimum CPU platform.

Console

  1. Go to the VM instances page.

    Go to VM instances

  2. If prompted, select your project and click Continue.

  3. Select the VM that you want to change.

  4. Click Stop.

  5. To edit the instance, click Edit.

  6. In the Machine configuration section, click CPU platform and GPU.

  7. From the CPU Platform drop-down menu, select an option.

  8. Save your changes.

  9. Select the VM that you changed.

  10. Click Start/Resume.

gcloud

  1. To stop a VM, use the gcloud compute instances stop command:

    gcloud compute instances stop INSTANCE
    

    Replace INSTANCE with the name of the instance that you want to specify a minimum CPU platform for.

  2. To specify a minimum CPU platform, use the gcloud compute instances update command, and provide the --min-cpu-platform flag:

    gcloud compute instances update INSTANCE \
        --min-cpu-platform="PLATFORM"

    Replace PLATFORM with the friendly name of the minimum CPU platform that you want the instance to use—for example, Intel Cascade Lake.

  3. To start the updated VM, use the gcloud compute instances start command:

    gcloud compute instances start INSTANCE
    

API

  1. To stop a VM, construct a POST request using the instances.stop method:

    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE/stop
    

    Replace the following:

    • PROJECT_ID: the ID of the project
    • ZONE: the zone where your VM is located
    • INSTANCE: the name of the instance that you want to specify a minimum CPU platform for
  2. To set the minimum CPU platform in the API, make a POST request to the setMinCpuPlatform method and set the minCpuPlatform property in the request body:

    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE/setMinCpuPlatform
    {
      "minCpuPlatform": PLATFORM
    }
    

    Replace PLATFORM with the friendly name of the minimum CPU platform that you want the instance to use—for example, Intel Skylake.

  3. To restart the VM, construct a POST request using the instances.start method:

    POST https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE/start
    

Removing a minimum CPU platform setting

You can update an instance to use the default CPU platform instead of the minimum CPU platform. If the instance is running, you must stop it before you make changes.

Console

  1. Go to the VM instances page.

    Go to VM instances

  2. If prompted, select your project and click Continue.

  3. Select the VM that you want to change.

  4. Click Stop.

  5. To edit the instance, click Edit.

  6. In the Machine configuration section, click CPU platform and GPU.

  7. Change the CPU Platform option to Automatic.

  8. Select the VM that you changed.

  9. Click Start/Resume.

gcloud

  1. To stop a VM, use the gcloud compute instances stop command:

    gcloud compute instances stop INSTANCE
    

    Replace INSTANCE with the name of the instance that you want to change.

  2. To reset the minimum CPU platform, use the gcloud compute instances update command and set the --min-cpu-platform flag to AUTOMATIC:

    gcloud compute instances update INSTANCE \
        --min-cpu-platform="AUTOMATIC"
    
  3. To start the updated VM, use the gcloud compute instances start command:

    gcloud compute instances start INSTANCE
    

API

  1. To stop a VM, construct a POST request using the instances.stop method:

    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE/stop
    

    Replace the following:

    • PROJECT_ID: the ID of the project
    • ZONE: the zone where your VM is located
    • INSTANCE: the name of the instance that you want to change
  2. To reset the minimum CPU platform, make a POST request to the setMinCpuPlatform method. In the request body, set the minCpuPlatform property value to AUTOMATIC.

    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE/setMinCpuPlatform
    {
      "minCpuPlatform": AUTOMATIC
    }
    
  3. To start the updated VM, use the gcloud compute instances start command:

    gcloud compute instances start INSTANCE
    

Specifying a minimum CPU platform in instance templates

If you use managed instance groups, you can specify a minimum CPU platform for VM instances within a managed instance group.

To specify a minimum CPU platform, create an instance template that includes the minCpuPlatform property.

Console

  1. Go to the Instance templates page.

    Go to Instance templates

  2. If prompted, select your project and click Continue.

  3. Click Create instance template.

  4. In the Machine configuration section, click CPU platform and GPU.

  5. From the CPU Platform drop-down menu, select an option.

  6. Continue with the instance template creation process.

gcloud

  • When you create an instance template using the gcloud compute instance-templates create command, provide the --min-cpu-platform flag:

    gcloud compute instance-templates create TEMPLATE_NAME \
        --min-cpu-platform="PLATFORM"

    Replace the following:

    • TEMPLATE_NAME: the name of the instance template
    • PLATFORM: the friendly name of the minimum CPU platform that you want the instance to use—for example, Intel Skylake

API

  • In the API, add the minCpuPlatform as part of your request to create a new instance template in the Compute Engine API.

    For example, the following instance template contains the minimum required fields for creating a new template with the addition of the minCpuPlatform property:

    {
    "name": "example-template",
    "properties": {
      "machineType": "zones/us-central1-a/machineTypes/n1-standard-2",
      "minCpuPlatform": "Intel Haswell",
      "networkInterfaces": [
        {
          "network": "global/networks/default",
          "accessConfigs":
          [
            {
              "type": "PERSISTENT",
              "boot": true,
              "mode": "READ_WRITE",
              "initializeParams":
              {
                "sourceImage": "projects/debian-cloud/global/images/family/debian-10"
              }
            }
          ]
        }
      ],
      "disks":
      [
        {
          "type": "PERSISTENT",
          "boot": true,
          "mode": "READ_WRITE",
          "initializeParams":
          {
            "sourceImage": "projects/debian-cloud/global/images/family/debian-10"
          }
        }
      ]
      }
    }

What's next