Install the SDK
​Install the SDK using one of these options:
After installation, you can get started writing rules with our Getting started guide.

Install the SDK with npm

Install our SDK using npm.

Prerequisites

  • Ensure you’ve installed the latest version of npm on your local environment, using Node version 10 or later.

Steps

Run this command to install it for local use:
1
npm install -g snyk-iac-rules
Copied!
Once installed, you are ready to use the SDK. Run the following command to verify that it works:
1
snyk-iac-rules --help
Copied!

Install the SDK using the prebuilt binaries

You can download and use the SDK's prebuilt binaries. To download the prebuilt binary, visit the Releases tab in the SDK repository page in GitHub:
After you've downloaded the desired binary archive, open a terminal and run the following commands (note that these commands assume you're running on an Intel-based macOS and downloading version 0.0.5 of the SDK):
1
$ tar xzf snyk-iac-rules_0.0.5_Darwin_x86_64.tar.gz
2
$ sudo mv snyk-iac-rules /usr/local/bin
Copied!
To verify the ability to use it, run:
1
snyk-iac-rules --help
Copied!

Install the SDK with Homebrew

From macOS and Linux environments, you can use Homebrew to install our SDK. The repository for installation is stored in our GitHub.

Prerequisites

  • Supported for macOS and Linux environments only.
  • Ensure Homebrew has already been installed:
    1
    brew tap snyk/tap
    Copied!

Steps

Install the SDK as follows:
1
brew install snyk-iac-rules
Copied!

Install the SDK with the Windows Scoop package manager

From Windows environments, you can use Scoop to install our snyk-iac-rules SDK. The repository for installation is stored in our GitHub.

Prerequisites

  • Supported for Windows environments only.
  • Ensure Scoop has already been installed:
    1
    scoop bucket add snyk https://github.com/snyk/scoop-snyk
    Copied!

Steps

Install the SDK as follows:
1
scoop install snyk-iac-rules
Copied!

Install the SDK with Docker

You can use Docker to install and run our snyk-iac-rules SDK while writing your custom rules in your local directory. The image is stored in our Docker Hub repo.

Prerequisites

  • Ensure Docker has already been installed.
  • Supported for Linux containers only.

Steps

Pull the Docker image as follows:
1
docker pull snyk/snyk-iac-rules
Copied!
Run the SDK by using the following command:
1
docker run --rm -v $(pwd):/app snyk/snyk-iac-rules {SDK command}
Copied!
For example, to generate a custom rules template you can run:
1
docker run --rm -v $(pwd):/app snyk/snyk-iac-rules template -r {rule_name}
Copied!

See also