Created
August 24, 2020 08:04
-
-
Save mims92/3bbeaed2a798294cdcb585699849ed6c to your computer and use it in GitHub Desktop.
AWS - Bash - Get a single SSM parameter, (un)encrypted
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 | |
#chmod +x /usr/bin/awsgetparam | |
#Usage: awsgetparam <param-name> <profile name> <EMTPY|Y|y> | |
#Output: param value | |
PARAM_NAME="$1" | |
shift | |
PROFILE="$1" | |
shift | |
UNENCRYPTED="$1" | |
shift | |
WITH_DECRYTPION="" | |
if [[ "${UNENCRYPTED}" =~ ^[yY] ]]; | |
then | |
WITH_DECRYPTION="--with-decryption" | |
fi | |
aws ssm get-parameter --name "${PARAM_NAME}" "${WITH_DECRYPTION}" --profile "${PROFILE}" | jq -c -r -e ".Parameter.Value" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment