View instance flexibility Stay organized with collections Save and categorize content based on your preferences.
This document describes how to view the instance flexibility configuration in amanaged instance group (MIG) and the machine types used by each VM in the group.
After you add or make changes to instance flexibility in a MIG, you can do thefollowing:
View the instance flexibility configurationto verify if a configuration has been applied or to check if a MIG already hasinstance flexibility.
View the machine types used by each VMto make sure that the machine type that you want to remove from an instanceselection is not used by any VM or to check the different machine types usedin the MIG.
Before you begin
- If you haven't already, then set up authentication.Authentication is the process by which your identity is verified 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
Afterinstalling the Google Cloud CLI,initialize it 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.
Afterinstalling the Google Cloud CLI,initialize it 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.
For more information, seeAuthenticate for using REST in the Google Cloud authentication documentation.
View the instance flexibility configuration
Console
In the Google Cloud console, go to theInstance groups page.
In theName column, click the name of the MIG of which you want toview the instance flexibility configuration.
The overview page of the MIG opens.
Click theDetails tab.
In theInstance flexibility section, theInstance selectionstable shows the instance selection name, rank, and the machine types ina selection. If the MIG doesn't have instance flexibility configured, theInstance flexibility section is not shown.
gcloud
To view the instance flexibility configuration, use theinstance-groups managed describe
command.Include the--format
flag to filter theinstanceFlexibilityPolicy.instanceSelections
properties.
gcloud compute instance-groups managed describeINSTANCE_GROUP_NAME \ --regionREGION \ --format="json(instanceFlexibilityPolicy.instanceSelections)"
The following is a sample output:
{ "instanceFlexibilityPolicy": { "instanceSelections": { "instance-selection-1": { "machineTypes": [ "n1-standard-16", "n2-standard-16", "e2-standard-16" ], "rank": 1 } } }}
If a MIG doesn't have instance flexibility configured, the output returnsnull
.
Replace the following:
INSTANCE_GROUP_NAME
: the name of the MIG of whichyou want to view the instance flexibility configuration.REGION
: the region where the MIG is located.
REST
To view the instance flexibility configuration, use theregionInstanceGroupManagers.get
method.Include thefields
parameter in the request URL to filter theinstanceFlexibilityPolicy.instanceSelections
properties.
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/instanceGroupManagers/INSTANCE_GROUP_NAME?fields=instanceFlexibilityPolicy.instanceSelections
The following is a sample output:
{ "instanceFlexibilityPolicy": { "instanceSelections": { "instance-selection-1": { "machineTypes": [ "n1-standard-16", "n2-standard-16", "e2-standard-16" ], "rank": 1 } } }}
If a MIG doesn't have instance flexibility configured, the output returnsnull
.
Replace the following:
PROJECT_ID
: yourproject ID.REGION
: the region where the MIG is located.INSTANCE_GROUP_NAME
: the name of the MIG of whichyou want to view the instance flexibility configuration.
View the machine types used by each VM
Console
In the Google Cloud console, go to theInstance groups page.
In theName column, click the name of the MIG in which you want viewthe machine types used by each VM.
TheOverview page of the MIG opens, which lists all VMs in the group,their machine types, and other details.
gcloud
To view the machine types used by each VM in a MIG, list the VMs using theinstance-groups managed list-instances
command and include the--format
flag to filter thepropertiesFromFlexibilityPolicy.machineType
field. You can also filterother fields as needed.
gcloud compute instance-groups managed list-instancesINSTANCE_GROUP_NAME \ --regionREGION \ --format='(name,instanceStatus,currentAction,propertiesFromFlexibilityPolicy.machineType,lastAttempt.errors.errors)'
The following is a sample output:
NAME: example-mig-0md2STATUS: RUNNINGACTION: NONEMACHINE_TYPE: n1-standard-16LAST_ERROR:NAME: example-mig-vbggSTATUS: RUNNINGACTION: NONEMACHINE_TYPE: n1-standard-16LAST_ERROR:
Replace the following:
REGION
: the region where the MIG is located.INSTANCE_GROUP_NAME
: the name of the MIG of whichyou want to view the instance flexibility configuration.
REST
To view the machine types used by each VM in a MIG, list the VMs using thelistManagedInstances
methodand check thepropertiesFromFlexibilityPolicy.machineType
field in theresponse.
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/instanceGroupManagers/INSTANCE_GROUP_NAME/listManagedInstances
The following is a sample output; look for thepropertiesFromFlexibilityPolicy
field in which themachineType
field ofa VM is set.
{ "managedInstances": [ { "instance": "https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-b/instances/example-mig-0md2", "instanceStatus": "RUNNING", "id": "2656095434923471959", "version": { "instanceTemplate": "https://www.googleapis.com/compute/v1/projects/example-project/global/instanceTemplates/example-instance-template" }, "targetStatus": "RUNNING", "name": "example-mig-0md2", "propertiesFromFlexibilityPolicy": { "machineType": "n1-standard-16" } }, { "instance": "https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-b/instances/example-mig-vbgg", "instanceStatus": "RUNNING", "currentAction": "NONE", "id": "9171259522409694366", "version": { "instanceTemplate": "https://www.googleapis.com/compute/v1/projects/example-project/global/instanceTemplates/example-instance-template" }, "targetStatus": "RUNNING", "name": "example-mig-vbgg", "propertiesFromFlexibilityPolicy": { "machineType": "n1-standard-16" } } ]}
Replace the following:
PROJECT_ID
: yourproject ID.REGION
: the region where the MIG is located.INSTANCE_GROUP_NAME
: the name of the MIG of whichyou want to view the instance flexibility configuration.
What's next
If your MIG doesn't have instance flexibility,add instance flexibility.
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-07-09 UTC.