DEV Community

Cover image for Install cfn-lint on Windows
Sarah Lean šŸ“󠁧󠁢
Sarah Lean šŸ“󠁧󠁢

Posted on • Originally published at techielass.com

Install cfn-lint on Windows

Lint testing your code is something that should be done
whether you are writing software code or infrastructure code.

When writing AWS CloudFormation templates you can use the cfn-lint to perform lint testing on your code.

The cfn-lint tool can validate both YAML and JSON templates against the AWS CloudFormation Resource Specification.

I've been recently trying to upskill on AWS CloudFormation as an Infrastructure as Code (IaC) language and get into good habits of lint testing my code as I go. I've looked to cfn-lint to help me. I found the instructions on how to install this tool on Windows lacking. But I have found a way to make it work!

Step 1 - Install Windows Subsystem for Linux

Windows has a tool called Windows Subsystem for Linux (WSL), that allows you to run a GNU/Linux environment on your Windows machine without the overhead of having to run a dual booting system on your machine.

To install WSL on your machine open up an elevated PowerShell command and type:

wsl --install
Enter fullscreen mode Exit fullscreen mode

This will download the latest Linux kernel, and install a Linux distribution, by default this is Ubuntu.

Once WSL has been installed you will be asked to set up a username and password. Follow best practices with this. If you ever forget the password, you can reset it.

Step 2 - Install python

The cfn-lint tool has a dependency on python so we need to ensure that is installed. We can do this by issuing the command within our WSL terminal:

sudo apt install python3 python3-pip
Enter fullscreen mode Exit fullscreen mode

Step 3 - Install cfn-lint

Now we have all the dependencies installed we can install the tool itself. To do that we use the command:

pip install cfn-lint
Enter fullscreen mode Exit fullscreen mode

Once the install completes, close your terminal and re-open it.

Start to use cfn-lint

Everything is now installed and ready for you to use!
cfn-ling within a Ubuntu terminal

Top comments (0)