This document explains how to create or update a virtual machine (VM) instance
to use a baseline minimum CPU platform (minCpuPlatform
) whenever available.
Google data centers offer Intel Xeon-based host machines containing Sandy Bridge, Ivy Bridge, Haswell, Broadwell, or Skylake CPU platforms, as well as AMD EPYC Rome processors. Each CPU platform supports incremental features like AVX-2, AVX-512, and so on. Some fundamental systems-related features like clock speed and memory access seek time can vary across CPU platforms. Different zones support multiple CPU platforms, and you can select a CPU platform for your VM instances that supports the specific needs of your workloads using minimum platform selection.
To learn about the available CPU platforms for each zone, read the CPU platforms and Regions and zones documentation.
Before you begin
- If you want to use the command-line examples in this guide:
- Install or update to the latest version of the gcloud command-line tool.
- Set a default region and zone.
- If you want to use the API examples in this guide, set up API access.
When to select a minimum CPU platform
More than likely, you do not need to select a minimum CPU platform for your VMs. Each Compute Engine zone has a default CPU platform that Google occasionally retires or updates. Any newly created VM without a minimum CPU specification gets the default CPU platform automatically.
Google recommends that you only select a minimum CPU platform when it introduces significant performance gains for your workload or provides certain capabilities such as AVX-2, AVX-512, or MPX utilized by your code. Selecting a specific minimum CPU platform for your VM introduces additional constraints that affect your ability to start VMs in certain zones where some CPU platforms are in limited supply.
How selecting a minimum CPU platform works
When you specify a minimum CPU platform:
Compute Engine always uses the minimum CPU platform where available.
If Compute Engine retires a CPU platform from a zone, your VM can continue to run on a better CPU platform available in that zone after you stop and restart the VM. Retiring CPU platforms is an infrequent situation and you are notified ahead of time.
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.
- Upon live migration, your VM retains the same 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 to 5 years, Google replaces older CPU platforms with newer platforms, and updates the default CPU platform to the next newest platform available in that zone.
At any time, when a new region or zone is built, it uses the newest CPU platform at the time.
When a zone is retired or a default CPU platform for a zone changes, Google provides advance notice to affected customers with a detailed timeline and specific instructions to transition to the newer platform.
VMs never use a platform that is older than the minimum CPU platform you specify and the cost of the VM doesn't change if Compute Engine transitions your VM to a more recent platform.
Specifications
Limitations
e2-micro
, e2-small
, e2-medium
,f1-micro
and g1-small
predefined
machine types are shared-core general purpose VMs. You do not have the
CPU platform selection options when you select any of these machine types.
Availability
The availability of specific CPU platforms varies across zones and is based on the hardware that is available in each zone. The following list shows the supported minimum CPU platforms and the valid syntax for each platform:
- Intel Xeon E5 (Sandy Bridge) processors:
"Intel Sandy Bridge"
- Intel Xeon E5 v2 (Ivy Bridge) processors:
"Intel Ivy Bridge"
- Intel Xeon E5 v3 (Haswell) processors:
"Intel Haswell"
- Intel Xeon E5 v4 (Broadwell) processors:
"Intel Broadwell"
- Intel Xeon (Cascade Lake) processors:
"Intel Cascade Lake"
- Intel Xeon (Skylake) processors:
"Intel Skylake"
Only certain zones contain multiple CPU platforms and are available for minimum CPU platform selection. If you are using sole-tenant nodes, each node uses the CPU platform corresponding to the node type you defined in the node template. As a result, you cannot specify a minimum CPU platform for VMs that use sole-tenant nodes.
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.
gcloud
To see the CPU platforms in your zone:
gcloud compute zones describe ZONE
For example, the output from this command lists the CPU platforms for the
us-west1-a
zone:
gcloud compute zones describe us-west1-a availableCpuPlatforms: - Intel Skylake - Intel Broadwell ...
API
In the API, make a GET
request
to the zone in question:
GET https://compute.googleapis.com/compute/v1/projects/myproject/zones/ZONE
The response contains a list of support CPU platforms for that zone. For example:
{ "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
In the Google Cloud Console, go to the VM instances page.
If prompted, select your project and click Continue.
Click the Create instance button.
Under the Machine configuration section, click CPU platform and GPU.
From the CPU platform drop-down menu, select an option.
Continue with the rest of the instance creation process.
gcloud
To create a new VM with a minimum CPU platform, provide the
--min-cpu-platform
flag. When specifying the CPU platform, provide the
platform using the friendly name, such as Intel Broadwell
or
Intel Haswell
. Use the available zones
section to determine which platforms are available for each zone.
For example, to specify a minimum CPU platform of Intel Haswell
:
gcloud compute instances create example-instance \ --zone=europe-west1-b \ --min-cpu-platform="Intel Haswell"
If you want clear the minimum CPU platform specification, set
--min-cpu-platform
to AUTOMATIC
.
API
In the Compute Engine API, include the minCpuPlatform
property as part of
the request body. The value for minCpuPlatform
must be the friendly name
for the platform, such as Intel Haswell
, Intel Broadwell
,
or Intel Sandy Bridge
.
For example, a request body might look like this:
"name": "VM_NAME", "machineType": "zones/ZONE/machineTypes/MACHINE_TYPE", "minCpuPlatform": "Intel Haswell", "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" } }]
If you want clear the minimum CPU platform specification, set minCpuPlatform
to AUTOMATIC
.
Setting a minimum CPU platform for a stopped VM
You can set a minimum CPU platform for an existing instance if you first stop the instance.
After stopping the instance, complete the following instructions to set a minimum CPU platform.
Console
In the Google Cloud Console, go to the VM instances page.
If prompted, select your project and click Continue.
Select the stopped instance that you want to change.
Click Edit to edit the instance.
Under the Machine configuration section, click CPU platform and GPU.
From the CPU platform drop-down menu, select an option.
Save your changes.
Restart the instance.
gcloud
Use the
update
subcommand, followed by the--min-cpu-platform
flag. Specify the friendly name of the platforms, such asIntel Haswell
,Intel Broadwell
, orIntel Sandy Bridge
. For example:gcloud compute instances update INSTANCE_NAME \ --min-cpu-platform="Intel Haswell"
Restart the instance.
API
To set the minimum CPU platform in the API, make a
POST
request to thesetMinCpuPlatform
method and set theminCpuPlatform
property in the request body. The value for the property is the friendly name for the CPU platform, such asIntel Haswell
,Intel Broadwell
, orIntel Sandy Bridge
. For example:POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE/setMinCpuPlatform
The output is the following:
{ "minCpuPlatform": "Intel Haswell" }
- Restart the 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
In the Google Cloud Console, go to the Instance templates page.
If prompted, select your project and click Continue.
Click Create instance template.
Under the Machine configuration section, click CPU platform and GPU.
From the CPU platform drop-down menu, select an option.
Continue with the instance template creation process.
gcloud
Provide the --min-cpu-platform
flag when creating an instance template.
For example:
gcloud compute instance-templates create example-template \ --min-cpu-platform="Intel Haswell"
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-9" } } ] } ], "disks": [ { "type": "PERSISTENT", "boot": true, "mode": "READ_WRITE", "initializeParams": { "sourceImage": "projects/debian-cloud/global/images/family/debian-8" } } ] } }
What's next
- See a list of CPU platforms on Compute Engine.
- Changing the machine type of an instance.
- Learn more about Regions and zones.
- Create and start Windows Server or SQL Server instances.
- See the
gcloud compute instances create
command.