Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Linux
Windows
Anda membuat instance mesin virtual (VM) dari OS image atau disk image. Dokumen ini menunjukkan cara menentukan OS image sumber atau disk image sumber VM.
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:
SOURCE: nilai yang menentukan apakah akan
menampilkan OS image sumber atau disk image sumber. Setel ke sourceDisk
atau ke sourceImage. Tidak ada nilai yang ditampilkan saat menentukan sourceDisk
atau sourceImage kecuali jika ada OS image sumber atau
disk image sumber yang sesuai. Jika tidak ada nilai yang ditampilkan, tentukan nilai lainnya, lalu jalankan kembali perintah tersebut.
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/VM_NAME
Ganti kode berikut:
PROJECT_ID: ID project
ZONE: zona yang berisi VM
VM_NAME: nama VM
Lihat OS image sumber atau disk image sumber disk menggunakan
metode disks.get.
Untuk VM yang memiliki OS image sumber, metode ini menampilkan gambar sumber
yang digunakan untuk membuat disk di kolom sourceImage. Untuk VM
yang memiliki disk image sumber, metode ini akan menampilkan gambar
sumber di kolom sourceDisk.
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/disks/DISK_NAME
[[["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-18 UTC."],[[["\u003cp\u003eThis guide explains how to identify the source OS image or source disk image used to create a virtual machine (VM) instance.\u003c/p\u003e\n"],["\u003cp\u003eYou can determine the source image using the Google Cloud console, the Google Cloud CLI (gcloud), or the Compute Engine API.\u003c/p\u003e\n"],["\u003cp\u003eTo access and use the services, authentication is needed and the methods to authenticate are explained for the Google Cloud Console, the gcloud CLI, and REST.\u003c/p\u003e\n"],["\u003cp\u003eRequired permissions include \u003ccode\u003ecompute.instances.get\u003c/code\u003e on the specific VM instance.\u003c/p\u003e\n"],["\u003cp\u003eThe location of the required source image information can be found in the storage section under the boot disk in the Google Cloud Console and by using the gcloud command lines to view the disk and then its source.\u003c/p\u003e\n"]]],[],null,["# View the source image of a VM\n\nLinux Windows\n\n*** ** * ** ***\n\nYou create a virtual machine (VM) instance from either an [OS\nimage](/compute/docs/images/os-details) or a disk image. This document\nshows you how to determine the source OS image or source disk image of a VM.\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\nView the source OS image or source disk image of a VM\n-----------------------------------------------------\n\nTo view the source OS image or source disk image of a VM, use the\nGoogle Cloud console, Google Cloud CLI, or Compute Engine API.\n\n#### Permissions required for this task\n\nTo perform this task, you must have the following\n[permissions](/iam/docs/overview#permissions):\n\n\n- `compute.instances.get` on the instance \n\n### Console\n\n1. In the Google Cloud console, go to the **VM instances** page.\n\n [Go to VM instances](https://console.cloud.google.com/compute/instances)\n2. Click the **Name** of the VM.\n\n3. The name of the source OS image or source disk image is in\n **Storage** \\\u003e **Boot\n disk** \\\u003e **Image**.\n\n### gcloud\n\n1. View the disks attached to a VM by using the following [`gcloud compute\n instances describe`\n command](/sdk/gcloud/reference/compute/instances/describe):\n\n ```\n gcloud compute instances describe VM_NAME\n ```\n\n Replace \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e with the name of the VM.\n2. View the source OS image or source disk image of the disk by using the\n following [`gcloud compute disks describe`\n command](/sdk/gcloud/reference/compute/disks/describe):\n\n ```\n gcloud compute disks describe DISK_NAME \\\n --zone=ZONE \\\n --format=\"get(SOURCE)\"\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eDISK_NAME\u003c/var\u003e: the name of the disk to view the\n source of.\n\n - \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the zone that the disk is located in.\n\n - \u003cvar translate=\"no\"\u003eSOURCE\u003c/var\u003e: a value that specifies whether to\n return the source OS image or the source disk image. Set to `sourceDisk`\n or to `sourceImage`. No value is returned when specifying `sourceDisk`\n or `sourceImage` unless there is a corresponding source OS image or a\n source disk image. If no value is returned, specify the other value and\n run the command again.\n\n### REST\n\n1. View the disks attached to a VM by using the following [`instances.get`\n method](/compute/docs/reference/rest/v1/instances/get):\n\n ```\n GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/VM_NAME\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID\n - \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the zone containing the VM\n - \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e: the name of the VM\n2. View the source OS image or source disk image of the disk by using the\n [`disks.get` method](/compute/docs/reference/rest/v1/disks/get).\n\n For a VM that has a source OS image, this method returns the source image\n that was used to create the disk in the `sourceImage` field. For a VM\n that has a source disk image, this method instead returns the source\n image in the `sourceDisk` field. \n\n ```\n GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/disks/DISK_NAME\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID\n - \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the zone containing the disk\n - \u003cvar translate=\"no\"\u003eDISK_NAME\u003c/var\u003e: the name of the disk\n\nWhat's next\n-----------\n\n- Learn more about [OS images](/compute/docs/images) on Compute Engine."]]