Skip to content

Instantly share code, notes, and snippets.

@petronetto
Forked from naoty/ssm2env
Created July 31, 2023 11:09
Show Gist options
  • Save petronetto/01f8a5c6aa176f9bc7ae513ceb930066 to your computer and use it in GitHub Desktop.
Save petronetto/01f8a5c6aa176f9bc7ae513ceb930066 to your computer and use it in GitHub Desktop.
Create .env file from SSM parameter store
#!/bin/bash -e
aws ssm get-parameters-by-path \
--path "/myapp/" \
--with-decryption \
--query "Parameters[*].[Name,Value]" \
--output text |
while read line
do
name=$(echo ${line} | cut -f 1 -d ' ' | sed -e 's/\/myapp\///g')
value=$(echo ${line} | cut -f 2 -d ' ')
echo "${name}=${value}" >> .env
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment