Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
En este documento, se describe cómo ver la configuración de flexibilidad de instancias en un grupo de instancias administrado (MIG) y los tipos de máquinas que usa cada VM del grupo.
Después de agregar o cambiar la flexibilidad de instancias en un MIG, puedes hacer lo siguiente:
Consulta los tipos de máquinas que usa cada VM para asegurarte de que el tipo de máquina que deseas quitar de una selección de instancias no lo use ninguna VM o para verificar los diferentes tipos de máquinas que se usan en el MIG.
Antes de comenzar
Si aún no lo hiciste, configura la autenticación.
La autenticación verifica tu identidad para acceder a los Google Cloud servicios y las APIs. Para ejecutar código o muestras desde un entorno de desarrollo local, puedes autenticarte en Compute Engine seleccionando una de las siguientes opciones:
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
Instala Google Cloud CLI.
Después de la instalación,
inicializa Google Cloud CLI ejecutando el siguiente comando:
En la columna Nombre, haz clic en el nombre del MIG cuya configuración de flexibilidad de instancias deseas ver.
Se abrirá la página de resumen del MIG.
Haz clic en la pestaña Detalles.
En la sección Flexibilidad de instancias, la tabla Selecciones de instancias muestra el nombre, el rango y los tipos de máquinas de una selección de instancias. Si el MIG no tiene configurada la flexibilidad de instancias, no se mostrará la sección Flexibilidad de instancias.
gcloud
Para ver la configuración de flexibilidad de la instancia, usa el comando instance-groups managed describe.
Incluye la marca --format para filtrar las propiedades instanceFlexibilityPolicy.instanceSelections.
Si un MIG no tiene configurada la flexibilidad de instancias, el resultado muestra null.
Reemplaza lo siguiente:
INSTANCE_GROUP_NAME: Es el nombre del MIG cuya configuración de flexibilidad de instancias deseas ver.
REGION: la región en la que se encuentra el MIG.
REST
Para ver la configuración de flexibilidad de la instancia, usa el método regionInstanceGroupManagers.get.
Incluye el parámetro fields en la URL de la solicitud para filtrar las propiedades instanceFlexibilityPolicy.instanceSelections.
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/instanceGroupManagers/INSTANCE_GROUP_NAME?fields=instanceFlexibilityPolicy.instanceSelections
En la columna Nombre, haz clic en el nombre del MIG en el que deseas ver los tipos de máquinas que usa cada VM.
Se abrirá la página Descripción general del MIG, en la que se enumeran todas las VMs del grupo, sus tipos de máquinas y otros detalles.
gcloud
Para ver los tipos de máquinas que usa cada VM en un MIG, enumera las VMs con el comando instance-groups managed list-instances y, luego, incluye la marca --format para filtrar el campo propertiesFromFlexibilityPolicy.machineType. También puedes filtrar otros campos según sea necesario.
INSTANCE_GROUP_NAME: Es el nombre del MIG cuya configuración de flexibilidad de instancias deseas ver.
REST
Para ver los tipos de máquinas que usa cada VM en un MIG, enumera las VMs con el método listManagedInstances y verifica el campo propertiesFromFlexibilityPolicy.machineType en la respuesta.
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/instanceGroupManagers/INSTANCE_GROUP_NAME/listManagedInstances
A continuación, se muestra un ejemplo de resultado. Busca el campo propertiesFromFlexibilityPolicy en el que se configura el campo machineType de una VM.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 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)."]]