smootherbug
smootherbug

Reputation: 169

Get all GCP instances under project using rest API

The below api gives instances based on a particular zone.
https://cloud.google.com/compute/docs/reference/rest/v1/instances/list
I am using java client library to connect with GCP.

It is possible using gcloud according to this link https://cloud.google.com/sdk/gcloud/reference/compute/instances/list

Any help will be much appreciated.

Upvotes: 0

Views: 1370

Answers (1)

John Hanley
John Hanley

Reputation: 81464

To list all instances in all regions and zones for a project, use the aggregatedList method.

Method: instances.aggregatedList

Upvotes: 3

Related Questions