Accelerate scale out with suspended and stopped VMs Stay organized with collections Save and categorize content based on your preferences.
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
- Review the introductory page aboutsuspended and stopped VMs in a MIG.
- If you haven't already, set upauthentication. 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:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
Install the Google Cloud CLI. After installation,initialize the Google Cloud CLI by running the following command:
gcloudinit
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.- Set a default region and zone.
Terraform
To use the Terraform samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
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.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.If you're using a local shell, then create local authentication credentials for your user account:
gcloudauthapplication-defaultlogin
You don't need to do this if you're using Cloud Shell.
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
For more information, see Set up authentication for a local development environment.
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.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.For more information, seeAuthenticate for using REST in the Google Cloud authentication documentation.
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
In the Google Cloud console, go to theInstance groups page.
Click the name of the instance group that you want to edit.
ClickEdit to modify this managed instance group.
ClickAdvanced options to expand the section.
In theStandby pool section, selectScale-out.
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.
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, replace
zones/ZONEwithregions/REGIONand specify the region ofthe MIG.
- For a regional MIG, replace
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
In the Google Cloud console, go to theInstance groups page.
Click the name of the instance group that you want to edit.
ClickEdit to modify this managed instance group.
ClickAdvanced options to expand the section.
In theStandby pool section, enter the new sizes in theSuspended VMs andStopped VMs fields.
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, replace
zones/ZONEwithregions/REGIONand specify the region ofthe MIG.
- For a regional MIG, replace
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
- Learn how tomanually suspend or stop VMs in a MIG.
- Learn more aboutupdates for suspended and stopped VMs in a MIG.
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.