This document explains how to view the settings and progress of a graceful shutdown in a Compute Engine instance.
When you view the details of a compute instance, you can do the following:
View graceful shutdown settings: check if graceful shutdown is enabled and, if so, view its maximum duration.
Monitor a graceful shutdown: if a graceful shutdown is in progress, then you can check the time remaining and whether Compute Engine is stopping or deleting the compute instance.
To learn more about the requirements and limitations that you apply when you gracefully shut down a compute instance, see About graceful shutdown.
Before you begin
-
If you haven't already, set up authentication.
Authentication verifies your identity for access to Cloud de Confiance by S3NS 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 Cloud de Confiance console to access Cloud de Confiance by S3NS services and APIs, you don't need to set up authentication.
gcloud
-
Install the Google Cloud CLI, and then sign in to the gcloud CLI with your federated identity. After signing in, initialize the Google Cloud CLI by running the following command:
gcloud init - Set a default region and zone.
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, and then sign in to the gcloud CLI with your federated identity.
For more information, see Authenticate for using REST in the Cloud de Confiance authentication documentation.
-
Required roles
To get the permissions that you need to view the graceful shutdown for a compute instance, ask your administrator to grant you the following IAM roles on your project:
- Compute Viewer (
roles/compute.viewer) -
To view the logs for a compute instance:
Logs Viewer (
roles/logging.viewer)
For more information about granting roles, see Manage access to projects, folders, and organizations.
These predefined roles contain the permissions required to view the graceful shutdown for a compute instance. To see the exact permissions that are required, expand the Required permissions section:
Required permissions
The following permissions are required to view the graceful shutdown for a compute instance:
-
To view the details of a compute instance:
compute.instances.geton the project -
To view a list of compute instances:
compute.instances.liston the project -
To view a list of Compute Engine operations globally:
compute.globalOperations.liston the project -
To view a list of Compute Engine operations in a region:
compute.regionOperations.liston the project -
To view a list of Compute Engine operations in a zone:
compute.zoneOperations.liston the project -
To view a list of logs:
logging.logEntries.liston the project
You might also be able to get these permissions with custom roles or other predefined roles.
View graceful shutdown settings
To view the graceful shutdown settings in a compute instance, select one of the following options:
Console
In the Cloud de Confiance console, go to the VM instances page.
In the Name column, click the name of your compute instance. The details page of the compute instance opens on the Details tab.
To check the graceful shutdown settings, in the Availability policies section, check the value of the Graceful shutdown maximum duration field. This field shows the graceful shutdown period. If it shows a hyphen (-), then graceful shutdown is disabled.
gcloud
To view the graceful shutdown settings in a compute instance, use the
gcloud compute instances describe command:
gcloud compute instances describe INSTANCE_NAME \
--zone=ZONE
Replace the following:
INSTANCE_NAME: the name of the compute instance.ZONE: the zone where the compute instance exists.
If graceful shutdown is enabled, then the output is similar to the following:
...
scheduling:
...
gracefulShutdown:
enabled: true
maxDuration:
seconds: 'MAX_DURATION'
...
...
The output includes the MAX_DURATION value, indicating the
maximum duration of the graceful shutdown in seconds. If you didn't specify
a custom duration when you enabled graceful shutdown, then
Compute Engine omits the maxDuration field and uses a default
duration of 10 minutes.
REST
To view the graceful shutdown settings in a compute instance, make a GET
request to
instances.get method:
GET https://compute.s3nsapis.fr/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME
Replace the following:
PROJECT_ID: the ID of the project where you created the compute instance.ZONE: the zone where the compute instance exists.INSTANCE_NAME: the name of the compute instance.
If graceful shutdown is enabled, then the output is similar to the following:
{
...
"scheduling": {
...
"gracefulShutdown": {
"enabled": true,
"maxDuration": {
"seconds": "MAX_DURATION"
}
}
},
...
}
The output includes the MAX_DURATION value, indicating the
maximum duration of the graceful shutdown in seconds. If you didn't specify
a custom duration when you enabled graceful shutdown, then
Compute Engine omits the maxDuration field and uses a default
duration of 10 minutes.
Monitor graceful shutdown
To monitor an ongoing graceful shutdown in a compute instance, use one of the following methods:
Monitor graceful shutdown by using the Cloud de Confiance console, gcloud CLI, or REST API
Monitor graceful shutdown by viewing Compute Engine operations
Monitor graceful shutdown by using the Cloud de Confiance console, gcloud CLI, or REST API
After Compute Engine stops or deletes a compute instance and a graceful shutdown starts, you can view the details of the compute instance to monitor when the graceful shutdown starts and completes.
To monitor an ongoing graceful shutdown in a compute instance by using the Cloud de Confiance console, gcloud CLI, or REST API, select one of the following options:
Console
In the Cloud de Confiance console, go to the VM instances page.
In the Name column, click the name of your compute instance. The details page of the compute instance opens on the Details tab.
If a graceful shutdown is in progress, check the following fields in the Basic information section:
Status: Shows the state of your compute instance. During a graceful shutdown, this displays Pending stop with a countdown timer indicating when the graceful shutdown ends.
Target state: Shows whether Compute Engine is stopping (Stopped) or deleting (Deleted) the compute instance.
gcloud
To monitor an ongoing graceful shutdown in a compute instance, use the
gcloud compute instances describe command:
gcloud compute instances describe INSTANCE_NAME \
--zone=ZONE
Replace the following:
INSTANCE_NAME: the name of the compute instance.ZONE: the zone where the compute instance exists.
If a graceful shutdown is in progress, then the output is similar to the following:
...
resourceStatus:
...
shutdownDetails:
maxDuration:
seconds: 'MAX_DURATION'
requestTimestamp: 'REQUEST_TIMESTAMP'
stopState: STOP_STATE
targetState: TARGET_STATE
...
status: PENDING_STOP
...
This output includes the following values:
MAX_DURATION: the maximum duration of the graceful shutdown, in seconds. WhenSTOP_STATEchanges toSTOPPING, Compute Engine deletes themaxDurationfield.REQUEST_TIMESTAMP: the timestamp indicating when theSTOP_STATEstarted.STOP_STATE: the stopping phase of the compute instance. The value can be one of the following:PENDING_STOP: Compute Engine has started the graceful shutdown. The compute instance remains in this state until you manually end the graceful shutdown or the timer expires.STOPPING: the graceful shutdown has ended, and Compute Engine continues with the stop or delete operation.
TARGET_STATE: whether Compute Engine is stopping (STOPPED) or deleting (DELETED) the compute instance.
When Compute Engine finishes stopping the compute instance,
Compute Engine changes the state of the compute instance to
TERMINATE and deletes the shutdownDetails field.
REST
To monitor an ongoing graceful shutdown in a compute instance, make a GET
request to the
instances.get method:
GET https://compute.s3nsapis.fr/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME
Replace the following:
PROJECT_ID: the ID of the project where you created the compute instance.ZONE: the zone where the compute instance exists.INSTANCE_NAME: the name of the compute instance.
If a graceful shutdown is in progress, then the output is similar to the following:
{
...
"resourceStatus": {
...
"shutdownDetails": {
"maxDuration": {
"seconds": "MAX_DURATION"
},
"requestTimestamp": "REQUEST_TIMESTAMP",
"stopState": "STOP_STATE",
"targetState": "TARGET_STATE"
}
},
...
"status": "PENDING_STOP",
...
}
This output includes the following values:
MAX_DURATION: the maximum duration of the graceful shutdown, in seconds. WhenSTOP_STATEchanges toSTOPPING, Compute Engine deletes themaxDurationfield.REQUEST_TIMESTAMP: the timestamp indicating when theSTOP_STATEstarted.STOP_STATE: the stopping phase of the compute instance. The value can be one of the following:PENDING_STOP: Compute Engine has started the graceful shutdown. The compute instance remains in this state until you manually end the graceful shutdown or the timer expires.STOPPING: the graceful shutdown has ended, and Compute Engine continues with the stop or delete operation.
TARGET_STATE: whether Compute Engine is stopping (STOPPED) or deleting (DELETED) the compute instance.
When Compute Engine finishes stopping the compute instance,
Compute Engine changes the state of the compute instance to
TERMINATE and deletes the shutdownDetails field.
Monitor graceful shutdown by querying metadata server
To monitor an ongoing graceful shutdown by querying the metadata server, use one of the following options. For more information about viewing and querying the metadata for a compute instance, see View and query VM metadata.
Linux
Connect to your Linux compute instance.
To query the
shutdown-detailsmetadata key, run the following command by using thecurltool:user@myinst:~$ curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/shutdown-detailsIf a graceful shutdown is in progress, then the output is similar to the following:
{ "maxDuration": "MAX_DURATION", "requestTimestamp": "REQUEST_TIMESTAMP", "stopState": "STOP_STATE", "targetState": "TARGET_STATE" }The output includes the following values:
MAX_DURATION: the duration of the graceful shutdown period in seconds. After Compute Engine setsSTOP_STATEtoSTOPPING, it deletes themaxDurationfield.REQUEST_TIMESTAMP: the timestamp when theSTOP_STATEstarted.STOP_STATE: the stopping phase of the compute instance. The value can be one of the following:PENDING_STOP: Compute Engine has started the graceful shutdown. The compute instance remains in this state until you manually end the graceful shutdown or the timer expires.STOPPING: the graceful shutdown has ended, and Compute Engine continues with the stop or delete operation.
TARGET_STATE: whether Compute Engine is stopping (STOPPED) or deleting (DELETED) the compute instance.
Windows
Connect to your Windows compute instance.
To query the
shutdown-detailsmetadata key, use theInvoke-RestMethodcmdlet:PS C:\> $value = (Invoke-RestMethod ` -Headers @{'Metadata-Flavor' = 'Google'} ` -Uri "http://metadata.google.internal/computeMetadata/v1/instance/shutdown-details") $valueIf a graceful shutdown is in progress, then the output is similar to the following:
{ "maxDuration": "MAX_DURATION", "requestTimestamp": "REQUEST_TIMESTAMP", "stopState": "STOP_STATE", "targetState": "TARGET_STATE" }The output includes the following values:
MAX_DURATION: the duration of the graceful shutdown period in seconds. After Compute Engine setsSTOP_STATEtoSTOPPING, it deletes themaxDurationfield.REQUEST_TIMESTAMP: the timestamp when theSTOP_STATEstarted.STOP_STATE: the stopping phase of the compute instance. The value can be one of the following:PENDING_STOP: Compute Engine has started the graceful shutdown. The compute instance remains in this state until you manually end the graceful shutdown or the timer expires.STOPPING: the graceful shutdown has ended, and Compute Engine continues with the stop or delete operation.
TARGET_STATE: whether Compute Engine is stopping (STOPPED) or deleting (DELETED) the compute instance.
Monitor graceful shutdown by viewing audit logs
After Compute Engine stops or deletes a compute instance and a graceful shutdown starts, Compute Engine creates Cloud Audit Logs to track the graceful shutdown. You can review these logs to track when a graceful shutdown starts and completes.
To monitor a graceful shutdown by using Cloud Audit Logs logs, select one of the following options:
Console
In the Cloud de Confiance console, go to the Logs Explorer page.
In the query pane, enter the following query:
resource.type="gce_instance" protoPayload.serviceName="compute.googleapis.com" protoPayload.methodName:"compute.instances.gracefulShutdown"Click Run query.
gcloud
To view Cloud Audit Logs logs after a graceful shutdown starts, use one
of the following
gcloud logging read commands:
To monitor graceful shutdown for all your compute instances that are gracefully shutting down, run the following command:
gcloud logging read 'resource.type="gce_instance" AND protoPayload.serviceName="compute.googleapis.com" AND protoPayload.methodName:"compute.instances.gracefulShutdown"'To monitor graceful shutdown for a single compute instance, run the following command:
gcloud logging read 'resource.type="gce_instance" AND protoPayload.serviceName="compute.googleapis.com" AND protoPayload.methodName:"compute.instances.gracefulShutdown" AND "INSTANCE_NAME"'Replace
INSTANCE_NAMEwith the name of the compute instance.
The output is similar to the following:
insertId: -gvb9n5drmdg
labels:
compute.googleapis.com/root_trigger_id: e23093bc-2c55-4ee4-b7cf-ea8b295f0d9a
logName: projects/example-project/logs/cloudaudit.googleapis.com%2Fsystem_event
operation:
id: gracefulShutdown-1783417965660-656025a544aa5-0eefacb0-38dc7152
last: true
producer: compute.instances.gracefulShutdown
protoPayload:
'@type': type.googleapis.com/google.cloud.audit.AuditLog
authenticationInfo:
principalEmail: system@google.com
methodName: compute.instances.gracefulShutdown
request:
'@type': type.googleapis.com/compute.instances.gracefulShutdown
resourceName: projects/example-project/zones/us-central1-a/instances/vm-01
serviceName: compute.googleapis.com
status:
message: Instance graceful shutdown completed.
receiveTimestamp: '2026-07-07T10:04:06.109088155Z'
resource:
labels:
instance_id: '4210316577417032387'
project_id: example-project
zone: us-central1-a
type: gce_instance
severity: INFO
timestamp: '2026-07-07T10:04:05.846992Z'
REST
To view Cloud Audit Logs logs after a graceful shutdown starts, make a
POST request to the
entries.list method:
POST https://logging.googleapis.com/v2/entries:list
{
"resourceNames": [
"projects/PROJECT_ID"
],
"filter": "resource.type=\"gce_instance\" AND protoPayload.serviceName=\"compute.googleapis.com\" AND protoPayload.methodName:\"compute.instances.gracefulShutdown\""
}
Replace PROJECT_ID with the ID of the project in which
your compute instance exists.
The output is similar to the following:
{
"insertId": "-gvb9n5drmdg",
"labels": {
"compute.googleapis.com/root_trigger_id": "e23093bc-2c55-4ee4-b7cf-ea8b295f0d9a"
},
"logName": "projects/example-project/logs/cloudaudit.googleapis.com%2Fsystem_event",
"operation": {
"id": "gracefulShutdown-1783417965660-656025a544aa5-0eefacb0-38dc7152",
"last": true,
"producer": "compute.instances.gracefulShutdown"
},
"protoPayload": {
"@type": "type.googleapis.com/google.cloud.audit.AuditLog",
"authenticationInfo": {
"principalEmail": "system@google.com"
},
"methodName": "compute.instances.gracefulShutdown",
"request": {
"@type": "type.googleapis.com/compute.instances.gracefulShutdown"
},
"resourceName": "projects/example-project/zones/us-central1-a/instances/vm-01",
"serviceName": "compute.googleapis.com",
"status": {
"message": "Instance graceful shutdown completed."
}
},
"receiveTimestamp": "2026-07-07T10:04:06.109088155Z",
"resource": {
"labels": {
"instance_id": "4210316577417032387",
"project_id": "example-project",
"zone": "us-central1-a"
},
"type": "gce_instance"
},
"severity": "INFO",
"timestamp": "2026-07-07T10:04:05.846992Z"
}
For more information, see Viewing audit logs.
Monitor graceful shutdown by viewing Compute Engine operations
After Compute Engine stops or deletes a compute instance and a graceful shutdown starts, you can view the running stop or delete operations to monitor the graceful shutdown.
To monitor a graceful shutdown by view Compute Engine operations, select one of the following options:
Console
In the Cloud de Confiance console, go to the Operations page.
Optional: To refine your list of operations to only show the ongoing graceful shutdowns in a specific region or zone, in the Filter field, enter one of the following filters:
To view all operations across a region, use the following filter:
Target:https://www.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGIONTo view all operations in a single zone, use the following filter:
Target:https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE
Replace the following:
PROJECT_ID: the ID of the project in which your compute instances exist.REGION: the region in which your compute instances exist.ZONE: the zone in which your compute instances exist.
To view the details of a specific operation, in the Operation summary column, click the summary of the operation. A page that gives the details of the operation opens.
gcloud
To view all ongoing or completed graceful shutdowns among the compute
instances in your project, use the following
gcloud compute operations list command:
gcloud compute operations list \
--filter="operationType=compute.instances.gracefulShutdown"
The output is similar to the following:
NAME: operation-1782409401831-65517873d8fe0-76bb4c47-978a64be
TYPE: compute.instances.gracefulShutdown
TARGET: vm-01
HTTP_STATUS: 200
STATUS: RUNNING
TIMESTAMP: 2026-07-07T10:04:05.846992Z
NAME: operation-1783420590456-656035b8e9fa0-84dc2a39-1b9c83fe
TYPE: compute.instances.gracefulShutdown
TARGET: vm-02
HTTP_STATUS: 200
STATUS: RUNNING
TIMESTAMP: 2026-07-07T10:04:05.846992Z
If you want to see the ongoing graceful shutdowns across specific regions or
zones, then use the same command with the
--regions or
--zones flag.
REST
To view all ongoing or completed graceful shutdowns among the compute instances in your project, make one of the following requests:
To view all ongoing or completed graceful shutdowns across all regions and zones, make a
GETrequest to theglobalOperations.listmethod:GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/global/operations?filter=operationType=compute.instances.gracefulShutdownTo view all ongoing or completed graceful shutdowns across a region, make a
GETrequest to theregionOperations.listmethod:GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/operations?filter=operationType=compute.instances.gracefulShutdownTo view all ongoing or completed graceful shutdowns in a single zone, make a
GETrequest to thezoneOperations.listmethod:GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/operations?filter=operationType=compute.instances.gracefulShutdown
Replace the following:
PROJECT_ID: the ID of the project in which your compute instances exist.REGION: the region in which your compute instances exist.ZONE: the zone in which your compute instances exist.
The output is similar to the following:
{
"kind": "compute#operationList",
"id": "projects/example-project/zones/us-central1-a/operations",
"items": [
{
"kind": "compute#operation",
"id": "4210316577417032387",
"name": "operation-1782409401831-65517873d8fe0-76bb4c47-978a64be",
"operationType": "compute.instances.gracefulShutdown",
"targetLink": "https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a/instances/vm-01",
"status": "RUNNING",
"user": "system@google.com",
"progress": 0,
"insertTime": "2026-07-07T10:04:05.846992Z",
"startTime": "2026-07-07T10:04:05.846992Z",
"selfLink": "https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a/operations/operation-1782409401831-65517873d8fe0-76bb4c47-978a64be"
},
...
]
}
For more information, see View Compute Engine operations.