Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 26 lines (19 sloc) 864 Bytes
# Get options
tfile="$(cd "$(dirname "${tname}")"; pwd)/$(basename "${tname}")"
# Delete old keypair
aws ec2 delete-key-pair --key-name ${kname} --region us-east-1
# Create and save EC2 key pair
aws ec2 create-key-pair --key-name ${kname} --output text --region us-east-1 | sed 's/.*BEGIN.*-$/-----BEGIN RSA PRIVATE KEY-----/' | sed "s/.*${kname}$/-----END RSA PRIVATE KEY-----/" > ${kname}.pem
chmod 600 ${kname}.pem
# Load hieradata param
hdata=`./ custom.yaml`
cmd="aws cloudformation create-stack --stack-name BTR-standard --template-body file:///${tfile} --capabilities CAPABILITY_IAM --region us-east-1 --parameters ParameterKey=KeyName,ParameterValue=${kname}"
# Create stack
if [[ -n "$hdata" ]]; then
cmd="${cmd} ParameterKey=Hieradata,ParameterValue=\"${hdata}\""
# Execute cmd
eval $cmd