user12755352
user12755352

Reputation: 41

API which returns all the GCP regions and availability zones

I am working on a project which requires me to list out all the Azure and GCP cloud's availability regions, is there any API or endpoint to make a call to fetch them all. Not looking for CLI commands.

Upvotes: 0

Views: 281

Answers (2)

John Hanley
John Hanley

Reputation: 81464

For GCP the endpoint is:

https://compute.googleapis.com/compute/v1/projects/{project}/regions

Replace {project} with your Project ID (not Project Name).

Documentation:

Method: regions.list

There are also a number of SDKs for popular languages:

Google Cloud SDK home page

Example:

API Documentation for listing regions using Python

Upvotes: 1

silent
silent

Reputation: 16238

For Azure the API is

GET https://management.azure.com/subscriptions/{subscriptionId}/locations?api-version=2020-01-01

https://learn.microsoft.com//rest/api/resources/subscriptions/list-locations

Upvotes: 0

Related Questions