How To - Install CFN-Python-Linter on Ubuntu Linux 19.10 Desktop

CFN-Python-Linter is a tool used to validate AWS CloudFormation templates before they are used. Having the ability to validate the code before finding errors at runtime is a crucial time-saving tool. This blog post details the installation of CFN-Python-Linter on Ubuntu Linux 19.10. The VM used in this install is a default configuration. Cfn-python-linter is maintained at the following Github site https://github.com/aws-cloudformation/cfn-python-lint .

Install

Text Version. - see below for the version w/ graphics

  1. Install python 3.7

    sudo apt install python3
  2. Install pip

    sudo apt-get install python3-pip
  3. Install CFN-Python-Linter

    sudo pip3 install cfn-lint

Test 

Validate it works by running cfn-lint and passing in the name of a CloudFormation yaml file.

cfn-lint <name file>


Install w/ Graphics

  1. Install python 3.7

    sudo apt install python3
Install_Python3_ubuntu_19.10.png

2. Install pip

    sudo apt-get install python3-pip
Install_pip3_ubuntu_19.10.png

3. Install CFN-Python-Linter

       sudo pip install cfn-lint 
Install_cfn_lint.png

4. Verify it’s installed by running a cfn-lint by itself from the command line.

      cfn-lint
cfn-lint-installed_screenshot.png

5. Test that it’s working by running cfn-lint and passing in the name of a CloudFormation template in yaml format. In my case, cfn-lint output a couple of recommendations.

       cfn-lint <filename>
cfn-lint_demo_screenshot.png

At this point, the linter is installed and can be used at the command line to validate AWS infrastructure code.