Skip to content

Instantly share code, notes, and snippets.

@mims92
Created September 18, 2020 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mims92/79c5c46e142ff6178f979e9119a38277 to your computer and use it in GitHub Desktop.
Save mims92/79c5c46e142ff6178f979e9119a38277 to your computer and use it in GitHub Desktop.
AWS - Bash - Get SSM parameters by path, (un)encrypted
#!/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