Delete a MIG (original) (raw)
This document describes how to delete amanaged instance group (MIG)that you no longer need so you can stop paying for the resources it uses.
Before you begin
- If you haven't already, set up 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:
Select the tab for how you plan to use the samples on this page:
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 VMsfirst 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 theGoogle Cloud console or the gcloud CLI, any attached autoscaler is automatically deleted. However, if you use theREST, you must first issue a separate request to delete any attached autoscaler with theautoscalers.delete methodorregionAutoscalers.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.
Permissions required for this task
To perform this task, you must have the followingpermissions:
compute.instanceGroupManagers.deleteon the managed instance group
Console
- In the Google Cloud console, go to the Instance groups page.
Go to Instance groups - Select one or more groups on the list that you want to delete.
- Click Delete to delete the group and all of the VMs in the managed instance group.
gcloud
Use thedelete command.
gcloud compute instance-groups managed delete INSTANCE_GROUP_NAME
--zone ZONE
REST
Call the delete method for azonalorregionalMIG resource. If the MIG has an attached autoscaler, you must first delete the autoscaler using the autoscalers.delete methodor regionAutoscalers.delete method.
If the instance group is a regional managed instance group, replacezones/ZONE with regions/REGION.