Skip to content

Instantly share code, notes, and snippets.

@siberex
Last active June 25, 2022 01:23
Show Gist options
  • Save siberex/d8dd3b480aba148562fc4254b6489873 to your computer and use it in GitHub Desktop.
Save siberex/d8dd3b480aba148562fc4254b6489873 to your computer and use it in GitHub Desktop.
Google App Engine: List all projects along with their regions and mapped domains
# App Engine: List all project regions and mapped domains
# Effectively:
# gcloud projects list --format 'get(PROJECT_ID)'
# gcloud app describe --project "$projectId" --format 'get(locationId)'
# gcloud app domain-mappings list --project "$projectId" --format 'get(ID)' | xargs | sed 's/ /, /g'
printf "%s\t%s\t%s\n" "ProjectId" "Region" "Domains"
gcloud projects list --format 'get(PROJECT_ID)' | while read -r projectId; do
region=$(gcloud app describe --project "$projectId" --format 'get(locationId)' 2>/dev/null || echo 'N/A')
domains=$((gcloud app domain-mappings list --project "$projectId" --format 'get(ID)' 2>/dev/null || echo 'N/A') | xargs | sed 's/ /, /g')
printf "%s\t%s\t%s\n" "$projectId" "$region" "$domains"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment