Skip to content

Instantly share code, notes, and snippets.

@wobondar
Created August 20, 2018 15:21
Show Gist options
  • Select an option

  • Save wobondar/a8b5d7b609e0db8ce4231baafec09965 to your computer and use it in GitHub Desktop.

Select an option

Save wobondar/a8b5d7b609e0db8ce4231baafec09965 to your computer and use it in GitHub Desktop.
AWS export all API gateways with stages
aws apigateway get-rest-apis > apis.json
rm -rf apis
mkdir apis
jq -r '.items[] | .id' apis.json | while read i; do
aws apigateway get-stages --rest-api-id $i > stages.json
jq -r '.item[] | .stageName' stages.json | while read z; do
aws apigateway get-export --rest-api-id $i --stage-name $z --export-type 'swagger' "apis/$z-$i.json"
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment