View, cancel, or delete resize requests in a MIG


This document describes how to do the following after creating a resize request in a managed instance group (MIG):

  • View resize requests in a MIG to monitor their states or troubleshoot them.

  • Cancel resize requests to stop a MIG from creating the requested number of virtual machine (VM) instances.

  • Delete resize requests.

Before you begin

  • If you haven't already, 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 as follows.

    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

    1. Install the Google Cloud CLI, then initialize it by running the following command:

      gcloud init
    2. 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.

      Install the Google Cloud CLI, then initialize it by running the following command:

      gcloud init

Required roles

To get the permissions that you need to view, cancel, or delete resize requests in a MIG, ask your administrator to grant you the Compute Instance Admin (v1) (roles/compute.instanceAdmin.v1) IAM role on the project. For more information about granting roles, see Manage access.

This predefined role contains the permissions required to view, cancel, or delete resize requests in a MIG. To see the exact permissions that are required, expand the Required permissions section:

Required permissions

The following permissions are required to view, cancel, or delete resize requests in a MIG:

  • To cancel or delete resize requests in a MIG: compute.instanceGroupManagers.update
  • To view a list of resize requests in a MIG: compute.instanceGroupManagers.list
  • To view the details of a resize request: compute.instanceGroupManagers.get

You might also be able to get these permissions with custom roles or other predefined roles.

View your resize requests

Based on the details that you want to view in a resize request, use one of the following methods:

View a list of resize requests in a MIG

You can view a list of all resize requests in a MIG and their details, such as the states, the requested number of VMs, and the run duration of the VMs.

Console

To view a list of all resize requests in a MIG, do the following:

  1. In the Google Cloud console, go to the Instance groups page.

    Go to Instance groups

  2. In the Name column, click the name of the MIG that contains resize requests.

    The overview page of the MIG opens.

  3. In the Resize requests row, click Edit resize requests.

    The Resize requests pane appears.

gcloud

To view a list of all resize requests in a MIG, use the beta instance-groups managed resize-requests list command.

gcloud beta compute instance-groups managed resize-requests list INSTANCE_GROUP_NAME \
    --zone=ZONE

Replace the following:

  • INSTANCE_GROUP_NAME: the name of an existing zonal MIG with accepted, successful, canceled, or failed resize requests.

  • ZONE: the zone where the MIG is located.

The output is similar to the following:

NAME: rr-01
LOCATION: us-central1-a
SCOPE: zone
RESIZE_BY: 5
STATE: SUCCEEDED
REQUESTED_RUN_DURATION: P1D

NAME: rr-02
LOCATION: us-central1-a
SCOPE: zone
RESIZE_BY: 10
STATE: ACCEPTED
REQUESTED_RUN_DURATION: P3D

REST

To view a list of all resize requests in a zonal MIG, make a GET request to the beta.instanceGroupManagerResizeRequests.list method.

GET https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/instanceGroupManagers/INSTANCE_GROUP_NAME/resizeRequests

Replace the following:

  • PROJECT_ID: the ID of the project where an existing zonal MIG with accepted, successful, canceled, or failed resize requests is located.

  • ZONE: the zone where the MIG is located.

  • INSTANCE_GROUP_NAME: the name of an existing zonal MIG with accepted, successful, canceled, or failed resize requests.

The output is similar to the following:

{
  "kind": "compute#instanceGroupManagerResizeRequestList",
  "id": "projects/example-project/zones/us-central1-a/instanceGroupManagers/example-mig/resizeRequests",
  "items": [
    {
      "kind": "compute#instanceGroupManagerResizeRequest",
      "id": "4247139565532196982",
      "creationTimestamp": "2024-01-08T07:51:53.034-08:00",
      "name": "rr-01",
      "zone": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-a",
      "count": 5,
      "resizeBy": 5,
      "requestedRunDuration": {
        "seconds": "86400",
        "nanos": 0
      },
      "state": "SUCCEEDED",
      "status": {},
      "selfLink": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-a/instanceGroupManagers/example-mig/resizeRequests/rr-01",
      "selfLinkWithId": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-a/instanceGroupManagers/example-mig/resizeRequests/4247139565532196982"
    },
    {
      "kind": "compute#instanceGroupManagerResizeRequest",
      "id": "8095866098849525652",
      "creationTimestamp": "2024-01-11T08:04:11.851-08:00",
      "name": "rr-02",
      "zone": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-a",
      "count": 10,
      "resizeBy": 10,
      "requestedRunDuration": {
        "seconds": "259200",
        "nanos": 0
      },
      "state": "ACCEPTED",
      "status": {},
      "selfLink": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-a/instanceGroupManagers/example-mig/resizeRequests/rr-02",
      "selfLinkWithId": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-a/instanceGroupManagers/example-mig/resizeRequests/8095866098849525652"
    }
  ],
  "selfLink": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-a/instanceGroupManagers/example-mig/resizeRequests"
}

View the details of a resize request

You can view the details of a resize request to review its configuration and, optionally, troubleshoot it if the request hasn't succeeded yet.

To understand why an (ACCEPTED) resize request isn't succeeding, check the lastAttempt.error.errors.code field in the details. The possible error codes are as follows:

  • ZONE_RESOURCE_POOL_EXHAUSTED_WITH_DETAILS: the requested resources are temporarily unavailable.

  • QUOTA_EXCEEDED: your project lacks quota for the requested resources. To increase your project's quota, see Request a higher quota.

gcloud

To view the details of a resize request in a zonal MIG, use the beta instance-groups managed resize-requests describe command.

gcloud beta compute instance-groups managed resize-requests describe INSTANCE_GROUP_NAME \
    --resize-request=RESIZE_REQUEST_NAME \
    --zone=ZONE

Replace the following:

  • INSTANCE_GROUP_NAME: the name of an existing zonal MIG where the resize request is located.

  • RESIZE_REQUEST_NAME: the name of an existing resize request that you want to view the details of.

  • ZONE: the zone where the MIG is located.

The output is similar to the following:

creationTimestamp: '2024-01-10T07:51:53.034-08:00'
id: '4247139565532196982'
kind: compute#instanceGroupManagerResizeRequest
name: example-request
requestedRunDuration:
  nanos: 0
  seconds: '6000'
resizeBy: 10
selfLink: https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-a/instanceGroupManagers/example-mig/resizeRequests/example-request
selfLinkWithId: https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-a/instanceGroupManagers/example-mig/resizeRequests/4247139565532196982
state: ACCEPTED
status:
  lastAttempt:
    error:
      errors:
      - code: ZONE_RESOURCE_POOL_EXHAUSTED_WITH_DETAILS
        message: There are currently not enough resources available to fulfill the request.
      - code: QUOTA_EXCEEDED
        message: Quota 'NVIDIA_A100_GPUS' exceeded. Limit: 1500 in region us-central1.
zone: https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-a

REST

To view the details of a resize request in a MIG, make a GET request to the beta.instanceGroupManagerResizeRequests.get method.

GET https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/instanceGroupManagers/INSTANCE_GROUP_NAME/resizeRequests/RESIZE_REQUEST_NAME

Replace the following:

  • PROJECT_ID: the ID of the project where the zonal MIG is located.

  • ZONE: the zone where the MIG is located.

  • INSTANCE_GROUP_NAME: the name of an existing zonal MIG where the resize request is located.

  • RESIZE_REQUEST_NAME: the name of an existing resize request that you want to view the details of.

The output is similar to the following:

{
  "kind": "compute#instanceGroupManagerResizeRequest",
  "id": "4247139565532196982",
  "creationTimestamp": "2024-01-10T07:51:53.034-08:00",
  "name": "example-request",
  "zone": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-a",
  "count": 10,
  "resizeBy": 10,
  "requestedRunDuration": {
    "seconds": "6000",
    "nanos": 0
  },
  "state": "ACCEPTED",
  "status": {
    "lastAttempt": {
      "error": {
        "errors": [
          {
            "code": "ZONE_RESOURCE_POOL_EXHAUSTED_WITH_DETAILS",
            "message": "There are currently not enough resources available to fulfill the request.",
          },
          {
            "code": "QUOTA_EXCEEDED",
            "message": "Quota 'NVIDIA_A100_GPUS' exceeded. Limit: 1500 in region us-central1."
          }
        ]
      }
    }
  },
  "selfLink": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-a/instanceGroupManagers/example-mig/resizeRequests/example-request",
  "selfLinkWithId": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-a/instanceGroupManagers/example-mig/resizeRequests/4247139565532196982"
}

Cancel resize requests in a MIG

You can cancel resize requests in a MIG to stop the MIG from attempting to create the requested number of VMs. You can cancel accepted (ACCEPTED) resize requests only. After canceling a resize request, you can either delete it or let Compute Engine automatically delete it after 14 days.

To cancel more than one resize request at a time, use the Google Cloud console or gcloud CLI.

Console

To cancel resize requests in a zonal MIG, do the following:

  1. In the Google Cloud console, go to the Instance groups page.

    Go to Instance groups

  2. In the Name column, click the name of the MIG that contains resize requests.

    The overview page of the MIG opens.

  3. In the Resize requests row, click Edit resize requests.

    The Resize requests pane appears.

  4. Select the resize requests to cancel.

  5. Click Cancel, and then click Confirm.

gcloud

To cancel resize requests in a zonal MIG, use the beta instance-groups managed resize-requests cancel command.

gcloud beta compute instance-groups managed resize-requests cancel INSTANCE_GROUP_NAME \
    --resize-requests=RESIZE_REQUEST_NAMES \
    --zone=ZONE

Replace the following:

  • INSTANCE_GROUP_NAME: the name of an existing zonal MIG with accepted resize requests.

  • RESIZE_REQUEST_NAMES: a comma-separated list of names of accepted resize requests in the specified zonal MIG. For example, specify request-1,request-2.

  • ZONE: the zone where the MIG is located.

REST

To cancel a resize request in a zonal MIG, make a POST request to the beta.instanceGroupManagerResizeRequests.cancel method.

POST https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/instanceGroupManagers/INSTANCE_GROUP_NAME/resizeRequests/RESIZE_REQUEST_NAME/cancel

Replace the following:

  • PROJECT_ID: the ID of the project where an existing zonal MIG with an accepted resize request is located.

  • ZONE: the zone where the MIG is located.

  • INSTANCE_GROUP_NAME: the name of the MIG.

  • RESIZE_REQUEST_NAME: the name of the resize request to cancel.

Delete resize requests in a MIG

By default, Compute Engine automatically deletes a resize request 14 days after setting the request's state to one of the following:

  • Successful (SUCCEEDED)

  • Failed (FAILED)

  • Canceled (CANCELLED)

However, you can immediately delete a resize request before then, as described in this section.

Deleting a successful resize request doesn't delete the VMs created through the request. The MIG automatically deletes those VMs at the end of their requested run duration. However, if your job has finished running and you no longer need the VMs, then delete the VMs.

To delete more than one resize request at a time, use the Google Cloud console or gcloud CLI.

Console

To delete resize requests in a zonal MIG, do the following:

  1. In the Google Cloud console, go to the Instance groups page.

    Go to Instance groups

  2. In the Name column, click the name of the MIG that contains resize requests.

    The overview page of the MIG opens.

  3. In the Resize requests row, click Edit resize requests.

    The Resize requests pane appears.

  4. Select the resize requests to delete.

  5. Click Delete, and then click Confirm.

gcloud

To delete resize requests in a zonal MIG, use the beta instance-groups managed resize-requests delete command.

gcloud beta compute instance-groups managed resize-requests delete INSTANCE_GROUP_NAME \
    --resize-requests=RESIZE_REQUEST_NAMES \
    --zone=ZONE

Replace the following:

  • INSTANCE_GROUP_NAME: the name of an existing zonal MIG with successful, failed, or canceled resize requests.

  • RESIZE_REQUEST_NAMES: a comma-separated list of names of resize requests to delete in the MIG. For example, specify request-1,request-2.

  • ZONE: the zone where the MIG is located.

REST

To delete a resize request in a zonal MIG, make a DELETE request to the beta.instanceGroupManagerResizeRequests.delete method.

DELETE https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/instanceGroupManagers/INSTANCE_GROUP_NAME/resizeRequests/RESIZE_REQUEST_NAME

Replace the following:

  • PROJECT_ID: the ID of the project where an existing zonal MIG with successful, failed, or canceled resize requests is located.

  • ZONE: the zone where the MIG is located.

  • INSTANCE_GROUP_NAME: the name of the MIG.

  • RESIZE_REQUEST_NAME: the name of the resize request to delete.

What's next