Stop or restart a Compute Engine instance
Stay organized with collections
Save and categorize content based on your preferences.
Linux
Windows
You can manually stop a Compute Engine instance when you longer use it, or to
modify its properties—for example, to change its machine type, or remove
any attached and mounted disks. After the instance stops, you can either restart
it to resume your workload, or delete the instance if you no longer need it.
This document explains how to manually stop or restart an instance. To automate
stopping or restarting an instance, see the following:
You can only restart an instance if there are sufficient resources in the
instance's zone.
You can't restart TPU instances.
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:
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:
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.
To 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.
To 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.
To 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.
To 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.
This predefined role contains
the permissions required to stop or restart a compute instance. To see the exact permissions that are
required, expand the Required permissions section:
Required permissions
The following permissions are required to stop or restart a compute instance:
To stop an instance:
compute.instances.stop
on the instance
To stop an instance from the guest OS:
compute.instances.setMetadata
on the instance if it uses instance-level public SSH keys.
To restart an instance:
compute.instances.start
on the instance
To restart an instance that uses encryption keys:
compute.instances.startWithEncryptionKey
on the instance
When you stop a compute instance, or Compute Engine does so for a
scheduled action, the instance retains its attached disks, configuration
settings, IP addresses, MAC addresses, and instance metadata. If you also want
to retain in-memory data and application state, then
suspend the instance.
Depending on whether the instance has Local SSD disks attached and how you want
to handle any shutdown scripts, stop your
instance by using one of the following methods:
Stop an instance from Google Cloud. You can stop one or more
instances simultaneously from Google Cloud. If the instances have
Local SSD disks attached, then you can choose whether to discard or preserve
(Preview) Local
SSD data. Any shutdown scripts in the instance must finish running by the
default shutdown period.
Stop an instance from the guest OS. You can stop a single instance from
within its guest OS. This approach lets you stop an instance only after its
shutdown scripts finish running. If you enabled
graceful shutdown,
then you can also stop the instance without gracefully shutting it down, or
end an ongoing graceful shutdown. Unless you manually back up data from any
attached Local SSD disks to durable storage volume, stopping an instance
from within its guest OS discards any data on those disks.
Depending on what you want to do when stopping an instance, use the following
options:
If you've enabled graceful shutdown in the instance, then you can
stop the instance without gracefully shutting it down or end an ongoing
graceful shutdown using the Google Cloud console, gcloud CLI, or
REST API.
To stop multiple instances simultaneously, use the Google Cloud console
or, for instances located in the same zone, the gcloud CLI.
To stop one or more instances, select one of the following options:
Depending on what you want to do when stopping a compute instance, use the
following options:
If you've enabled graceful shutdown in the instance, then you can
stop the instance without gracefully shutting it down or end an ongoing
graceful shutdown using the Google Cloud console, gcloud CLI,
or REST API.
To preserve the data of the Local SSD disks attached to an instance
(excluding machine types that use Titanium SSD),
stop the instance using the gcloud CLI
or REST API.
To stop multiple instances simultaneously, use the Google Cloud console
or, for instances located in the same zone, the gcloud CLI.
To stop one or more instances that have Local SSD disks attached, select one of
the following options:
If a compute instance has Local SSD disks attached, then shutting down the guest
OS automatically discards the Local SSD data. To preserve this data, manually
copy the data to a persistent storage option before stopping the instance.
To stop an instance from the guest OS, select one of the following options:
You can restart a compute instance that has been fully stopped, which is when
the instance state is TERMINATED.
If you chose to preserve the data of your Local SSD disks when stopping the
instance, then you might need to remount the Local SSD disks after restarting
it. For more information about how to mount Local SSD disks, see
Format and mounting a Local SSD device.
To restart an instance, use one of the following methods based on whether the
instance has disks that were encrypted with
customer-supplied encryption keys (CSEK):
Restart an instance that doesn't have CSEK-encrypted disks
To restart multiple instances simultaneously across different zones, use the
Google Cloud console. For instances located within the same zone, you can use
the gcloud CLI. Otherwise, for other restart scenarios, select one of
the following options:
When you restart a stopped compute instance that has attached disks that were
encrypted using
customer-supplied encryption keys,
you must supply the encryption key information.
To restart multiple instances simultaneously across different zones, use the
Google Cloud console. For instances located within the same zone, you can use
the gcloud CLI. Otherwise, for other restart scenarios, select one of
the following options:
[[["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 2026-07-17 UTC."],[],[]]