New Feature

CDK Architecture Diagram Generator — Visualize AWS CDK Apps Instantly

By Raghvendra Pandey · April 2026 · 5 min read

InfraSketch now supports AWS CDK. Run cdk synth, paste the JSON output into the CDK tab, and get a full architecture diagram in seconds — VPC containment, subnet lanes, resource connections, official AWS icons. No login, no credentials, everything in your browser.

Try it now

Paste your cdk synth output and see the diagram instantly.

Open InfraSketch →

Why CDK needs a diagram tool

CDK is increasingly the default way teams write AWS infrastructure — TypeScript, Python, or Go code that compiles down to CloudFormation. The abstractions are great for development velocity, but they create a visibility problem: when something goes wrong, or when you need to explain the architecture to someone outside your team, the source code is not the right artifact to share.

The CloudFormation console shows you a stack but won't visualize containment. The CDK tree view shows construct hierarchy, not network topology. There's no built-in way to go from a CDK app to a clean architecture diagram without manually drawing one.

InfraSketch fills that gap. One command, paste, done.

How to get your CDK synth output

cdk synth | pbcopy          # macOS — copies to clipboard
cdk synth > template.json  # save to file

Then open infrasketch.cloud, click the CDK tab, paste, and click Generate Diagram.

Tip: If your app has multiple stacks, use cdk synth MyStack to synthesize a specific stack, or paste each stack's output separately to diagram them individually.

How it works under the hood

CDK compiles to CloudFormation JSON. InfraSketch's CDK tab runs the same parser as the CloudFormation tab — it reads the Resources object, maps each Type to a visual category, and infers topology from Ref and Fn::GetAtt references between resources.

CDK logical IDs look different from hand-written CloudFormation — CDK generates names like VPCB9E5F0B4 and EKSCluster9EE0221C — but the diagram labels use the resource type and truncated logical ID, making it easy to identify resources without needing the CDK source code in front of you.

What gets visualized

VPC containment

Resources with VpcId: { Ref: VPC } are drawn inside the VPC box. CDK's ec2.Vpc construct generates this automatically.

Subnet placement

Public and private subnet lanes from CDK's SubnetSelectionSubnetIds in the synthesized JSON places resources in the right lane.

Connection arrows

Every Fn::GetAtt between supported resources becomes a directed arrow — Lambda → IAM Role, ECS Service → ALB Target Group, etc.

Zone grouping

Internet zone (IGW, CloudFront), messaging zone (SQS, SNS), data zone (RDS, ElastiCache, S3) — all inferred automatically from resource type.

Supported CDK constructs (L1 / Cfn*)

Any CDK L1 construct (prefixed Cfn) maps directly to a CloudFormation resource type and is fully supported. Common L2 constructs synthesize to the same underlying types:

Use cases

Works with CDK for Terraform too

CDK for Terraform (CDKTF) can synthesize Terraform JSON. If you're using CDKTF, use the Terraform tab and paste the synthesized JSON — InfraSketch's plan JSON parser handles it directly.

Generate your CDK diagram now

Run cdk synth | pbcopy, paste into the CDK tab, click Generate. Free, no login, nothing leaves your browser.

Open InfraSketch →