4

When I upload a CloudFormation template to AWS's Management Console it takes a few minutes for AWS to process the template.

Doing this for say 20 iterations means a significant chunk of time is just waiting for an error message.

Is there anyway to test it prior to uploading it to AWS's Management Console (preferably a bit more than just "is it valid JSON")?

E.g. a tool that ran through:

  1. is it valid JSON?
  2. is the input to each Resource / Parameter correct?
  3. etc...
1

1 Answer 1

5

you can use the aws cli validate-template command

validate-template

aws cloudformation validate-template --template-body file://path/to/template

In my workflow I have this integrated into a pre-commit git hook to perform some automatic validation

cfn-lint

There is now an awslabs project called cfn-lint that integrates with a variety of editors, it does a more extensive linting of templates. It's available from the awslabs on Github

https://github.com/awslabs/cfn-python-lint

This can also be added as a precommit for your cloudformation workflow

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.