Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Linux
Windows
Saat Anda memanggil Compute Engine API yang memutasi resource, Compute Engine akan menambahkan entri ke daftar operasi. Misalnya, saat Anda melakukan update pada VM yang memutasi (mengubah) data, atau saat peristiwa host terjadi yang mengubah status VM, operasi akan dibuat. Halaman ini menjelaskan cara melihat daftar operasi Compute Engine menggunakan Google Cloud konsol, Google Cloud CLI, atau REST.
Ingatlah bahwa operasi dapat memerlukan waktu beberapa saat untuk diselesaikan, sehingga Anda mungkin menemukan operasi yang belum selesai saat melihat. Jika ingin melihat status akhir operasi yang belum selesai, sebaiknya jangan melihat operasi berulang kali. Sebagai gantinya, Anda harus menunggu operasi selesai.
Sebelum memulai
Jika Anda belum melakukannya, siapkan autentikasi.
Autentikasi adalah
proses yang digunakan untuk memverifikasi identitas Anda untuk mengakses Google Cloud layanan dan API.
Untuk menjalankan kode atau sampel dari lingkungan pengembangan lokal, Anda dapat melakukan autentikasi ke
Compute Engine dengan memilih salah satu opsi berikut:
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
Menginstal Google Cloud CLI.
Setelah penginstalan,
lakukan inisialisasi Google Cloud CLI dengan menjalankan perintah berikut:
Saat melakukan operasi kueri, perlu diingat bahwa operasi yang telah selesai akan
otomatis dihapus dari database setelah jangka waktu tertentu.
Compute Engine menyimpan operasi yang telah selesai setidaknya selama periode retensi minimum 1 jam, dan hingga periode retensi maksimum 14 hari.
Meskipun project sering kali mengamati periode retensi untuk operasi yang telah selesai yang
lebih lama dari minimum 1 jam, bergantung pada periode retensi tambahan
tidak direkomendasikan.
Perhatikan bahwa periode retensi tidak berlaku untuk operasi yang dihapus oleh pengguna melalui metode Operations.delete.
Melihat operasi
Untuk melihat daftar operasi untuk project Anda, lakukan langkah-langkah berikut:
Untuk mengetahui detail selengkapnya tentang suatu operasi, klik ringkasan operasi. Misalnya, untuk melihat detail migrasi untuk VM my-instance, klik operasi Migrasi instance secara otomatis.
gcloud
Untuk melihat daftar operasi untuk project Anda menggunakan gcloud compute, gunakan sub-perintah operations list.
Untuk melihat daftar operasi di zona tertentu, tambahkan tanda --filter.
gcloud compute operations list --filter="zone:(ZONE)"
Ganti ZONE dengan zona tempat Anda ingin melihat daftar operasi. Misalnya, untuk melihat daftar operasi di us-cental1-c,
jalankan perintah berikut:
gcloud compute operations list --filter="zone:(us-central1-c)"
Outputnya mirip dengan hal berikut ini:
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
REST
Permintaan API untuk operasi harus ditentukan di tingkat global,
region, atau zona.
Migrasi langsung, penghentian VM, dan mulai ulang otomatis adalah operasi tingkat zona.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-19 UTC."],[[["\u003cp\u003eCompute Engine operations are logged when a resource is mutated, such as during VM updates or host events, which alter the state of a VM.\u003c/p\u003e\n"],["\u003cp\u003eOperations can be viewed using the Google Cloud console, the Google Cloud CLI (gcloud), or REST, and they may be incomplete upon initial viewing.\u003c/p\u003e\n"],["\u003cp\u003eAuthentication is only needed for gcloud or REST usage, and the provided steps outline the necessary commands for both.\u003c/p\u003e\n"],["\u003cp\u003eCompleted operations are retained for a period ranging from a minimum of 1 hour to a maximum of 14 days, during which time they are available for viewing.\u003c/p\u003e\n"],["\u003cp\u003eTo view operations, you must specify the scope of the request as either global, region, or zone level using gcloud or REST.\u003c/p\u003e\n"]]],[],null,["# View Compute Engine operations\n\nLinux Windows\n\n*** ** * ** ***\n\nWhen you call a Compute Engine API that mutates a resource, Compute Engine adds an entry\nto the list of operations. For example, when you make an update to a VM that\nmutates (alters) data, or when a [host event](/compute/docs/instances/host-maintenance-overview)\noccurs that changes the state of a VM, operations are created. This page\ndescribes how you can view a list of Compute Engine operations by\nusing the [Google Cloud console](https://console.cloud.google.com/), the [Google Cloud CLI](/compute/docs/gcloud-compute),\nor [REST](/compute/docs/reference/rest/v1).\n\nRemember that operations can take some time to complete, so you may find\nincomplete operations while viewing. When you want to see the final status of\nincomplete operations, repeatedly viewing operations is not recommended;\ninstead, you should [wait for operations to be done](/compute/docs/api/best-practices#wait-for-operations).\n\nBefore you begin\n----------------\n\n- If you haven't already, set up [authentication](/compute/docs/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:\n\n Select the tab for how you plan to use the samples on this page: \n\n ### Console\n\n\n When you use the Google Cloud console to access Google Cloud services and\n APIs, you don't need to set up authentication.\n\n ### gcloud\n\n 1.\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n After installation,\n [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command:\n\n ```bash\n gcloud init\n ```\n\n\n If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n | **Note:** If you installed the gcloud CLI previously, make sure you have the latest version by running `gcloud components update`.\n 2. [Set a default region and zone](/compute/docs/gcloud-compute#set_default_zone_and_region_in_your_local_client).\n\n ### REST\n\n\n To use the REST API samples on this page in a local development environment, you use the\n credentials you provide to the gcloud CLI.\n 1. [Install](/sdk/docs/install) the Google Cloud CLI. After installation, [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command: \n\n ```bash\n gcloud init\n ```\n 2. If you're using an external identity provider (IdP), you must first [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n\n For more information, see\n [Authenticate for using REST](/docs/authentication/rest)\n in the Google Cloud authentication documentation.\n\nOperation Retention Period\n--------------------------\n\nWhile querying operations, keep in mind that completed operations are\nautomatically removed from the database after a certain period.\n\nCompute Engine retains completed operations for at least the minimum\nretention period of 1 hour, and up to the maximum retention period of 14 days.\nAlthough projects often observe a retention period for completed operations that\nis longer than the minimum of 1 hour, depending on the additional retention\nperiod is not recommended.\n\nNote that the retention periods don't apply to operations deleted by the users\nthrough `Operations.delete` method.\n\nViewing operations\n------------------\n\nTo view a list of operations for your project, perform the following steps: \n\n### Console\n\n1. In the Google Cloud console, go to the **Operations** page.\n\n [Go to Operations](https://console.cloud.google.com/compute/operations)\n2. For more details on an operation, click the operation summary. For\n example, to view the migration details for the `my-instance` VM,\n click the **Automatically migrate an instance** operation.\n\n\n### gcloud\n\nTo view a list of operations for your project\nusing `gcloud compute`, use the [`operations list`](/sdk/gcloud/reference/compute/operations/list)\nsub-command.\n\nTo view the list of operations in a specified zone, add the `--filter` flag.\n\n\u003cbr /\u003e\n\n```\ngcloud compute operations list --filter=\"zone:(ZONE)\"\n```\n\n\u003cbr /\u003e\n\nReplace \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e with the zone where you want to view a list of\noperations. For example, to view the list of operations in `us-cental1-c`,\nrun the following command: \n\n```\ngcloud compute operations list --filter=\"zone:(us-central1-c)\"\n```\n\nThe output is similar to the following: \n\n```\nNAME TYPE TARGET HTTP_STATUS STATUS TIMESTAMP\nsystemevent-1543845145000... compute.instances.migrateOnHostMaintenance us-central1-c/instances/my-instance 200 DONE 2018-12-03T05:52:25.000-08:00\n```\n\n\u003cbr /\u003e\n\n### REST\n\nAPI requests for operations must be specified at either the [global](/compute/docs/reference/rest/v1/globalOperations/list),\n[region](/compute/docs/reference/rest/v1/regionOperations/list), or [zone](/compute/docs/reference/rest/v1/zoneOperations/list) level.\nLive migration, VM stopping, and automatic restarts are all zone-level operations.\n\nFor zone operations, make a `GET` request to the [`zoneOperations.list`](/compute/docs/reference/rest/v1/zoneOperations/list) method. \n\n```\nGET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/operations\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID for this request\n- \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the zone for this request\n\nLeave the request body empty.\n\nThe following is a sample output for a zone operation request. In this\noutput, details for a host migration displays. \n\n```\n{\n \"kind\": \"compute#operation\",\n \"id\": \"3216798767364213712\",\n \"name\": \"systemevent-1543845145000-57c1e7574b840-a195b637-5ff74d9b\",\n \"zone\": \"https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c\",\n \"operationType\": \"compute.instances.migrateOnHostMaintenance\",\n \"targetLink\": \"https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c/instances/my-instance\",\n \"targetId\": \"3070988523247098025\",\n \"status\": \"DONE\",\n \"statusMessage\": \"Instance migrated during Compute Engine maintenance.\",\n \"user\": \"system\",\n \"progress\": 100,\n \"insertTime\": \"2018-12-03T05:52:25.000-08:00\",\n \"startTime\": \"2018-12-03T05:52:25.000-08:00\",\n \"endTime\": \"2018-12-03T05:52:25.000-08:00\",\n \"selfLink\": \"https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c/operations/systemevent-1543845145000-57c1e7574b840-a195b637-5ff74d9b\"\n}\n```"]]