CFN Diagram

1 min read cloudformation, diagram, tools

Written in 2021. Tools, APIs and prices may have changed since.

Lab note What I wrote down while learning this by building with it. Short by design; the code is in pfeilbr/cfn-diagram-playground.

learn cfn-diagram

CLI tool to visualise CloudFormation/SAM/CDK templates as diagrams.

Usage

# install
npm i -g @mhlabs/cfn-diagram

# draw.io render
cfn-dia draw.io --template-file CloudFrontS3WebsiteCdkStack.template.yaml \
    --output-file CloudFrontS3WebsiteCdkStack.drawio

# html render
cfn-dia html --template-file CloudFrontS3WebsiteCdkStack.template.yaml \
    --output-path CloudFrontS3WebsiteCdkStack-html

Screenshots

draw.io view in vscode

draw.io view in vscode - hover resource for details

html view

Notes

  • good starting point. generate draw.io to get all resources and icons, then modify from there.
  • allows for filtering by resource types to eliminate resources that may not be needed.
  • works by importing cfn template into CDK. CDK allows to treat as graph for traversal and inspection

Resources

Keep learning

Get new guides and courses by email

An occasional email when I publish a new guide, course or post. No spam, and you can unsubscribe any time.

Sent with Buttondown. I never share your address. Prefer a feed? Use the RSS feed.