CFN Diagram

learn cfn-diagram

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


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

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

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

Screenshots view in vscode view in vscode - hover resource for details

html view


  • good starting point. generate 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