> ## Content Index
> Fetch the complete content index at: https://www.techielass.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Install cfn_nag on Windows
- URL: https://www.techielass.com/install-cfn-nag-on-windows/
- Published: 2022-05-17T07:10:00.000Z
- Updated: 2022-05-17T07:09:59.000Z
- Description: Join me in this blog post as I install the cfn_nag tool on my Windows machine.
- Author: Sarah Lean
- Tags: AWS CloudFormation, AWS, aws cloudformation tutorial, Amazon Web Services, Lint, lint testing, cfn-nag

When writing any type of code you always want it to follow best practices or be as secure as it can be. 

When writing [AWS CloudFormation templates](https://www.techielass.com/create-an-s3-bucket-using-aws-cloudformation) you can use **cfn\_nag** to perform some basic security tests on your templates. 

The tool can validate both JSON and YAML AWS CloudFormation templates against the [AWS CloudFormation Resource Specification](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification.html?ref=techielass.com). 

I recently wanted to use the [cfn-nag](https://github.com/stelligent/cfn%5Fnag?ref=techielass.com) tool on some templates I was writing but couldn't find any instructions to install on Windows, but I have found a way to do it.

## Step 1 - Install Windows Subsystem for Linux

Windows has a tool called [Windows Subsystem for Linux (WSL](https://docs.microsoft.com/windows/wsl/about?WT.mc%5Fid=AZ-MVP-5004737&ref=techielass.com)), 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:

```powershell
wsl --install

```

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](https://www.techielass.com/reset-ubuntu-password-in-wsl-on-windows-10). 

## Step 2 - Install Ruby

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

```powershell
sudo apt install ruby

```

## Step 3 - Install the cfn-nag tool

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

```powershell
sudo gem install cfn-nag

```

## Start to use cfn-nag

Everything is now installed and ready for you to use!

![cfn-nag tool installed](https://storage.ghost.io/c/08/96/08960c71-63a2-449b-91b1-8d4628166dd2/content/images/2022/05/cfnnagtoolinstalled.png)

cfn-nag tool installed