Last active
February 25, 2023 03:27
-
-
Save mattgillard/018e4455fcfbc59354f51c7ed224a90a to your computer and use it in GitHub Desktop.
Sample script to curl a url passed as first argument to an AWS API Gateway configured with IAM authentication (AWS_IAM)
This file contains hidden or 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 | |
AWS_ACCESS_KEY_ID="$(aws configure get aws_access_key_id)" | |
AWS_SECRET_ACCESS_KEY="$(aws configure get aws_secret_access_key)" | |
AWS_SESSION_TOKEN=$(aws configure get aws_session_token) | |
AWS_REGION=$(aws configure get region) | |
# from https://gist.github.com/slawekzachcial/fe23184124763dfb82f233b5dde2394b?permalink_comment_id=4292171#gistcomment-4292171 | |
curl --request GET -v \ | |
"$1" \ | |
--aws-sigv4 aws:amz:${AWS_REGION}:execute-api \ | |
--user "${AWS_ACCESS_KEY_ID}:${AWS_SECRET_ACCESS_KEY}" \ | |
--header "x-amz-security-token: ${AWS_SESSION_TOKEN}" \ | |
--header 'Accept: application/json' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment