When you make an update to a VM that mutates (alters) data, or when a host event occurs that changes the state of a VM, Compute Engine adds an entry to the list of operations. This page describes how you can view a list of completed Compute Engine operations by using the Google Cloud console, the Google Cloud CLI, or the Compute Engine API.
Before you begin
- If you want to use the command-line examples in this guide, do the following:
- Install or update to the latest version of the Google Cloud CLI.
- Set a default region and zone.
- If you want to use the API examples in this guide, set up API access.
Viewing operations
To view a list of operations for your project, perform the following steps:
Console
In the Google Cloud console, go to the Operations page.
For more details on an operation, click the operation summary. For example, to view the migration details for the
my-instance
VM, click the Automatically migrate an instance operation.
gcloud
To view a list of operations for your project
using gcloud compute
, use the operations list
sub-command.
To view the list of operations in a specified zone, add the --filter
flag.
gcloud compute operations list --filter="zone:(ZONE)"
Replace ZONE
with the zone where you want to view a list of
operations. For example, to view the list of operations in us-cental1-c
,
run the following command:
gcloud compute operations list --filter="zone:(us-central1-c)"
The output is similar to the following:
NAME TYPE TARGET HTTP_STATUS STATUS TIMESTAMP
systemevent-1543845145000... compute.instances.migrateOnHostMaintenance us-central1-c/instances/my-instance 200 DONE 2018-12-03T05:52:25.000-08:00
API
API requests for operations must be specified at either the global, region, or zone level. Live migration, VM stopping, and automatic restarts are all zone-level operations.
For zone operations, make a GET
request to the zoneOperations.list
method.
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/operations
Replace the following:
PROJECT_ID
: the project ID for this requestZONE
: the zone for this request
Leave the request body empty.
The following is a sample output for a zone operation request. In this output, details for a host migration displays.
{ "kind": "compute#operation", "id": "3216798767364213712", "name": "systemevent-1543845145000-57c1e7574b840-a195b637-5ff74d9b", "zone": "https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c", "operationType": "compute.instances.migrateOnHostMaintenance", "targetLink": "https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c/instances/my-instance", "targetId": "3070988523247098025", "status": "DONE", "statusMessage": "Instance migrated during Compute Engine maintenance.", "user": "system", "progress": 100, "insertTime": "2018-12-03T05:52:25.000-08:00", "startTime": "2018-12-03T05:52:25.000-08:00", "endTime": "2018-12-03T05:52:25.000-08:00", "selfLink": "https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c/operations/systemevent-1543845145000-57c1e7574b840-a195b637-5ff74d9b" }
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 2023-06-01 UTC.