A RetroSearch Logo

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

Search Query:

Showing content from http://cloud.google.com/compute/docs/instances/deleting-instance below:

Delete a Compute Engine instance | Compute Engine Documentation

Skip to main content Delete a Compute Engine instance

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

This document explains how to delete a Compute Engine instance. To learn more about the lifecycle of an instance, see Compute Engine instance lifecycle.

If you no longer need an instance, then delete it to stop incurring charges for the instance and its attached resources.

Caution: If you delete an instance in a managed instance group (MIG) that uses autoscaler, then the MIG may automatically create a new instance to replace the deleted instance. To prevent this, resize the MIG or reconfigure its autoscaler. Before you begin Required roles

To get the permissions that you need to delete 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 delete a compute instance. To see the exact permissions that are required, expand the Required permissions section:

Required permissions

The following permissions are required to delete a compute instance:

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

Billing implications

After you delete a compute instance, you stop incurring charges for the instance and its attached resources, except in the following cases:

For more information, see VM instances pricing.

Preserve attached resources

In some cases, before you delete a compute instance, you might want to preserve one of its attached resources. You can preserve attached resources by doing the following:

Delete instances

When you delete a compute instance, Compute Engine stops the instance before deleting it.

If you delete one or more instances simultaneously, then you must decide what happens to the attached disks:

Delete instances and all attached resources

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

To delete one or more instances and all attached resources, 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 instances that you want to delete.

  3. Click delete Delete.

  4. In the dialog, do the following:

    1. Optional: To delete 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 Delete.

gcloud

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

gcloud compute instances delete INSTANCE_NAMES \
    --zone=ZONE

Replace the following:

Optionally, you can do one or both of the following:

C# Go Java Node.js PHP Python Ruby REST

To delete an instance, make a DELETE request to the instances delete method:

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

Replace the following:

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

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.

DELETE https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/instances/VM_NAME?noGracefulShutdown=true
Delete instances and preserve disks

By default, deleting a compute instance deletes the instance and its attached resources. However, when you delete an instance using the gcloud CLI, you can specify to preserve the attached disks, regardless of their auto-delete settings.

To delete one or more instances in the same zone while preserving their attached disks, use the gcloud compute instances delete command with the --keep-disks flag:

gcloud compute instances delete INSTANCE_NAMES \
    --keep-disks=KEEP_DISK_TYPE \
    --zone=ZONE

Replace the following:

Optionally, if you've enabled graceful shutdown in one or more instances, you can delete the instances without gracefully shutting them down, or manually end an ongoing graceful shutdown. To do so, use the gcloud beta compute instances delete 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 delete VM_NAMES \
    --keep-disks=KEEP_DISK_TYPE \
    --no-graceful-shutdown \
    --zone=ZONE
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-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."],[[["Deleting a Compute Engine instance stops charges for the instance and its attached resources, but you must also delete attached disks and other resources to avoid further charges."],["If you delete an instance in a managed instance group with autoscaling, the group might automatically create a replacement instance unless you resize the group or reconfigure the autoscaler."],["You can choose to delete instances with or without their attached resources, with options to delete all attached resources, or to preserve all, only boot, or only non-boot disks."],["To delete an instance via command-line, use the `gcloud compute instances delete` command, and to force the deletion of attached disks use the `--delete-disks` flag; alternatively, you can choose to preserve disks with the `--keep-disks` flag."],["If you have enabled graceful shutdown on an instance you have the option to delete it without gracefully shutting it down, by selecting the applicable checkbox on the console, or by using the `--no-graceful-shutdown` flag with the `gcloud beta compute instances delete` command."]]],[]]


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