Skip to content

Instantly share code, notes, and snippets.

View slawekzachcial's full-sized avatar

Slawek Zachcial slawekzachcial

  • Grenoble, France
View GitHub Profile
@slawekzachcial
slawekzachcial / aws-sigv4-ssm-get-parameter.sh
Last active May 20, 2024 14:48
Using CURL to call AWS ReST API, signing request with v4 signature
#!/bin/bash
# Source: https://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html
[[ -n "${AWS_ACCESS_KEY_ID}" ]] || { echo "AWS_ACCESS_KEY_ID required" >&2; exit 1; }
[[ -n "${AWS_SECRET_ACCESS_KEY}" ]] || { echo "AWS_SECRET_ACCESS_KEY required" >&2; exit 1; }
readonly parameterName="SlawekTestParam"
readonly method="POST"
terraform plan -no-color 2>&1 \
| sed -E -e 's/^([[:space:]]+)([-+#])/\2\1/g' -e 's/^([[:space:]]+)~/!\1/g'