Skip to content

Instantly share code, notes, and snippets.

@CodySwannGT
Created May 7, 2019 18:58
Show Gist options
  • Save CodySwannGT/25bced7ca57f446e8b6ecb2d8cb500b6 to your computer and use it in GitHub Desktop.
Save CodySwannGT/25bced7ca57f446e8b6ecb2d8cb500b6 to your computer and use it in GitHub Desktop.
Get API Gateway endpoints
#!/bin/bash
REGION=$(aws configure get region)
REST_APIS=$(aws apigateway get-rest-apis --query items[*].id --output text)
for i in $(echo $REST_APIS | tr " " "\n")
do
STAGES=$(aws apigateway get-stages --rest-api-id $i --query item[*].stageName --output text)
for j in $(echo $STAGES | tr " " "\n")
do
PATHS=$(aws apigateway get-resources --rest-api-id $i --query items[*].path --output text)
for k in $(echo $PATHS | tr " " "\n")
do
echo "https://${i}.execute-api.${REGION}.amazonaws.com/${j}${k}"
done
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment