如何使用gcloud列出特定GCE网络中的所有虚拟机? gcloud compute instances list
列出项目中所有网络中的所有VM。如果我在每个上都gcloud compute instances describe foo
,我可以看到网络,但为每个网络做这些都是费力的。我可以运行一个命令来过滤结果吗?
答案 0 :(得分:1)
gcloud compute instances list --filter =“networkInterfaces.network :(regex)”
有关详细信息,请参阅here。
答案 1 :(得分:0)
您可以使用过滤:
https://cloud.google.com/sdk/gcloud/reference/topic/filters
具体做法是:
gcloud compute instances list --filter 'networkInterfaces.network:<network_name>
'