Skip to content

CLI tool to visualise CloudFormation/SAM/CDK stacks as visjs networks or draw.io diagrams.

Notifications You must be signed in to change notification settings

NetRock6/cfn-diagram

Repository files navigation

cfn-diagram

Node.js CI

CLI tool to visualise CloudFormation templates as diagrams.

Installation

npm i -g @mhlabs/cfn-diagram

Usage

Usage: cfn-dia [options] [command]

Options:
  -v, --vers            output the current version
  -h, --help            display help for command

Commands:
  draw.io|d [options]   Generates a draw.io diagram from a CloudFormation template
  html|h [options]      Generates a vis.js diagram from a CloudFormation template
  help [command]        display help for command

Output formats

Draw.io

Use it in combination with the Draw.io Integration for VS Code to instantly visualise your stacks.

Demo

Example

cfn-dia draw.io -t template.yaml

Features

  • Select only the resource types you want to see. This lets you skip granlar things like roles and policies that might not add to the overview you want to see
  • Navigate through a new differnet layouts
  • Works for both JSON and YAML templates
  • Filter on resource type and/or resource names

HTML

The HTML output uses vis.js to generate an interactive diagram from your template.

Demo

Example

cfn-dia html -t template.yaml

CI-mode

This functionality lives in its own CLI, cfn-diagram-ci. This is beacuse it requires headless Chromium to be installed which makes the package size very large

It uses pageres to generate a screenshot of a HTML diagram. This can be used in a CI/CD pipeline to keep an always up-to-date diagram in your readme-file.

Example

cfn-dia image -t template.yaml

Known issues

  • Some icons are missing. Working on completing the coverage.
  • When using WSL you might experience Error: spawn wslvar ENOENT when trying to use HTML output. To resolve, install wslu. See issue #9.

About

CLI tool to visualise CloudFormation/SAM/CDK stacks as visjs networks or draw.io diagrams.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 90.2%
  • HTML 9.8%