Posted On: Jan 18, 2023

Amazon CloudFormation announces support for CloudFormation Linter (cfn-lint) in Amazon Serverless Application Model Command Line Interface ( SAM CLI). The cfn-lint tool validates your JSON/YAML template against CloudFormation-based rules, and returns diagnostic error messages. With this launch, you can use an optional parameter --lint in sam validate command to run cfn-lint validations on your JSON/YAML templates.

You can use --lint to validate for CloudFormation-based rules. These rules checks for template properties such as template size, template description limits, Fn::GetAtt parameters, Fn::If syntax structure, and others. For a complete list of default rules, refer to cfn-lint rules guideline.

This feature is now available in the Amazon Web Services China (Beijing) Region, operated by Sinnet, and the Amazon Web Services China (Ningxia) Region, operated by NWCD. To install the latest version of the SAM CLI refer to the following instructions.