Created
April 30, 2014 22:21
-
-
Save carmstrong/4a2225e46bab4698bb3c to your computer and use it in GitHub Desktop.
dynamic user-data in provision-ec2-cluster.sh
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
#!/usr/bin/env bash | |
# | |
# Usage: ./provision-ec2-cluster.sh | |
# | |
set -e | |
THIS_DIR=$(cd $(dirname $0); pwd) # absolute path | |
CONTRIB_DIR=$(dirname $THIS_DIR) | |
source $CONTRIB_DIR/utils.sh | |
# check for EC2 API tools in $PATH | |
if ! which aws > /dev/null; then | |
echo_red 'Please install the AWS command-line tool and ensure it is in your $PATH.' | |
exit 1 | |
fi | |
# generate our formatted user-data from ../coreos/user-data | |
IFS='' | |
echo '' > ./user-data | |
while read line | |
do | |
echo "\"$line\n\"," >> ./user-data | |
done < ../coreos/user-data | |
# create an EC2 cloudformation stack based on CoreOS's default template | |
aws cloudformation create-stack \ | |
--template-body sed '/USERDATA_STUB/{ | |
s/USERDATA_STUB//g | |
r ./user-data | |
}' deis.template \ | |
--stack-name deis \ | |
--parameters "$(<cloudformation.json)" | |
echo_green "Your Deis cluster has successfully deployed to AWS CloudFormation." | |
echo_green "Please continue to follow the instructions in the README." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment