Imagine that you want to document an AWS account, a network topology, an application, etc, with a diagram. That would be a good idea, because it's certainly the best way to do it.
However this can take time, especially if you have many resources to explore.
Recently wondered how I could minimize this effort using my Agentic IDE.
I ended drawing a simple model of what I wanted and then, with one command, asked my IDE to draw a new one with real data.
In brief, I'm now able to do this kind of thing:
/draw-from-model vpc-and-subnets.model.drawio
Which I can represent this way:
I wanted to share this, and explain the phases that helped me to get there:
Phase 1 - Extract data, create Model Diagram, mix both
Phase 2 - Create Diagram Model, deduct data to extract, mix both
Phase 3 - Do it with a custom agent: /draw-from-model
Phase 4 - Draw new diagrams from any model
N.B.: I chose the AWS Kiro IDE, but you can apply this with another Agentic IDE as long as you can extend it with custom agents.
Phase 1 - Extract data, create Model Diagram, mix both
I started with a simple approach, trying to extract the data I wanted first. Before creating a diagram model.
1.1 - Extract Data from the AWS Account
So, I started to ask for a script that extracts data from my AWS account. I spotted VPC and Subnets, which are basic and easy to understand.
A VPC (Virtual Private Cloud) is an isolated network that covers multiple availability zones (a data center to make things simple) in an AWS region.
VPCs contain Subnets, which are subnetworks associated with an availability zone.
So here is the prompt I used for that:
> create a python script to extract vpc and subnets data from eu-west-1 region
Then I executed the script
$ python3 vpc_subnets_eu_west_1.py
And I got a file named vpc_subnets_eu_west_1.json
1.2 - Draw a model with drawio in your IDE
Then I drew a model of what I wanted with an account, a VPC and multiple subnets (public and private)
1.3 - Cross Data and Diagram Model
Then I asked Kiro to cross the extracted data and the diagram model
cross #diagram.model.drawio + #vpc_subnets_eu_west_1.json and create a new diagram
And I got a new diagram...
Not bad at all...I verified on my account and that was exact!
Phase 2: Create Diagram Model, deduct data to extract, mix both
Then I thought, maybe we can ask the LLM directly to deduct the data I need from the diagram model. That's what I tried.
2.1 Use the model diagram to deduct data to extract
Actually, the data that I want to extract are in the model. So, why should I specify the data in the prompt forehand and take the risk of forgetting something?
So, I started to ask:
from #diagram.model.drawio generate a python script to extract necessary data from aws account if I want to create an equivalent diagram
That created another script to extract the data (the same kind of script I created earlier)
$> python3 extract_vpc_diagram_data.py
The result is a file name diagram_data.json
2.2 Crossing data and diagram model
Then I crossed the data and diagram again.
cross #diagram.model.drawio + #diagram_data.json and create a new diagram
And obtained this diagram:
The layout is a bit different, but the content is similar.
Phase 3 - Do it with a custom agent: /draw-from-model
With Kiro, you can create what we call "custom agents", they are files where you can write a workflow of actions (like a shell script in natural language).
Then this helper can be found in the Kiro Chat interface, thanks to the dash bar ('/').
For example you can create a /draw-from-model custom agent, taking a model as a parameter, that executes exactly what I did with multiple prompts previously.
You can write it manually or generate one with this kiro helper /custom-agent-creator
So I tried it:
/custom-agent-creator using this context create a custom agent does this steps (extract data from diagram, draw new diagram). Keep custom agent as simple as possible.
Here is the result, which actually contains the previous prompt I used, more or less.
And now I can use it in my IDE chat box:
/draw-from-model diagram.model.drawio
The result is similar to what I got previously:
Phase 4 - Draw new diagrams from any model
Then I thought, let's try with a brand new model, with different resources.
So, I redrew my diagram model asking for API gateways and their integrations.
And I used my custom agent:
/draw-from-model diagram.model.drawio
Here is the result:
Not bad at all.
Conclusion
LLM are obviously good at crossing data, in this case I wanted to cross network and subnets data from my AWS account with a network and subnets diagram model.
Then I thought we could extract what I wanted directly from the diagram. It's like I was using my diagram as a query language :)
Then I took advantage of custom agents to create a helper that I can use from my IDE chat, with any model.
It's a very nice and promising discovery. It might need some more tests and improvements, but I think I will use it quite often in the future!











Top comments (0)