1
votes

I am using the below command to display all data associated with a Google Compute Engine virtual machine instance.

gcloud compute instances describe <instance>

I want only specific information like "tags" , "machine-type" instead of whole information.

Thanks in advance

2

2 Answers

1
votes

You can add grep to the command as follows:

gcloud compute instances describe INSTANCE_NAME --zone INSTANCE'S_ZONE | grep machineType:

gcloud compute instances describe INSTANCE_NAME --zone INSTANCE'S_ZONE | grep tags:
1
votes

You can you the format option to the only the information you want.

gcloud compute instances list --format='value(name, tags.items, machineType)'

You can use table to make output prettier

gcloud compute instances list --format='table[](name, tags.items, machineType)'

To see the list attributes:

gcloud compute instances list --format=flattened

To learn more about formats:

gcloud topic formats