Created
September 18, 2020 11:48
-
-
Save mims92/79c5c46e142ff6178f979e9119a38277 to your computer and use it in GitHub Desktop.
AWS - Bash - Get SSM parameters by path, (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/awsgetparams | |
#Usage: awsgetparam <path> <profile name> <EMTPY|Y|y> | |
#Output: list of param value | |
PARAM_PATH="$1" | |
shift | |
PROFILE="$1" | |
shift | |
UNENCRYPTED="$1" | |
shift | |
WITH_DECRYTPION="" | |
if [[ "${UNENCRYPTED}" =~ ^[yY] ]]; | |
then | |
WITH_DECRYPTION="--with-decryption" | |
fi | |
aws ssm get-parameters-by-path --path "${PARAM_PATH}" --recursive "${WITH_DECRYPTION}" --profile "${PROFILE}" | jq -c -r -e ".Parameters[] | [.Name, .Value] | @tsv" | column -t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment