Accelerate scale out with suspended and stopped VMs

This document explains how the standby pool of suspended and stopped virtualmachine (VM) instances works and how you can use the standby poolto accelerate the scale out of a managed instance group (MIG).

Before you begin

Use MIG API for autoscaling

We recommend that you use Compute Engine autoscaler for autoscalingyour MIG. However, if for some reason you prefer to use a different autoscaler,use the endpoints of theMIG APIto handle suspended and stopped VMs.

Choose between suspended and stopped pools

Choosing between suspended and stopped pools depends on your specific use case.For best performances, you should experiment with different standby pool typesfor your scale out scenarios to determine which one best suits your needs.Different workloads might show shorter time to serve with different options.In some cases, the operation of copying the memory state from storageto the VM might take more time than restarting the VM or creating a new VMfrom scratch.

To find the best approach, start from these guidelines:

  • Use suspended VMs if your VMs require a time-consuming memory initialization,because suspended VMs preserve the memory state.Make sure that your application can be suspended and resumed.Keeping the memory state requires additional storage and might incur extracosts.
  • Use stopped VMs if your VM initialization focuses mainly on theinitialization of data stored in the persistent disks.

Edit the standby policy in a MIG

This section describes how to set the standby pool mode to scale out pool andthe initial delay.

Console

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

    Go to Instance groups

  2. Click the name of the instance group that you want to edit.

  3. ClickEdit to modify this managed instance group.

  4. ClickAdvanced options to expand the section.

  5. In theStandby pool section, selectScale-out.

  6. In theInitial delay field, enter the number of seconds that the MIGshould wait before suspending or stopping a VM. The initial delay givesthe initialization script the time to prepare your VM for quick scaleout.

  7. ClickSave.

gcloud

Use theinstance-groups managed update commandand specify the operation mode and the initial delay.

gcloud compute instance-groups managed updateMIG_NAME \  --standby-policy-mode=scale-out-pool \  --standby-policy-initial-delay=DELAY \  [--region=REGION | --zone=ZONE]

Replace the following:

  • MIG_NAME: the name of the MIG.
  • DELAY: the number of seconds that theMIG should wait before suspending or stopping a VM.The initial delay gives the initialization script the time to prepareyour VM for quick scale out.
  • REGION: for a regional MIG, the regionwhere the MIG is located.
  • ZONE: for a zonal MIG, the zonewhere the MIG is located.

Terraform

The following sample creates a zonal MIG with a standby policy. Use thestandby_policy block to set an initial delay and to set the mode toSCALE_OUT_POOL.

The sample uses thegoogle_compute_instance_group_managerresource.For a regional MIG, use thegoogle_compute_region_instance_group_managerresource.

resource "google_compute_instance_group_manager" "default" {  name               = "standby-mig"  base_instance_name = "test"  target_size        = 3  zone               = "us-central1-f"  version {    instance_template = google_compute_instance_template.default.id    name              = "primary"  }  standby_policy {    initial_delay_sec = 50    mode              = "SCALE_OUT_POOL"  }}

To learn how to apply or remove a Terraform configuration, seeBasic Terraform commands.

REST

Use theinstanceGroupManager.patch methodand specify the operation mode and initial delay in the request body.For regional MIGs, use theregionInstanceGroupManager.patch method.

PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instanceGroupManagers/MIG_NAME{// ..."standbyPolicy": {  "mode": "SCALE_OUT_POOL",  "initialDelaySec":DELAY}// ...}

Replace the following:

  • PROJECT_ID: the ID of your project.
  • ZONE: for a zonal MIG, the zone where the MIG islocated.
    • For a regional MIG, replacezones/ZONE withregions/REGION and specify the region ofthe MIG.
  • MIG_NAME: the name of the MIG.
  • DELAY: the number of seconds that theMIG should wait before suspending or stopping a VM.The initial delay gives the initialization script the time to prepareyour VM for quick scale out.

Resize the standby pool in a MIG

This section describes how to resize the standby pools of suspended and stoppedVMs in a MIG.

Console

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

    Go to Instance groups

  2. Click the name of the instance group that you want to edit.

  3. ClickEdit to modify this managed instance group.

  4. ClickAdvanced options to expand the section.

  5. In theStandby pool section, enter the new sizes in theSuspended VMs andStopped VMs fields.

  6. ClickSave.

gcloud

Use theinstance-groups managed update commandwith the--suspended-size and--stopped-size flags.

gcloud compute instance-groups managed updateMIG_NAME \--suspended-size=SUSPENDED_SIZE \--stopped-size=STOPPED_SIZE \[--region=REGION | --zone=ZONE]

Replace the following:

  • MIG_NAME: the name of the MIG in whichto suspend an instance.
  • SUSPENDED_SIZE: the number of suspended VMsthat the MIG should maintain at any given time.
  • STOPPED_SIZE: the number of stopped VMsthat the MIG should maintain at any given time.
  • REGION: for a regional MIG, the regionwhere the MIG is located.
  • ZONE: for a zonal MIG, the zonewhere the MIG is located.

Terraform

The following sample creates a zonal MIG with target sizes for suspended andstopped VMs. To set the target sizes, use thetarget_suspended_size and thetarget_stopped_size arguments.

The sample uses thegoogle_compute_instance_group_managerresource.For a regional MIG, use thegoogle_compute_region_instance_group_managerresource.

resource "google_compute_instance_group_manager" "default" {  name                  = "standby-mig"  base_instance_name    = "test"  target_size           = 1  target_suspended_size = 1  target_stopped_size   = 2  zone                  = "us-central1-f"  version {    instance_template = google_compute_instance_template.default.id    name              = "primary"  }  standby_policy {    initial_delay_sec = 50    mode              = "SCALE_OUT_POOL"  }}

To learn how to apply or remove a Terraform configuration, seeBasic Terraform commands.

REST

Use theinstanceGroupManager.patch methodand specify the sizes of pools of suspended and stopped VMs in the requestbody.For regional MIGs, use theregionInstanceGroupManager.patch method.

PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instanceGroupManagers/MIG_NAME{// ..."targetSuspendedSize":SUSPENDED_SIZE,"targetStoppedSize":STOPPED_SIZE// ...}

Replace the following:

  • PROJECT_ID: the ID of your project.
  • ZONE: for a zonal MIG, thezone where the MIG is located.
    • For a regional MIG, replacezones/ZONE withregions/REGION and specify the region ofthe MIG.
  • MIG_NAME: the name of the MIG in which to stopan instance.
  • SUSPENDED_SIZE: the number of suspended VMsthat the MIG should maintain at any given time.
  • STOPPED_SIZE: the number of stopped VMsthat the MIG should maintain at any given time.

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.