How can I automate the creation of AWS architecture diagrams from CLI outputs or CloudFormation templates?

0
12
Asked By CodingNinja30 On

Hey everyone! I'm trying to find an efficient method to automatically generate AWS architecture diagrams for my setup. I've got a few things figured out: I can export my infrastructure using commands like `aws ec2 describe-instances` or by using CloudFormation templates that outline my resources like EC2 instances, ALBs, VPCs, and more.

What I'm after is a visual diagram that looks like a true AWS architecture diagram - showing all the components such as EC2 instances, load balancers, subnets, and the traffic flow between them, ideally using AWS's icon style. I'd prefer a solution that works automatically or at least semi-automatically—I really don't want to spend time dragging and dropping icons for each diagram.

I'd also like to be able to export the final output to something like draw.io or Lucidchart, so I can tweak it if needed.

I've done my homework and looked into Cloudcraft, Hava, AWS Perspective, and Former2, but I'm also on the lookout for any open-source, self-hosted, or CLI-based solutions. I'm open to using Terraform Graph or Python scripts to read JSON or YAML data and convert it into a visual representation or a .drawio file.

Here are my main questions:
1. Are there good tools or workflows that can take CLI output or CloudFormation templates and turn them into diagrams?
2. Has anyone created custom scripts to automatically convert AWS JSON to draw.io XML?
3. Any tips on keeping these diagrams updated automatically as the infrastructure evolves?

If you've tackled this before, I'd love for you to share your tools, workflows, or any scripts you've created. Thanks in advance!

3 Answers

Answered By DiagramMaster77 On

You might want to look into Amazon's blog about using their Q CLI and MCP to build AWS architecture diagrams. I’ve tried a basic implementation, and it turned out pretty well. They mentioned the possibility of documenting directly from CloudFormation templates, which could be super useful for your use case!

Answered By DevOpsNerd88 On

If you’re using the Cloud Development Kit (CDK), PDK has a plugin that can generate diagrams for you. It’s worked decently for simpler stacks, although it might be trickier with more complex architectures. Check out the repository on GitHub for guidance!

Answered By TechGuru21 On

Diagrams are most useful when they're based on your intent rather than raw output, so I’d recommend using Infrastructure as Code (IaC) for this. If you're looking for a starting point, check out CloudMapper. It allows you to create diagrams based on what is defined in your environment and should give you better results than trying to diagram directly from AWS CLI outputs.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.