This document describes how to delete a managed instance group (MIG) that you no longer need so you can stop paying for the resources it uses.
Select the tab for how you plan to use the samples on this page:
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
Install the Google Cloud CLI. After installation, initialize the Google Cloud CLI by running the following command:
gcloud initIf you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
Install the Google Cloud CLI.
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, see Authenticate for using REST in the Google Cloud authentication documentation.
When you delete a managed instance group, all VMs in the group are deleted. If you want to keep any of the VMs, abandon the VMs first to remove those VMs from the group. Then, delete the managed instance group.
The disks in a MIG are deleted only if you had set the disk's auto-delete property to true when defining the disks in the MIG's instance template. If a disk's auto-delete property is set to false, then you can manually clean up the disks when you no longer need them.
When you delete a managed instance group and its instances by using the
Google Cloud console or the gcloud CLI,
any attached autoscaler is automatically deleted. However, if you use the
REST, you
must first issue a separate request to delete any attached autoscaler with the
autoscalers.delete method
or
regionAutoscalers.delete method.
If you happen to delete the managed instance group first, you can still delete
the attached autoscaler using REST.
For each disk, you can also override the auto-delete property to specify whether the disk should be deleted when its associated instance is deleted.