You create a virtual machine (VM) instance from either an OS image or a disk image. This document shows you how to determine the source OS image or source disk image of a VM.
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.
View the source OS image or source disk image of a VM
To view the source OS image or source disk image of a VM, use the Google Cloud console, Google Cloud CLI, or Compute Engine API.
Console
In the Google Cloud console, go to the VM instances page.
Click the Name of the VM.
The name of the source OS image or source disk image is in Storage > Boot disk > Image.
gcloud
View the disks attached to a VM by using the following
gcloud compute instances describe
command:gcloud compute instances describe VM_NAME
Replace
VM_NAME
with the name of the VM.View the source OS image or source disk image of the disk by using the following
gcloud compute disks describe
command:gcloud compute disks describe DISK_NAME \ --zone=ZONE \ --format="get(SOURCE)"
Replace the following:
DISK_NAME
: the name of the disk to view the source of.ZONE
: the zone that the disk is located in.SOURCE
: a value that specifies whether to return the source OS image or the source disk image. Set tosourceDisk
or tosourceImage
. No value is returned when specifyingsourceDisk
orsourceImage
unless there is a corresponding source OS image or a source disk image. If no value is returned, specify the other value and run the command again.
API
View the disks attached to a VM by using the following
instances.get
method:GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/VM_NAME
Replace the following:
PROJECT_ID
: the project IDZONE
: the zone containing the VMVM_NAME
: the name of the VM
View the source OS image or source disk image of the disk by using the
disks.get
method.For a VM that has a source OS image, this method returns the source image that was used to create the disk in the
sourceImage
field. For a VM that has a source disk image, this method instead returns the source image in thesourceDisk
field.GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/disks/DISK_NAME
Replace the following:
PROJECT_ID
: the project IDZONE
: the zone containing the diskDISK_NAME
: the name of the disk
What's next
- Learn more about OS images on Compute Engine.