Home

Awesome

Mentioned in Awesome CDK Test npm version Contributor Covenant

🎡 CDK-Dia - Automated diagrams for CDK infrastructure

Cdk-dia diagrams your CDK provisioned infrastructure using the Graphviz dot language.

Example

This Diagram was automatically generated from an AWS CDK stack

<p align="center"> <img src="docs/diagram.png" /> </p>

Getting started - Typescript / Javascript

Add cdk-dia to your CDK project

npm install cdk-dia

Install Graphviz

brew install graphviz

Synthesize your CDK application

cdk synth

Generate a CDK-DIA diagram PNG

npx cdk-dia

Generate a CDK-DIA diagram as an interactive HTML (experimental)

npx cdk-dia --rendering cytoscape-html
<br/>

Getting started - any other CDK language

Globally install cdk-dia

npm install cdk-dia -g

Install Graphviz

brew install graphviz

Synthesize your CDK application

cdk synth

Generate a CDK-DIA diagram

cdk-dia
<br/>

Customize diagrams

In some cases it is useful to be able to tweak a diagram. For this purpose CDK-DIA includes customizers/decorators you can use with your CDK constructs in order to tweak the diagram.

Limitations:

Example:

Consider the following diagram of a 3-Tier CDK Stack: <img src="docs/decorator_example_collapsed.png" />

In this diagram CDK-DIA collapsed the DBTier (done automatically to any CDK Level 2 (L2) construct) in order to create a diagram which contains the most important details.

One can use a decorator in order to customize the diagram and prevent CDK-DIA from collapsing the Construct.

This is done by implementing CDK's IInpectable's interface and using CDK-DIA's decorator. example:

<img src="docs/decoration_example_diff.png" />

This results in a Diagram where the DB-Tier was not collapsed providing more details: <img src="docs/decorator_example_non-collapsed.png" />

CLI arguments

🙏🏽 Contributing

Contribution is covered in the CONTRIBUTING.md markdown.