In my GCP Project I have 100 compute instances and I am pulling "Guest Attributes" from every compute instance using gcloud compute instances get-guest-attributes command.
In this process I have to call gcloud command for 100 times and I am using script to run this 100 times. But still the command will run 100 times.
Is there a way to pull all the "Guest Attributes" based on the "ProjectName" (or) "ZoneName". So that with one command I will be able to get all the compute instance details for that project. I don't find anything in GCP help.
Looking at the documentation for Guest Attributes, the API call requires the "instance" field. If you are using a configuration management, you could retrieve the information, by accessing the metadata from within the instances:
curl http://metadata.google.internal/computeMetadata/v1/instance/guest-attributes/namespace/ -H "Metadata-Flavor: Google"
Where you chose the namespace you want to query. It will, still, run in every instance.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.