Member-only story

Diagram as Code; creating AWS architecture diagrams.

Because now everything is with code.

Alex
4 min readApr 9, 2025
Everything as code according to the AI,

I have been using draw.io for a long time, no complains, but we always want to save time, right? with the explosion of AI tools this side of the software development cycle is not an exception.

So for this exercise we can use a Python library called Diagrams and my best friend, Copilot.

We can start a creating a Python virtual environment, is a good practice to manage dependencies for your project. Here’s how you can do it on your Mac:

python3 -m venv venv

Activate the virtual environment:

source venv/bin/activate

Install the required dependencies:

pip install -r requirements.txt

Let´s startt with a simple example, for this purpose we can create a aws_diagram.py file.

from diagrams import Diagram
from diagrams.aws.compute import EC2
from diagrams.aws.database import RDS
from diagrams.aws.network import ELB
from diagrams.aws.network import VPC
from diagrams.aws.storage import S3

with Diagram("AWS…

--

--

Alex
Alex

Written by Alex

DevOps Lead @evinova, former Dynatrace Solutions Engineer. Cheerleader in Chief for KMMX, Technical Writer & International Speaker, Dad & 2 cats.

No responses yet