AWS CloudFormation — cfn-lint

less than 1 minute read

Validate CloudFormation templates before deploying.


Install

$ pip install cfn-lint

Basic Usage

$ cfn-lint template.yaml
E3012 Property Resources/WebServer/Properties/IntsanceType should be InstanceType
template.yaml:15:7

What It Checks

Category Examples
Syntax Missing required properties, typos
Resource types Invalid resource type names
Property values Wrong type (string vs integer)
Intrinsic functions Invalid !Ref, !GetAtt targets
Parameter constraints AllowedValues violations

Configuration — .cfnlintrc

# .cfnlintrc
templates:
  - templates/**/*.yaml
ignore_checks:
  - W3002   # ignore a specific warning
regions:
  - us-east-1
  - eu-west-1

VS Code Extension

Install the CloudFormation Linter extension for real-time validation in your editor.


What’s Next?

Multi-region testing with taskcat.

← GitHub Actions Deploy taskcat →

Updated: