Learn how to view the source image for your virtual machine (VM).
Before you begin
- If you want to use the command-line examples in this guide:
- Install or update to the latest version of the gcloud command-line tool.
- Set a default region and zone.
- If you want to use the API examples in this guide, set up API access.
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
In the Google Cloud Console, go to the VM instances page.
Click on the VM whose source image you want to identify. The VM instance details page displays.
From the VM instance details page, in the Boot disk section, review the Image column.
gcloud
To view the source image for your VM using
, complete the
following steps:gcloud
command-line tool
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
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 diskZONE
: 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 diskZONE
: 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
- Learn more about images on Compute Engine.
- Review the operating system details for public images on Compute Engine.