Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
AWS CodePipeline CloudFormation template length workaround
version: 0.1
phases:
pre_build:
commands:
- pip install awscli
build:
commands:
post_build:
commands:
- aws s3 cp ./cfn-ec2.json s3://attunuri/cfn-ec2.json
- aws cloudformation create-stack --stack-name <stack_name> --template-url https://s3.amazonaws.com/<bucket>/template.json --disable-rollback || aws cloudformation update-stack --stack-name cfn-ec2 --template-url https://s3.amazonaws.com/<bucket>/template.json
# create stack cmd
exit_status=$?
if [ $exit_status -ne 0 ]
then
cmd_output="$(# update stack 2>&1)"
exit_status=$?
if [ $exit_status -ne 0 ]
then
echo "$cmd_output" | grep -q "No updates to be performed"
if [ $? -eq 0 ]
then
exit_status=0
fi
fi
fi
exit $exit_status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment