Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Dokumen ini menjelaskan cara melihat konfigurasi fleksibilitas instance dalam
grup instance terkelola (MIG) dan jenis mesin yang digunakan oleh setiap VM dalam grup.
Setelah menambahkan atau membuat perubahan pada fleksibilitas instance di MIG, Anda dapat melakukan hal berikut:
Lihat konfigurasi fleksibilitas instance
untuk memverifikasi apakah konfigurasi telah diterapkan atau untuk memeriksa apakah MIG sudah memiliki
fleksibilitas instance.
Lihat jenis mesin yang digunakan oleh setiap VM
untuk memastikan bahwa jenis mesin yang ingin Anda hapus dari pilihan instance
tidak digunakan oleh VM mana pun atau untuk memeriksa berbagai jenis mesin yang digunakan
dalam MIG.
Sebelum memulai
Siapkan autentikasi, jika Anda belum melakukannya.
Autentikasi memverifikasi identitas Anda untuk mengakses Google Cloud layanan dan API. Untuk menjalankan
kode atau sampel dari lingkungan pengembangan lokal, Anda dapat melakukan autentikasi ke
Compute Engine dengan memilih salah satu opsi berikut:
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
Menginstal Google Cloud CLI.
Setelah penginstalan,
lakukan inisialisasi Google Cloud CLI dengan menjalankan perintah berikut:
Di kolom Name, klik nama MIG yang konfigurasi fleksibilitas instansinya ingin Anda lihat.
Halaman ringkasan MIG akan terbuka.
Klik tab Detail.
Di bagian Instance flexibility, tabel Instance selections
menampilkan nama pilihan instance, peringkat, dan jenis mesin dalam
pilihan. Jika MIG tidak memiliki fleksibilitas instance yang dikonfigurasi, bagian
Fleksibilitas instance tidak ditampilkan.
gcloud
Untuk melihat konfigurasi fleksibilitas instance, gunakan
perintah instance-groups managed describe.
Sertakan flag --format untuk memfilter properti
instanceFlexibilityPolicy.instanceSelections.
Jika MIG tidak memiliki fleksibilitas instance yang dikonfigurasi, output akan menampilkan
null.
Ganti kode berikut:
INSTANCE_GROUP_NAME: nama MIG yang
konfigurasi fleksibilitas instansinya ingin Anda lihat.
REGION: region tempat MIG berada.
REST
Untuk melihat konfigurasi fleksibilitas instance, gunakan
metode regionInstanceGroupManagers.get.
Sertakan parameter fields di URL permintaan untuk memfilter properti
instanceFlexibilityPolicy.instanceSelections.
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/instanceGroupManagers/INSTANCE_GROUP_NAME?fields=instanceFlexibilityPolicy.instanceSelections
Di kolom Name, klik nama MIG tempat Anda ingin melihat jenis mesin yang digunakan oleh setiap VM.
Halaman Overview MIG akan terbuka, yang mencantumkan semua VM dalam grup, jenis mesinnya, dan detail lainnya.
gcloud
Untuk melihat jenis mesin yang digunakan oleh setiap VM dalam MIG, buat daftar VM menggunakan
perintah instance-groups managed list-instances dan sertakan tanda --format untuk memfilter kolom
propertiesFromFlexibilityPolicy.machineType. Anda juga dapat memfilter
kolom lain sesuai kebutuhan.
INSTANCE_GROUP_NAME: nama MIG yang
konfigurasi fleksibilitas instansinya ingin Anda lihat.
REST
Untuk melihat jenis mesin yang digunakan oleh setiap VM dalam MIG, cantumkan VM menggunakan
metode listManagedInstances
dan periksa kolom propertiesFromFlexibilityPolicy.machineType dalam
respons.
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/instanceGroupManagers/INSTANCE_GROUP_NAME/listManagedInstances
Berikut adalah contoh output; cari kolom
propertiesFromFlexibilityPolicy tempat kolom machineType dari
VM ditetapkan.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-04 UTC."],[[["\u003cp\u003eThis document provides instructions on how to view the instance flexibility configuration of a managed instance group (MIG).\u003c/p\u003e\n"],["\u003cp\u003eYou can verify if instance flexibility has been applied to a MIG or if it already has it configured.\u003c/p\u003e\n"],["\u003cp\u003eThe content explains how to check the machine types used by each virtual machine (VM) within a MIG, ensuring desired machine types are not in use, or to review all the used ones.\u003c/p\u003e\n"],["\u003cp\u003eInstructions are available for using the Google Cloud Console, gcloud command-line tool, and REST API to access this information.\u003c/p\u003e\n"]]],[],null,["# View instance flexibility\n\n*** ** * ** ***\n\nThis document describes how to view the instance flexibility configuration in a\nmanaged instance group (MIG) and the machine types used by each VM in the group.\n\nAfter you add or make changes to instance flexibility in a MIG, you can do the\nfollowing:\n\n- [View the instance flexibility configuration](#view_the_instance_flexibility_configuration)\n to verify if a configuration has been applied or to check if a MIG already has\n instance flexibility.\n\n- [View the machine types used by each VM](#view_the_machine_types_used_by_each_vm)\n to make sure that the machine type that you want to remove from an instance\n selection is not used by any VM or to check the different machine types used\n in the MIG.\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\nView the instance flexibility configuration\n-------------------------------------------\n\n### Console\n\n1. In the Google Cloud console, go to the **Instance groups** page.\n\n [Go to Instance groups](https://console.cloud.google.com/compute/instanceGroups)\n\n \u003cbr /\u003e\n\n2. In the **Name** column, click the name of the MIG of which you want to\n view the instance flexibility configuration.\n\n The overview page of the MIG opens.\n3. Click the **Details** tab.\n\n In the **Instance flexibility** section, the **Instance selections**\n table shows the instance selection name, rank, and the machine types in\n a selection. If the MIG doesn't have instance flexibility configured, the\n **Instance flexibility** section is not shown.\n\n### gcloud\n\nTo view the instance flexibility configuration, use the\n[`instance-groups managed describe` command](/sdk/gcloud/reference/compute/instance-groups/managed/describe).\nInclude the `--format` flag to filter the\n`instanceFlexibilityPolicy.instanceSelections` properties. \n\n```\n gcloud compute instance-groups managed describe INSTANCE_GROUP_NAME \\\n --region REGION \\\n --format=\"json(instanceFlexibilityPolicy.instanceSelections)\"\n```\n\nThe following is a sample output: \n\n```\n{\n \"instanceFlexibilityPolicy\": {\n \"instanceSelections\": {\n \"instance-selection-1\": {\n \"machineTypes\": [\n \"n1-standard-16\",\n \"n2-standard-16\",\n \"e2-standard-16\"\n ],\n \"rank\": 1\n }\n }\n }\n}\n```\n\nIf a MIG doesn't have instance flexibility configured, the output returns\n`null`.\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eINSTANCE_GROUP_NAME\u003c/var\u003e: the name of the MIG of which you want to view the instance flexibility configuration.\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: the region where the MIG is located.\n\n### REST\n\nTo view the instance flexibility configuration, use the\n[`regionInstanceGroupManagers.get` method](/compute/docs/reference/rest/v1/regionInstanceGroupManagers/get).\nInclude the `fields` parameter in the request URL to filter the\n`instanceFlexibilityPolicy.instanceSelections` properties. \n\n```\n GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/instanceGroupManagers/INSTANCE_GROUP_NAME?fields=instanceFlexibilityPolicy.instanceSelections\n```\n\nThe following is a sample output: \n\n```\n{\n \"instanceFlexibilityPolicy\": {\n \"instanceSelections\": {\n \"instance-selection-1\": {\n \"machineTypes\": [\n \"n1-standard-16\",\n \"n2-standard-16\",\n \"e2-standard-16\"\n ],\n \"rank\": 1\n }\n }\n }\n}\n```\n\nIf a MIG doesn't have instance flexibility configured, the output returns\n`null`.\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: your [project ID](/resource-manager/docs/creating-managing-projects#identifying_projects).\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: the region where the MIG is located.\n- \u003cvar translate=\"no\"\u003eINSTANCE_GROUP_NAME\u003c/var\u003e: the name of the MIG of which you want to view the instance flexibility configuration.\n\nView the machine types used by each VM\n--------------------------------------\n\n### Console\n\n1. In the Google Cloud console, go to the **Instance groups** page.\n\n [Go to Instance groups](https://console.cloud.google.com/compute/instanceGroups)\n\n \u003cbr /\u003e\n\n2. In the **Name** column, click the name of the MIG in which you want view\n the machine types used by each VM.\n\n The **Overview** page of the MIG opens, which lists all VMs in the group,\n their machine types, and other details.\n\n### gcloud\n\nTo view the machine types used by each VM in a MIG, list the VMs using the\n[`instance-groups managed list-instances` command](/sdk/gcloud/reference/compute/instance-groups/managed/list-instances) and include the `--format` flag to filter the\n`propertiesFromFlexibilityPolicy.machineType` field. You can also filter\nother fields as needed. \n\n```\n gcloud compute instance-groups managed list-instances INSTANCE_GROUP_NAME \\\n --region REGION \\\n --format='(name,instanceStatus,currentAction,propertiesFromFlexibilityPolicy.machineType,lastAttempt.errors.errors)'\n```\n\nThe following is a sample output: \n\n```\nNAME: example-mig-0md2\nSTATUS: RUNNING\nACTION: NONE\nMACHINE_TYPE: n1-standard-16\nLAST_ERROR:\n\nNAME: example-mig-vbgg\nSTATUS: RUNNING\nACTION: NONE\nMACHINE_TYPE: n1-standard-16\nLAST_ERROR:\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: the region where the MIG is located.\n- \u003cvar translate=\"no\"\u003eINSTANCE_GROUP_NAME\u003c/var\u003e: the name of the MIG of which you want to view the instance flexibility configuration.\n\n### REST\n\nTo view the machine types used by each VM in a MIG, list the VMs using the\n[`listManagedInstances` method](/compute/docs/reference/rest/v1/regionInstanceGroupManagers/listManagedInstances)\nand check the `propertiesFromFlexibilityPolicy.machineType` field in the\nresponse. \n\n```\n POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/instanceGroupManagers/INSTANCE_GROUP_NAME/listManagedInstances\n```\n\nThe following is a sample output; look for the\n`propertiesFromFlexibilityPolicy` field in which the `machineType` field of\na VM is set. \n\n```\n{\n \"managedInstances\": [\n {\n \"instance\": \"https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-b/instances/example-mig-0md2\",\n \"instanceStatus\": \"RUNNING\",\n \"id\": \"2656095434923471959\",\n \"version\": {\n \"instanceTemplate\": \"https://www.googleapis.com/compute/v1/projects/example-project/global/instanceTemplates/example-instance-template\"\n },\n \"targetStatus\": \"RUNNING\",\n \"name\": \"example-mig-0md2\",\n \"propertiesFromFlexibilityPolicy\": {\n \"machineType\": \"n1-standard-16\"\n }\n },\n {\n \"instance\": \"https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-b/instances/example-mig-vbgg\",\n \"instanceStatus\": \"RUNNING\",\n \"currentAction\": \"NONE\",\n \"id\": \"9171259522409694366\",\n \"version\": {\n \"instanceTemplate\": \"https://www.googleapis.com/compute/v1/projects/example-project/global/instanceTemplates/example-instance-template\"\n },\n \"targetStatus\": \"RUNNING\",\n \"name\": \"example-mig-vbgg\",\n \"propertiesFromFlexibilityPolicy\": {\n \"machineType\": \"n1-standard-16\"\n }\n }\n ]\n}\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: your [project ID](/resource-manager/docs/creating-managing-projects#identifying_projects).\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: the region where the MIG is located.\n- \u003cvar translate=\"no\"\u003eINSTANCE_GROUP_NAME\u003c/var\u003e: the name of the MIG of which you want to view the instance flexibility configuration.\n\nWhat's next\n-----------\n\n- [Change or remove instance flexibility configuration](/compute/docs/instance-groups/change-or-remove-instance-flexibility-configuration).\n\n- If your MIG doesn't have instance flexibility, [add instance flexibility](/compute/docs/instance-groups/configure-instance-flexibility)."]]