Created
January 8, 2018 21:33
-
-
Save mdp/723d04cf211ca3a4e3d707e2c6393d56 to your computer and use it in GitHub Desktop.
.env to SSM
This file contains 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 | |
# Usage: ./env-to-ssm.sh prefix envfile | |
# Ex: ./env-to-ssm.sh prod.app .env | |
AWS_SSM_PREFIX=$1 | |
ENV_FILE=$2 | |
cat aws/.env | grep -v ^# | grep -v -e '^$' | while read line | |
do | |
IFS='=' read -r key val <<< "$line" | |
echo "Setting $AWS_SSM_PREFIX.$key: $val" | |
aws ssm put-parameter --overwrite --cli-input-json '{ | |
"Name": "'"$AWS_SSM_PREFIX.$key"'", | |
"Value": "'"$(echo $val | sed -e 's/^"//' -e 's/"$//')"'", | |
"Type": "SecureString" | |
}' | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment