Hey folks! I'm trying to find a practical method for automatically generating AWS architecture diagrams for my infrastructure. I have a couple of options at my disposal: I can export my infrastructure as JSON files using various `aws ec2 describe` commands, or I have CloudFormation templates that describe my resources, including EC2, Load Balancers, Subnets, and more. What I'm aiming for is a visual representation that resembles the typical AWS architecture diagram, showing elements like EC2 instances, Load Balancers, VPCs, subnets, target groups, and perhaps even arrows illustrating traffic flow, all in the official AWS icon style.
The catch is that I want this process to be automatic or semi-automatic, as dragging and dropping icons manually each time just doesn't cut it. Ideally, the output should be something compatible with tools like draw.io or Lucidchart, so I can make adjustments if necessary.
I've looked into a few tools like Cloudcraft, Hava, AWS Perspective, and Former2 but I'd really appreciate any recommendations for open-source, self-hosted, or CLI-friendly solutions. I'm also open to exploring Terraform Graph, Python scripts, or anything else that can analyze JSON or YAML data and produce a visual diagram or at least a .drawio file.
My specific questions are: 1) Are there any reliable tools or workflows that can convert describe output or CloudFormation templates into useful diagrams? 2) Has anyone developed custom scripts to automatically transform AWS JSON into draw.io XML? 3) Any advice for keeping these diagrams updated automatically as my infrastructure evolves? If you've tackled this issue before, please share your tools, workflows, or scripts. Really looking forward to your insights! Thanks a bunch!
3 Answers
There’s a plugin for the AWS CDK in PDK that can generate diagrams. I’ve tested it with a simple stack, and it worked quite well. Just a heads-up, it might have trouble with more complex stacks.
Check out the AWS blog post about building architecture diagrams using the Amazon Q CLI and MCP. I tried it out, and it looked pretty decent! I asked about documenting CloudFormation, and they said yes, although I haven't had a chance to test it myself.
It’s tough to automatically generate diagrams since they often need to reflect the intent behind your infrastructure rather than just the deployed resources. However, you might find the GitHub repo ‘cloudmapper’ useful as a starting point. It can help create diagrams based on your infrastructure as code, which could give you a more accurate representation than just using the describe outputs directly.

Related Questions
How To Get Your Domain Unblocked From Facebook
How To Find A String In a Directory of Files Using Linux