Skip to content

Instantly share code, notes, and snippets.

@mims92
Created August 24, 2020 08:04
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/3bbeaed2a798294cdcb585699849ed6c to your computer and use it in GitHub Desktop.
Save mims92/3bbeaed2a798294cdcb585699849ed6c to your computer and use it in GitHub Desktop.
AWS - Bash - Get a single SSM parameter, (un)encrypted
#!/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