Created
May 14, 2018 10:20
-
-
Save Slakah/80bf7b1bb7f213bfc6b8325847bd7e8f to your computer and use it in GitHub Desktop.
Convert AWS SSM parameters to environment variables, used as `eval $(./ssm-to-env.sh "<ssm-path>")`
This file contains 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 | |
set -uxe | |
# Reads the ssm path and echos out the parameters in the form | |
# export NAME=some-value | |
readonly path=$1 | |
exec aws --region us-east-1 ssm get-parameters-by-path --no-paginate --path $path --with-decryption --query Parameters | \ | |
jq -r 'map("\(.Name | sub("'$path'";""))=\(.Value)") | join("\n")' | \ | |
sed -e 's/^/export /' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment