A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cloud.google.com/compute/docs/instances/stop-start-instance below:

Stop or restart a Compute Engine instance | Compute Engine Documentation

Skip to main content Stop or restart a Compute Engine instance

Stay organized with collections Save and categorize content based on your preferences.

Linux Windows

This document explains how to stop or restart a Compute Engine instance. To learn more about suspending, stopping, or resetting an instance, see Suspend, stop, or reset Compute Engine instances.

Stopping an instance is useful when you no longer use it, or to modify its properties—for example, to change its machine type, or remove any attached and mounted disks. After you stop the instance, you can do the following:

To automate stopping or restarting an instance, see the following instead:

Before you begin Required roles

To get the permissions that you need to stop or restart a compute instance, 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 to projects, folders, and organizations.

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:

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

Stop an instance

When you stop a compute instance, or Compute Engine does so for a scheduled action, the instance retains its attached resources, configuration settings, internal IP addresses, MAC addresses, and metadata. However, the instance loses its in-memory data and application state. If you need to retain these states, then suspend the instance instead.

Important: You keep incurring charges for any resources attached to a stopped instance. To avoid unnecessary costs, detach and delete any resources that you no longer need.

You can stop an instance using the following methods, depending on whether the instance has Local SSD disks attached and how you want to handle any shutdown scripts:

Stop an instance without Local SSD disks

Depending on what you want to do when stopping an instance, use the following options:

To stop one or more instances, select one of the following options:

Console
  1. In the Google Cloud console, go to the VM instances page.

    Go to VM instances

  2. Select the running instances to stop.

  3. Click stop Stop. If there is no Stop option, click more_vert More actions > stop Stop.

  4. In the dialog, do the following:

    1. Optional: To stop the instances without gracefully shut them down, or end an ongoing graceful shutdown, select the Skip graceful shutdown (if applicable) checkbox.

    2. To confirm, click Stop.

gcloud

To stop one or more instances in the same zone, use the gcloud compute instances stop command:

gcloud compute instances stop INSTANCE_NAMES \
    --zone=ZONE

Replace the following:

Optionally, if you've enabled graceful shutdown in one or more instances, then you can stop the instances without gracefully shutting them down, or manually end an ongoing graceful shutdown. To do so, use the gcloud beta compute instances stop command with the --no-graceful-shutdown flag:

Preview — The --no-graceful-shutdown 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 stop INSTANCE_NAMES \
    --no-graceful-shutdown \
    --zone=ZONE
Go Java Node.js PHP Python REST

To stop an instance, make a POST request to the instances.stop method:

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/stop

Replace the following:

Optionally, if you've enabled graceful shutdown in an instance, you can stop the instance without gracefully shutting it down, or manually end an ongoing graceful shutdown. To do so, make a POST request to the instances.stop method. In the request URL, include the noGracefulShutdown=true query parameter:

Preview — The noGracefulShutdown 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/VM_NAME/stop?noGracefulShutdown=true
Stop an instance with Local SSD disks

Depending on what you want to do when stopping a compute instance, use the following options:

To stop one or more instances that have Local SSD disks attached, select one of the following options:

Console
  1. In the Google Cloud console, go to the VM instances page.

    Go to VM instances

  2. Select the running instances to stop.

  3. Click stop Stop. If there is no Stop option, click more_vert More actions > stop Stop.

  4. In the dialog, do the following:

    1. Optional: To stop the instances without gracefully shut them down, or end an ongoing graceful shutdown, select the Skip graceful shutdown (if applicable) checkbox.

    2. To confirm, click Stop.

gcloud

When stopping one or more instances in the same zone that have Local SSD disks attached, specify whether to discard or preserve Local SSD data as follows:

Replace the following:

Optionally, if you've enabled graceful shutdown in one or more instances, you can stop the instances without gracefully shutting them down, or end an ongoing graceful shutdown. To do so, use the gcloud beta compute instances stop command with the --no-graceful-shutdown flag:

Preview — The --no-graceful-shutdown 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 stop INSTANCE_NAMES \
    --discard-local-ssd=DISCARD_LOCAL_SSD \
    --no-graceful-shutdown \
    --zone=ZONE

Replace DISCARD_LOCAL_SSD with true to discard the data in the Local SSD disks, or false to preserve the data.

REST

When stopping an instance that has Local SSD disks attached, specify whether to discard or preserve Local SSD data as follows:

Replace the following:

Optionally, if you've enabled graceful shutdown in an instance, then you can stop the instance without gracefully shutting it down, or manually end an ongoing graceful shutdown. To do so, make a POST request to the instances.stop method. In the request URL, include the noGracefulShutdown=true query parameter:

Preview — The noGracefulShutdown 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/VM_NAME/stop?discardLocalSsd=DISCARD_LOCAL_SSD&noGracefulShutdown=true

Replace DISCARD_LOCAL_SSD with true to discard the data in the Local SSD disks, or false to preserve the data.

Stop an instance from the guest OS

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:

Linux
  1. If you haven't already, then connect to the instance.

  2. To stop the instance, select one of the following methods:

Windows
  1. If you haven't already, then connect to the instance using one of the following methods:

  2. To stop the instance, select one of the following methods:

Restart an instance

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 encrypted disks attached:

Restart an instance without encrypted disks

You can restart multiple compute 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:

Console
  1. In the Google Cloud console, go to the VM instances page.

    Go to VM instances

  2. Select one or more instances.

  3. Click play_arrow Start / Resume.

gcloud

To restart one or more instances in the same zone, use the gcloud compute instances start command:

gcloud compute instances start INSTANCE_NAMES \
    --zone=ZONE

Replace the following:

Go Java Node.js PHP Python REST

To restart an instance, make a POST request to the instances.start method:

 POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/start

Replace the following:

Restart an instance with encrypted disks

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.

You can restart 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:

Console
  1. In the Google Cloud console, go to the VM instances page.

    Go to VM instances

  2. Select the instances to restart.

  3. Click play_arrow Start / Resume.

  4. Specify encryption keys for each of the encrypted disks that are attached to the instances, and then click Start.

gcloud

To restart one or more instances that use encrypted disks in the same zone, use the gcloud compute instances start command with the --csek-key-file flag. If you're using an RSA-wrapped key, then use the gcloud beta compute instances start command with the --csek-key-file flag instead:

gcloud compute instances start INSTANCE_NAMES \
    --csek-key-file=ENCRYPTION_KEY_FILE \
    --zone=ZONE

Replace the following:

Go Java Node.js PHP Python REST

To restart an instance that uses encrypted disks, make a POST request to the instances.startWithEncryptionKey method:

POST  https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/startWithEncryptionKey

{
  "disks": [
    {
      "source": "DISK_URL",
      "diskEncryptionKey": {
        "ENCRYPTION_TYPE": "ENCRYPTION_KEY"
      }
    }
  ]
}

Replace the following:

What's next

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-05-08 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-05-08 UTC."],[[["This guide details the process of stopping and restarting Compute Engine instances, outlining methods for both instances with and without Local SSD disks."],["Stopping an instance retains its resources and settings but clears in-memory data, and can be done via the console, gcloud CLI, guest OS, or API, with options to discard or preserve data on Local SSD disks."],["To use code samples in local development, it is necessary to install and initialize the gcloud CLI and to set up Application Default Credentials for user authentication."],["Restarting a fully stopped instance is possible through various methods, including the console, gcloud CLI, and REST API, with specific steps for instances with or without encrypted disks."],["When restarting instances with customer-supplied encryption keys, you must provide the encryption key information, and there is an option to use RSA-wrapped keys."]]],[]]


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.3