DEV Community

Cover image for Create Architecture Diagrams in Seconds with the Amazon Q Developer CLI Agent!
Faye Ellis for AWS Heroes

Posted on

4 2

Create Architecture Diagrams in Seconds with the Amazon Q Developer CLI Agent!

If you haven't used the Amazon Q Developer CLI Agent, this is your sign to get started!

Installation Steps

Install is very quick and easy, though the steps vary depending on your operating system, so you'll need to follow the required steps for your particular OS.

I use a Mac, so my steps were really straightforward, if you are also using a Mac, here's what you do to install the Q Developer Agent CLI. In a terminal, simply type:

brew install amazon-q
You can verify the install using:

q --version
If it doesn’t show the version the first time, then just restart your shell or terminal and try again.

exec $SHELL
q --version
Enter fullscreen mode Exit fullscreen mode

Next login to the Q Developer CLI, you'll get the choice of logging in using your AWS Builder ID which is the free-tier option, or if you are subscribed to pro-tier log in using your IAM Identity Center credentials:

q login
Then, to start a session with the Q Developer CLI, its:
q chat

Creating Architecture Diagrams from an IaC Template

I wanted to use Q to help me quickly create an architecture diagram based on the contents of my CloudFormation template that I was using to create a basic VPC. As my template is saved in GitHub, I provided a link to the raw file in my prompt and Q was able to find it, however you can of course get Q to read the files on your local machine, inside the directory you're working in.

The Prompt

First I tried creating a Mermaid diagram. If you haven't used Mermaid before, it's a JavaScript based tool used for rendering diagrams from markdown text.
Here's the prompt I used:

Create a mermaid diagram that represents the contents
of the CloudFormation template named cf-template.yaml.
Here is a link to the template:
https://raw.githubusercontent.com/fayekins/amazon-q-dev/refs/heads/main/cf-template.yaml 
The diagram should include all the AWS resources that
are described in the template, and use the following 
best practices: 
consistent spacing between elements, 
align elements properly, 
use clear labels for all components, 
include CIDR blocks for all networking components,
make sure text is a readable size.
Enter fullscreen mode Exit fullscreen mode

The resulting diagram that Amazon Q Developer created can be viewed by pasting the resulting code into the Mermaid Live Editor.

Here's the result, not too bad!

Q generated a simple diagram based on my CloudFormation template

Refining the Diagram

Ultimately, I wanted to get Q to create diagrams that I could actually use. For that I really need the official AWS icons. So I asked Q to create a draw.io diagram instead, using the official icons. Here's my next prompt:

Can you create the same diagram again but this time
create a draw.io diagram using the correct AWS icons
for the AWS resources.
Enter fullscreen mode Exit fullscreen mode

Here's the response from Q, explaining the steps taken and instructions for viewing the diagram.
The response from Q, explaining the steps taken and instructions for viewing the diagram

And here is the result, a pretty decent diagram!

An updated version of my diagram, in draw.io format and using AWS icons

I'm really happy with the result, and will definitely be able to use this capability going forward! Amazon Q Developer is certainly improving fast and I'm looking forward to seeing what else it can do to save me time day-to-day.

Would you use AI to create your architecture diagrams?

Feature flag article image

Create a feature flag in your IDE in 5 minutes with LaunchDarkly’s MCP server 🏁

How to create, evaluate, and modify flags from within your IDE or AI client using natural language with LaunchDarkly's new MCP server. Follow along with this tutorial for step by step instructions.

Read full post

Top comments (0)

Feature flag article image

Create a feature flag in your IDE in 5 minutes with LaunchDarkly’s MCP server 🏁

How to create, evaluate, and modify flags from within your IDE or AI client using natural language with LaunchDarkly's new MCP server. Follow along with this tutorial for step by step instructions.

Read full post

👋 Kindness is contagious

Dive into this compelling post celebrated by our lively DEV Community. Developers everywhere are invited to share insights and uplift our collective expertise.

A simple “thank you” can make someone’s day—drop your appreciation in the comments!

On DEV, sharing expertise sparks growth and tightens our community bonds. Found this helpful? A quick nod to the author goes a long way.

Get started