获取标签和GCE实例状态的最快方法? [英] Fastest way to fetch tags and status of GCE instances?

查看:70
本文介绍了获取标签和GCE实例状态的最快方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用GCE Linux实例(CPU负载> = 1.0)执行3D图形渲染时,describe命令需要花费30秒钟以上的时间来执行.

When I perform 3D graphics rendering using GCE Linux instances (CPU load >= 1.0), the describe command takes more than 30 seconds to execute.

gcloud compute instances describe render-1

运行50个此类实例并分别查询每个实例时,这将花费25分钟以上的时间.

When running 50 such instances and querying each one individually, this takes more than 25 minutes.

是否有更快的方法来获取这些数据?

Is there a faster way to fetch this data?

推荐答案

gcloud compute instances list应该可以执行您想要的操作.为了获取有关标签和状态的信息,您需要使用--format标志:

gcloud compute instances list should do what you want. In order to get information on tags and status, you'll want to use the --format flag:

$ gcloud compute instances list --format=json
[...]
$ gcloud compute instances list --format='table(name,status,tags.list())'
NAME                              STATUS      TAGS
instance-name                     RUNNING     fingerprint=AAAAAAAAAAA=
instance-2-name                   RUNNING     fingerprint=AAAAAAAAAAA=,items=[u'http-server', u'https-server']

请查看gcloud topic formatsgcloud topic projections的输出,以获取有关格式化的更多信息.

Take a look at the output of gcloud topic formats and gcloud topic projections for more information on formatting.

这篇关于获取标签和GCE实例状态的最快方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆