Last active
April 4, 2019 06:13
-
-
Save n0531m/e7626791e5784d3812422a3cce086a94 to your computer and use it in GitHub Desktop.
GCP : Check project quota
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## lists project quota in use | |
## "jq" is required | |
## usage: ./checkquota.sh <PROJECTID> | |
PROJECT=$1 | |
NOW=`date +%Y-%m-%d` | |
gcloud compute regions list --format json --project $PROJECT \ | |
| jq -Sc ".[] | .name as \$region_name | .quotas[] | .scope=\$region_name | select (.usage>0.0) | .projectid=\"${PROJECT}\" | .date=\"${NOW}\" | .util=(.usage/.limit) " | |
gcloud compute project-info describe --format json --project $PROJECT \ | |
| jq -Sc ".quotas[] | select (.usage>0.0) | .scope=\"global\" | .projectid=\"${PROJECT}\" | .date=\"${NOW}\" | .util=(.usage/.limit)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment