[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-29。"],[[["\u003cp\u003eThis guide explains how to delete a managed instance group (MIG) and its associated resources to avoid incurring unnecessary costs.\u003c/p\u003e\n"],["\u003cp\u003eDeleting a MIG will remove all virtual machines (VMs) within it, unless you choose to abandon specific VMs beforehand.\u003c/p\u003e\n"],["\u003cp\u003eDisks within the MIG will only be deleted automatically if their auto-delete property was set to true during the MIG's template configuration, otherwise manual deletion is necessary.\u003c/p\u003e\n"],["\u003cp\u003eIf a MIG is associated with a load balancer's backend service, the backend service must be removed before deleting the MIG, and any autoscalers attached to the MIG must be deleted separately when using the REST API.\u003c/p\u003e\n"],["\u003cp\u003eThe process can be done using the Google Cloud Console, gcloud CLI, or REST API, each with specific instructions and requirements.\u003c/p\u003e\n"]]],[],null,["# Delete a MIG\n\n*** ** * ** ***\n\nThis document describes how to delete a\n[managed instance group (MIG)](/compute/docs/instance-groups#managed_instance_groups)\nthat you no longer need so you can stop paying for the resources it uses.\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\nDelete a MIG\n------------\n\nWhen you delete a managed instance group, all VMs in the group are\ndeleted. If you want to keep any of the VMs,\n[abandon the VMs](/compute/docs/instance-groups/add-remove-vms-in-mig#abandoning_instances)\nfirst to remove those VMs from the group. Then, delete the managed instance\ngroup.\n\nThe disks in a MIG are deleted only if you had set the disk's auto-delete\nproperty to true when defining the disks in the MIG's instance template. If a\ndisk's auto-delete property is set to false, then you can manually clean up the\ndisks when you no longer need them.\n| **Note:** You cannot delete an instance group if it is being used by a load balancer's [backend service](/compute/docs/load-balancing/http/backend-service). [Remove the backend service](/sdk/gcloud/reference/compute/backend-services/remove-backend) before deleting the instance group.\n\nWhen you delete a managed instance group and its instances by using the\n[Google Cloud console](https://console.cloud.google.com/) or the [gcloud CLI](/compute/docs/gcloud-compute),\nany attached autoscaler is automatically deleted. However, if you use the\n[REST](/compute/docs/reference/latest/instanceGroupManagers), you\nmust first issue a separate request to delete any attached autoscaler with the\n[`autoscalers.delete` method](/compute/docs/reference/rest/v1/autoscalers/delete)\nor\n[`regionAutoscalers.delete` method](/compute/docs/reference/rest/v1/regionAutoscalers/delete).\nIf you happen to delete the managed instance group first, you can still delete\nthe attached autoscaler using REST.\n\nFor each disk, you can also override the auto-delete property to specify whether\nthe disk should be deleted when its associated instance is deleted.\n\n#### Permissions required for this task\n\nTo perform this task, you must have the following\n[permissions](/iam/docs/overview#permissions):\n\n\n- `compute.instanceGroupManagers.delete` on the managed instance group \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)\n2. Select one or more groups on the list that you want to delete.\n\n3. Click **Delete** to delete the group and all of the VMs in the\n managed instance group.\n\n### gcloud\n\nUse the\n[`delete` command](/sdk/gcloud/reference/compute/instance-groups/managed/delete). \n\n```\ngcloud compute instance-groups managed delete INSTANCE_GROUP_NAME \\\n --zone ZONE\n```\n\n### REST\n\nCall the `delete` method for a\n[zonal](/compute/docs/reference/rest/v1/instanceGroupManagers/delete)\nor\n[regional](/compute/docs/reference/rest/v1/regionInstanceGroupManagers/delete)\nMIG resource. If the MIG has an attached autoscaler, you must first delete\nthe autoscaler using the [`autoscalers.delete` method](/compute/docs/reference/rest/v1/autoscalers/delete)\nor [`regionAutoscalers.delete` method](/compute/docs/reference/rest/v1/regionAutoscalers/delete). \n\n```\nDELETE https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instanceGroupManagers/INSTANCE_GROUP_NAME\n```\n\nIf the instance group is a regional managed instance group, replace\n`zones/`\u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e with `regions/`\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e.\n\nWhat's next\n-----------\n\n- Learn about [Getting, listing, and deleting instance templates](/compute/docs/instance-templates/get-list-delete-instance-templates)"]]