Viewing source image

Learn how to view the source image for your virtual machine (VM).

Before you begin

Permissions required for this task

To perform this task, you must have the following permissions:

  • compute.instances.get on the instance

Viewing source image

You view the source image for your VM by using either the Google Cloud Console, the gcloud command-line tool, or the Compute Engine API.

Console

  1. In the Google Cloud Console, go to the VM instances page.

    Go to the VM instances page

  2. Click on the VM whose source image you want to identify. The VM instance details page displays.

  3. From the VM instance details page, in the Boot disk section, review the Image column.

    VM showing source image

gcloud

To view the source image for your VM using gcloud command-line tool, complete the following steps:

  1. Use the disks list command to find the zone and the name of the disks that is associated with the VM.

    gcloud compute disks list
    
  2. Use the disks describe command with a --format flag to filter the output.

    gcloud compute disks describe DISK_NAME \
       --zone ZONE \
       --format='get(sourceImage)'
    

    Replace the following:

    • DISK_NAME: name of your disk
    • ZONE: zone that the disk is located in.

API

Make a GET request to the disks.get method.

 GET https://compute.googleapis.com/compute/v1projects/PROJECT_ID/zones/ZONE/disks/DISK_NAME
 

Replace the following:

  • PROJECT_ID: your Project ID.
  • DISK_NAME: name of your disk
  • ZONE: zone that the disk is located in.

Your response body resembles the following snippet. The source image is returned by the sourceImage field.

{
".......
"status": "READY",
"selfLink": "https://www.googleapis.com/compute/v1/projects/proj-12345/zones/us-east1-b/disks/test-instance",
"sourceImage": "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-1604-xenial-v20191010",
"sourceImageId": "2313977755888824",
"type": "https://www.googleapis.com/compute/v1/projects/proj-12345/zones/us-east1-b/diskTypes/pd-standard",
"licenses": [
  "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/licenses/ubuntu-1604-xenial"
],
.......
}

What's next