How to List all Quotas using API for a given GCP project

81 views Asked by At

I am working on a task where I need to create alert on all the available Quotas for all the projects (113) under our organization.

From GCP console Quotas page, I can see that there are 11,942 quotas in a project.

So to solve this problem I need to 1st list all the quotas per project and then create alert on these individual quotas. I used gcloud compute project-info describe --project myproject command but it doesn't list all the quotas.

We want to create alerts for all the quotas in advance as each project Owner can request for any service in future.

1

There are 1 answers

0
iamwillbin On

To list all quotas for a project, you can use the projects.getIamPolicy command.

gcloud projects get-iam-policy PROJECT\_ID --format=json

It will output a json object containing info about the project's IAM policy including a list of quotas. Just make sure to authenticate Google Cloud SDK and enable Resource Manager API.

To view and manage quotas, see this document.

To monitor and alert with quotas, see this document.