Skip to content

Instantly share code, notes, and snippets.

@takayamaki
Created December 5, 2020 10:00
Show Gist options
  • Save takayamaki/9f8d567de94d3ea860967c27c0de8c75 to your computer and use it in GitHub Desktop.
Save takayamaki/9f8d567de94d3ea860967c27c0de8c75 to your computer and use it in GitHub Desktop.
Extract parameter to environment variable from parameter store using aws cli and jq
#!/bin/bash
if [ -v $AWS_PARAMETER_STORE_REGION ] || [ -v $AWS_PARAMETER_STORE_PREFIX ]; then
exit 0
fi
aws ssm --region $AWS_PARAMETER_STORE_REGION get-parameters-by-path --with-decryption --path $AWS_PARAMETER_STORE_PREFIX | jq -r -c '.Parameters[]|"export \(.Name|split("/")[-1])=\"\(.Value)\""'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment