When integrating CloudFormation into your CI/CD pipeline you are faced with the challenge of creating a CloudFormation stack on the first run of the pipeline, while you need to update the stack for all following pipeline runs. If you use the AWS CLI this is painful.
You may also have your code and template in the same repository. Therefore code changes without the template. But the AWS CLI threats an update without changes to a stack as an error which is not the behavior that you need in your pipeline.
cfn-create-or-update can create or update a CloudFormation stack. If no updates are to be performed, no error is thrown. cfn-create-or-update behaves exactly as the AWS CLI regarding input values, output will be different.
To install the CLI tool
To create or update a stack, run:
The first time you run this command, a stack will be created. The second time an update will be performed but only if the template has changes.
Global parameters (as documented in the AWS CLI
Only used during create, otherwise ignored (as documented in the AWS CLI create-stack):
Only used during update, otherwise ignored (as documented in the AWS CLI update-stack):
Additional parameter, to wait for create complete / update complete.