このドキュメントでは、仮想マシン(VM)インスタンスの表示可能な CPU コアの数を表示する方法について説明します。
VM の詳細を表示すると、VM にデフォルトの表示可能な CPU コアの数があるかどうか、この数がカスタマイズされているかどうかを確認できます。VM の表示可能な CPU コアの数を減らすと、Persistent Disk のパフォーマンス上限を下げることなくライセンス費用を削減できます。ただし、表示可能な CPU コアの数を減らすと、ネットワーク パフォーマンスに影響する可能性があります。
始める前に
まだ設定していない場合は、認証を設定します。認証とは、 Google Cloud サービスと API にアクセスするために ID を確認するプロセスです。ローカル開発環境からコードまたはサンプルを実行するには、次のいずれかのオプションを選択して Compute Engine に対する認証を行います。
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
After installing the Google Cloud CLI,
initialize it by running the following command:
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-21 UTC。"],[[["\u003cp\u003eThis document provides instructions on how to check if a virtual machine (VM) has the default number of visible CPU cores or if it has been customized.\u003c/p\u003e\n"],["\u003cp\u003eReducing the number of visible CPU cores can help decrease licensing costs, but it might impact network performance and overall VM performance.\u003c/p\u003e\n"],["\u003cp\u003eYou can view the number of visible CPU cores through the Google Cloud console, by using the \u003ccode\u003egcloud compute instances describe\u003c/code\u003e command, or by making a \u003ccode\u003eGET\u003c/code\u003e request to the \u003ccode\u003einstances.get\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eIf the \u003ccode\u003evisibleCoreCount\u003c/code\u003e field is present in the output, the VM has a customized number of visible CPU cores; otherwise, it has the default number.\u003c/p\u003e\n"],["\u003cp\u003eTo view the details of the VM, the required permission is \u003ccode\u003ecompute.instances.get\u003c/code\u003e, granted by the \u003ccode\u003eCompute Instance Admin (v1)\u003c/code\u003e role.\u003c/p\u003e\n"]]],[],null,["# View the number of visible CPU cores\n\nLinux Windows\n\n*** ** * ** ***\n\nThis document describes how to view the number of visible CPU cores for a\nvirtual machine (VM) instance.\n\nWhen you\n[view the details of a VM](/compute/docs/instances/view-vm-details), you\ncan verify if the VM has the default number of visible CPU cores, or if this\nnumber has been customized. Reducing the number of visible CPU cores for a VM\ncan help reduce licensing costs without reducing Persistent Disk performance limits.\nHowever, reducing the number of visible CPU cores might affect network\nperformance.\n| **Note:** Reducing the number of visible CPU cores for a VM might impact the performance of the VM. For more information, see [Performance considerations](/compute/docs/instances/customize-visible-cores#performance_considerations).\n\nBefore you begin\n----------------\n\n- If you haven't already, set up [authentication](/compute/docs/authentication). 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:\n\n Select the tab for how you plan to use the samples on this page: \n\n ### Console\n\n\n When you use the Google Cloud console to access Google Cloud services and\n APIs, you don't need to set up authentication.\n\n ### gcloud\n\n 1.\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n After installation,\n [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command:\n\n ```bash\n gcloud init\n ```\n\n\n If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n | **Note:** If you installed the gcloud CLI previously, make sure you have the latest version by running `gcloud components update`.\n 2. [Set a default region and zone](/compute/docs/gcloud-compute#set_default_zone_and_region_in_your_local_client).\n\n ### REST\n\n\n To use the REST API samples on this page in a local development environment, you use the\n credentials you provide to the gcloud CLI.\n 1. [Install](/sdk/docs/install) the Google Cloud CLI. After installation, [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command: \n\n ```bash\n gcloud init\n ```\n 2. If you're using an external identity provider (IdP), you must first [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n\n For more information, see\n [Authenticate for using REST](/docs/authentication/rest)\n in the Google Cloud authentication documentation.\n\n### Required roles\n\n\nTo get the permission that\nyou need to view the details of a VM,\n\nask your administrator to grant you the\n\n\n[Compute Instance Admin (v1)](/iam/docs/roles-permissions/compute#compute.instanceAdmin.v1) (`roles/compute.instanceAdmin.v1`)\nIAM role on the VM or project.\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nThis predefined role contains the\n` compute.instances.get`\npermission,\nwhich is required to\nview the details of a VM.\n\n\nYou might also be able to get\nthis permission\nwith [custom roles](/iam/docs/creating-custom-roles) or\nother [predefined roles](/iam/docs/roles-overview#predefined).\n\nView the number of visible CPU cores for a VM\n---------------------------------------------\n\nTo determine if the number of visible CPU cores was customized for a VM, select\none of the following options: \n\n### Console\n\n1. In the Google Cloud console, go to the **VM instances** page.\n\n [Go to VM instances](https://console.cloud.google.com/compute/instances)\n2. In the **Name** column, click the name of\n the VM.\n\n The details page of the VM opens and the **Details** tab is selected.\n3. In the **Machine configuration** section, check the value for\n **Custom visible cores** . If there is no value displayed, then the VM\n has the\n [default number of visible CPU cores](/compute/docs/instances/customize-visible-cores).\n\n### gcloud\n\nTo view the details of the VM, use the\n[`gcloud compute instances describe` command](/sdk/gcloud/reference/compute/instances/describe). \n\n gcloud compute instances describe \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e \\\n --zone=\u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e: the name of the VM.\n\n- \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the zone where the VM is located.\n\nIf the number of visible CPU cores for the VM was customized, then\nthe output contains the `visibleCoreCount` field as follows: \n\n advancedMachineFeatures:\n visibleCoreCount: \u003cvar translate=\"no\"\u003eVISIBLE_CORE_COUNT\u003c/var\u003e\n ...\n\nIf the output doesn't contain the `visibleCoreCount` field, then\nthe VM has the\n[default number of visible CPU cores](/compute/docs/instances/customize-visible-cores).\n\n### REST\n\nTo view the details of the VM, make a `GET` request to the\n[`instances.get` method](/compute/docs/reference/rest/v1/instances/get). \n\n GET https://compute.googleapis.com/compute/v1/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/zones/\u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e/instances/\u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of the project where the VM is\n located.\n\n- \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the zone where the VM is located.\n\n- \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e: the name of the VM.\n\nIf the number of visible CPU cores for the VM was customized, then\nthe output contains the `visibleCoreCount` field as follows: \n\n {\n ...\n \"advancedMachineFeatures\": {\n visibleCoreCount: \u003cvar translate=\"no\"\u003eVISIBLE_CORE_COUNT\u003c/var\u003e\n },\n ...\n }\n\nIf the output doesn't contain the `visibleCoreCount` field, then\nthe VM has the\n[default number of visible CPU cores](/compute/docs/instances/customize-visible-cores).\n\nWhat's next\n-----------\n\n- [Customize the number of visible cores](/compute/docs/instances/customize-visible-cores)\n- [Set the number of threads per core](/compute/docs/instances/set-threads-per-core)"]]