Validating the template
Whenever we execute aws cloudformation create-stack
(or update-stack
), CloudFormation will first validate the template, checking whether it is a valid JSON or YAML file (a syntax check) and whether there are any critical issues, such as circular dependencies.
Although template validation is a necessary step before stack deployment, many things will break stack deployment, even if validation succeeds:
- Missing required resource properties
- Syntax errors and typos in resource property names
- Non-existent resource property values
We could continue with this list, but let’s move from theory to practice.
The command that runs template validation is straightforward:
$ aws cloudformation validate-template --template-body file://path_to_your_template
For example, if we want to validate our core template, we need to run the following command:
$ aws cloudformation validate-template --template-body file://core.yaml
If there is...