How to get boot-disk name for a given instance, using gcloud?

728 views
Skip to first unread message

Arun Lakhana

unread,
Apr 20, 2018, 12:04:34 PM4/20/18
to gce-dis...@googlegroups.com
Apparently, the following gcloud command does not always return the boot disk name: 

    gcloud compute instances describe [INSTANCE_NAME] --format='get(disks[0].deviceName)'

I've tried various list and describe commands, with filter and format flags, but I can't figure it out.

Does anyone know how to reliably get the name of the boot disk for a given VM, using gcloud?


Fady (Google Cloud Platform)

unread,
Apr 20, 2018, 6:04:33 PM4/20/18
to gce-discussion

Hello Arun,


A more accurate alternative is using (disks[0].source) instead of (disks[0].deviceName) in the command above. However, this would return an API link to the disk name as follows:


gcloud compute instances describe [instance name] --format='get(disks[0].source)'



I hope this helps.


Reply all
Reply to author
Forward
0 new messages