View the number of visible CPU cores Stay organized with collections Save and categorize content based on your preferences.
This document describes how to view the number of visible CPU cores for avirtual machine (VM) instance.
When youview the details of a VM, youcan verify if the VM has the default number of visible CPU cores, or if thisnumber has been customized. Reducing the number of visible CPU cores for a VMcan help reduce licensing costs without reducing Persistent Disk performance limits.However, reducing the number of visible CPU cores might affect networkperformance.
Note: Reducing the number of visible CPU cores for a VM might impactthe performance of the VM. For more information, seePerformance considerations.Before you begin
- If you haven't already, set upauthentication. Authentication verifies your identity for access to Google Cloud 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:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
Install the Google Cloud CLI. After installation,initialize the Google Cloud CLI by running the following command:
gcloudinit
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.- 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. After installation,initialize the Google Cloud CLI by running the following command:
gcloudinit
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.For more information, seeAuthenticate for using REST in the Google Cloud authentication documentation.
Required roles
To get the permission that you need to view the details of a VM, ask your administrator to grant you theCompute Instance Admin (v1) (roles/compute.instanceAdmin.v1) IAM role on the VM or project. For more information about granting roles, seeManage access to projects, folders, and organizations.
This predefined role contains the compute.instances.get permission, which is required to view the details of a VM.
You might also be able to get this permission withcustom roles or otherpredefined roles.
View the number of visible CPU cores for a VM
To determine if the number of visible CPU cores was customized for a VM, selectone of the following options:
Console
In the Google Cloud console, go to theVM instances page.
In theName column, click the name ofthe VM.
The details page of the VM opens and theDetails tab is selected.
In theMachine configuration section, check the value forCustom visible cores. If there is no value displayed, then the VMhas thedefault number of visible CPU cores.
gcloud
To view the details of the VM, use thegcloud compute instances describe command.
gcloud compute instances describeVM_NAME \ --zone=ZONEReplace the following:
VM_NAME: the name of the VM.ZONE: the zone where the VM is located.
If the number of visible CPU cores for the VM was customized, thenthe output contains thevisibleCoreCount field as follows:
advancedMachineFeatures: visibleCoreCount:VISIBLE_CORE_COUNT...If the output doesn't contain thevisibleCoreCount field, thenthe VM has thedefault number of visible CPU cores.
REST
To view the details of the VM, make aGET request to theinstances.get method.
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/VM_NAMEReplace the following:
PROJECT_ID: the ID of the project where the VM islocated.ZONE: the zone where the VM is located.VM_NAME: the name of the VM.
If the number of visible CPU cores for the VM was customized, thenthe output contains thevisibleCoreCount field as follows:
{ ... "advancedMachineFeatures": { visibleCoreCount:VISIBLE_CORE_COUNT }, ...}If the output doesn't contain thevisibleCoreCount field, thenthe VM has thedefault number of visible CPU cores.
What's next
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.