-
-
Save akdasari1980/a4bfd0bd40f68d753445aa2935854671 to your computer and use it in GitHub Desktop.
awscli shell script to create a cloudformation stack
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 | |
STACK_NAME=$1 | |
if [ -z "$1" ] | |
then | |
echo "No STACK_NAME argument supplied" | |
exit 1 | |
fi | |
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
echo "Creating stack..." | |
STACK_ID=$( \ | |
aws cloudformation create-stack \ | |
--stack-name ${STACK_NAME} \ | |
--template-body file://${DIR}/cron-batch-stack.yml \ | |
--capabilities CAPABILITY_IAM \ | |
--parameters file://${DIR}/parameters.json \ | |
--tags file://${DIR}/tags.json \ | |
| jq -r .StackId \ | |
) | |
echo "Waiting on ${STACK_ID} create completion..." | |
aws cloudformation wait stack-create-complete --stack-name ${STACK_ID} | |
aws cloudformation describe-stacks --stack-name ${STACK_ID} | jq .Stacks[0].Outputs |
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
[ | |
{ | |
"ParameterKey": "MyFooParam", | |
"ParameterValue": "bar" | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment