How can I use gcloud to list all VMs in a specific GCE network? gcloud compute instances list
lists all VMs in all the networks in my project. If I do gcloud compute instances describe foo
on each, I can see the network, but doing that for each is laborious. Is there a single command I can run to filter the results?
Asked
Active
Viewed 1,070 times
0

Rodney Jonace
- 172
- 4

sligocki
- 6,246
- 5
- 38
- 47
2 Answers
1
gcloud compute instances list --filter="networkInterfaces.network:(regex)"
See here for more details.

Avinoam Meir
- 497
- 2
- 9
1
You can use filtering:
https://cloud.google.com/sdk/gcloud/reference/topic/filters
Specifically:
gcloud compute instances list --filter 'networkInterfaces.network:<network_name>
'

Rodney Jonace
- 172
- 4