Skip to content

Instantly share code, notes, and snippets.

@hmain
Last active September 22, 2017 09:38
Show Gist options
  • Save hmain/cc2cc763859afe517adbad19ca12f1be to your computer and use it in GitHub Desktop.
Save hmain/cc2cc763859afe517adbad19ca12f1be to your computer and use it in GitHub Desktop.
Download AWS Api Gateway swagger json with the AWS cli
#!/bin/bash
REGION="eu-west-1"
ITEMS=$(aws --region eu-west-1 apigateway get-rest-apis | jq -r '.items[] | .id')
STAGE="prod"
for item in $ITEMS
do
aws --region $REGION \
apigateway get-export \
--parameters '{"extensions":"integrations,authorizers"}' \
--rest-api-id $item \
--stage-name $STAGE \
--export-type swagger $item-$STAGE.json
done
@hmain
Copy link
Author

hmain commented Sep 22, 2017

Added --parameters '{"extensions":"integrations,authorizers"}' \ as per amazon-archives/aws-apigateway-importer#169 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment