Stay organized with collections Save and categorize content based on your preferences.
Linux Windows
This document explains how to suspend or resume Compute Engine instances. To learn more about suspending, stopping, or resetting instances, see Suspend, stop, or reset Compute Engine instances.
If you want to keep your Compute Engine instance around, but you don't want to incur charges for it when the instance isn't in use, then you can suspend the instance. Suspending an instance preserves the instance and migrates the contents of the instance's memory to storage. After resuming the instance, Compute Engine migrates the instance's memory from storage back to the instance, and the instance starts running again.
Suspending a Compute Engine instance is useful for the following:
Development and test environments that are not being fully used during off periods, such as during evenings or weekends, and that you want to maintain for costs saving or faster initialization than creating new instances.
Applications that require a long period of initialization after the instance has finished booting, but before the application is ready to service its first request, such as virtual developer workstations or complex Java applications.
Select the tab for how you plan to use the samples on this page:
ConsoleWhen you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloudInstall the Google Cloud CLI. After installation, initialize the Google Cloud CLI by running the following command:
gcloud init
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
.To use the Go 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:
gcloud auth application-default login
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.
JavaTo use the Java 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:
gcloud auth application-default login
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.
Node.jsTo use the Node.js 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:
gcloud auth application-default login
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.
PHPTo use the PHP 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:
gcloud auth application-default login
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.
PythonTo use the Python 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:
gcloud auth application-default login
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.
RESTTo 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.
To get the permissions that you need to suspend or resume a compute instance, ask your administrator to grant you the Compute Instance Admin (v1) (roles/compute.instanceAdmin.v1
) IAM role on the instance. For more information about granting roles, see Manage access to projects, folders, and organizations.
This predefined role contains the permissions required to suspend or resume a compute instance. To see the exact permissions that are required, expand the Required permissions section:
Required permissionsThe following permissions are required to suspend or resume a compute instance:
compute.instances.suspend
compute.instances.resume
You might also be able to get these permissions with custom roles or other predefined roles.
LimitationsWhen suspending a compute instance, the following limitations apply:
You can only suspend an instance if the guest OS supports it. For more information, see Operating system details.
You can only suspend an instance that uses Debian 8 or 9 as guest OS if you configure the OS before suspending the instance.
You can only suspend an instance for up to 60 days before Compute Engine automatically transitions its state to TERMINATED
.
You can suspend Spot VMs or preemptible instances—however, if Compute Engine preempts the instance before the suspend operation completes, Compute Engine ends the suspend operation and preempts the instances.
You can't suspend instances with GPUs attached.
You can't suspend bare metal instances.
You can't suspend Confidential VMs.
You can't suspend instances by using the standard processes that are built into their guest environment. Commands such as systemctl suspend
in Ubuntu 16.04 or later, aren't supported. If called, then Compute Engine ignores the in-guest signal.
You can't suspend instances with more than 208 GB of memory.
You can't suspend instances that have CSEK-protected disks attached.
If a compute instance is running Debian 8 and 9 as its guest OS, then, before suspending the instance, you must enable suspend and resume operations by doing one of the following:
Recommended: Configure the ACPID
To enable the suspend and resume operation in Debian 8 or 9, you can configure the Advanced Configuration and Power Interface events Daemon (ACPID) to handle the sleep button event. After enabling the deep sleep button event, you can add a shell script for handling the sleep event as described in this section.
To configure the ACPID to support suspend and resume operations, do the following:
If you haven't already, then connect to your Linux instance.
Create the events
folder in the acpi
folder:
sudo mkdir -p /etc/acpi/events/
Configure the ACPID to handle the sleep button event:
cat <<EOF | sudo tee /etc/acpi/events/sleepbtn-acpi-support
event=button[ /]sleep
action=/etc/acpi/sleepbtn-acpi-support.sh
EOF
Create the sleep event handling script:
cat <<EOF | sudo tee /etc/acpi/sleepbtn-acpi-support.sh
#!/bin/sh
echo mem > /sys/power/state
EOF
Set up the permissions for the script:
sudo chmod 755 /etc/acpi/sleepbtn-acpi-support.sh
To make the changes effective, restart the ACPID:
sudo systemctl restart acpid.service
To enable the suspend and resume operation in Debian 8 or 9, you can install D-Bus.
To install D-Bus in your compute instance's guest OS when the OS is using Debian 8 or 9, do the following:
If you haven't already, then connect to your Linux instance.
Install D-Bus:
sudo apt-get install dbus
To make the changes effective, restart logind
:
sudo systemctl restart systemd-logind.service
If the guest OS of your compute instance is using Debian 8 or 9, then, before suspending the instance, you must configure the guest OS to support suspend and resume operations as described in this document.
To suspend an instance, use of the following methods based on whether the instance has Local SSD disks attached:
If your instance doesn't have any Local SSD disks attached, then see Suspend an instance without Local SSD disks.
If your instance has any Local SSD disks attached, and you want to either discard or preserve (Preview) the disks' Local SSD data, then see Suspend an instance with Local SSD disks.
You can suspend multiple compute instances simultaneously or individual instances. For multiple instances, use the Google Cloud console or, for instances located in the same zone, the Google Cloud CLI. For individual instances, select any of the following options:
ConsoleIn the Google Cloud console, go to the VM instances page.
Select one or more instances to suspend.
Click pause Suspend, and then click Suspend to confirm.
To suspend one or more instances in a single zone, use the gcloud compute instances suspend
command:
gcloud compute instances suspend INSTANCE_NAMES \
--zone=ZONE
Replace the following:
INSTANCE_NAMES
: a whitespace-separated list of names of instances—for example, instance-01 instance-02 instance-03
.
ZONE
: the zone where the instances are located.
To suspend an instance, make a POST
request to the instances.suspend
method:
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/suspend
Replace the following:
PROJECT_ID
: the ID of the project where the instance is located.
ZONE
: the zone where the instance is located.
INSTANCE_NAME
: the name of the instance.
Based on how many compute instances you want to suspend simultaneously and whether you need to preserve the data of their attached Local SSD disks, do the following:
To preserve the data of the Local SSD disks attached to an instance (excluding Z3 instances), suspend the instance using the gcloud CLI or REST API.
Caution: Compute Engine uses persistent storage to store your Local SSD data. Before suspending an instance, ensure that you have enough quota for the storage space used. Otherwise, suspending the instance fails. For more information, see Stop or suspend a VM with Local SSD disks.To suspend multiple instances simultaneously, use the Google Cloud console or, for instances located in the same zone, the gcloud CLI.
To suspend one or more instances that have Local SSD disks attached, select one of the following options:
ConsoleIn the Google Cloud console, go to the VM instances page.
Select one or more instances to suspend.
Click pause Suspend, and then click Suspend to confirm.
When suspending one or more instances in a single zone that have Local SSD disks attached, specify whether to discard or preserve Local SSD data as follows:
To discard Local SSD data, use the gcloud compute instances suspend
command with the --discard-local-ssd=true
flag:
gcloud compute instances suspend INSTANCE_NAMES \
--discard-local-ssd=true \
--zone=ZONE
To preserve Local SSD data, use the gcloud beta compute instances suspend
command with the --discard-local-ssd=false
flag:
Preview — The --discard-local-ssd=false
flag
This feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the Service Specific Terms. Pre-GA features are available "as is" and might have limited support. For more information, see the launch stage descriptions.
gcloud beta compute instances suspend INSTANCE_NAMES \
--discard-local-ssd=false \
--zone=ZONE
Replace the following:
INSTANCE_NAMES
: a whitespace-separated list of names of instances—for example, instance-01 instance-02 instance-03
.
ZONE
: the zone where the instances are located.
When suspending an instance that has Local SSD disks attached, specify whether to discard or preserve Local SSD data as follows:
To discard Local SSD data, make a POST
request to the instances.suspend
method. In the request URL, include the discardLocalSsd
query parameter set to true
:
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/suspend?discardLocalSsd=true
To preserve Local SSD data, make a POST
request to the beta.instances.suspend
method. In the request URL, include the discardLocalSsd
query parameter set to false
:
Preview — The discardLocalSsd=false
query parameter
This feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the Service Specific Terms. Pre-GA features are available "as is" and might have limited support. For more information, see the launch stage descriptions.
POST https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/suspend?discardLocalSsd=false
Replace the following:
PROJECT_ID
: the ID of the project where the instance is located.
ZONE
: the zone where the instance is located.
INSTANCE_NAME
: the name of the instance.
Before resuming a suspended compute instance, consider the following:
You can resume an instance only if there is sufficient capacity in the zone where the instance is located. This isn't usually a problem. If you have troubles resuming an instance, then try again later.
If you attached Local SSD disks to the instance and chose to preserve Local SSD data when suspending it, then you might need to remount the Local SSD disks after resuming it. For more information, see how to remount non-boot disks on Linux instances or Windows instances.
You can resume multiple instances simultaneously or individual instances. For multiple instances, use the Google Cloud console or, for instances located in the same zone, the gcloud CLI. For individual instances, select any of the following options:
ConsoleIn the Google Cloud console, go to the VM instances page.
Select one or more suspended instances to resume.
Click play_arrow Start / Resume, and then click Start.
To resume one or more suspended instances in a single zone, use the gcloud compute instances resume
command:
gcloud compute instances resume INSTANCE_NAMES \
--zone=ZONE
Replace the following:
INSTANCE_NAMES
: a whitespace-separated list of names of instances—for example, instance-01 instance-02 instance-03
.
ZONE
: the zone where the suspended instances are located.
To resume a suspended instance, make a POST
request to the instances.resume
method:
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/resume
Replace the following:
INSTANCE_NAME
: the name of the suspend instance to resume.
PROJECT_ID
: the ID of the project where the suspended instance is located.
ZONE
: the zone where the suspended instance is located.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["This document provides instructions on how to suspend and resume Compute Engine instances, which can be used to pause billing for instances that are not in active use while preserving the instance's state."],["Suspending an instance involves migrating its memory to storage, and resuming it brings the memory back from storage, allowing for cost savings and quicker reinitialization compared to creating new instances."],["There are specific limitations for suspending instances, such as restrictions based on the guest OS, attached GPUs, certain types of instances, memory size, and the use of CSEK-protected disks."],["Suspending instances with Local SSD disks requires choosing whether to discard or preserve the data, and preserving the data requires enough storage quota."],["Resuming a suspended instance requires sufficient capacity in the instance's zone and may involve remounting Local SSD disks if their data was preserved during suspension."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4