问题
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
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?
回答1:
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']
Take a look at the output of gcloud topic formats and gcloud topic projections for more information on formatting.
来源:https://stackoverflow.com/questions/37047089/fastest-way-to-fetch-tags-and-status-of-gce-instances