How do you draw AWS architecture diagrams in Mermaid?
A practical walkthrough of drawing AWS architecture diagrams in Mermaid: the architecture-beta syntax, native AWS icons, VPC and subnet examples, exports, and how it compares to draw.io and Lucidchart.
Start the diagram with architecture-beta, declare services and groups using AWS icon slugs of the form aws:<icon-name>, and connect them with port-based edges like source:R <--> L:target. Stock Mermaid does not ship AWS icons; LatixEngine adds 856 official AWS icons to architecture-beta and renders the result as standard Mermaid markdown.
Mermaid is the most widely used text-based diagramming syntax in software documentation. It lives inside markdown, renders in GitHub, GitLab, Notion, Obsidian, and most internal documentation tools, and its source files version-control cleanly — no .drawio binaries to merge.
But there is one thing Mermaid does not ship out of the box: AWS icons. The architecture-beta diagram type was designed specifically for system architectures, yet it only includes a handful of generic shapes — server, database, cloud, disk, internet. If you want a diagram with an actual EC2 instance, an S3 bucket, or an Internet Gateway, you have to bring your own icon pack.
This post walks through exactly how to draw a full AWS architecture diagram in Mermaid syntax — VPC with public and private subnets, an Internet Gateway, a NAT, and EC2 instances — using native AWS icons. It also covers the slug lookup table for the most common services, how to handle multi-AZ layouts, and how Mermaid compares to draw.io and Lucidchart for the same job.
What is Mermaid's architecture-beta and why does it not ship AWS icons?
Mermaid supports several diagram types — flowchart, sequenceDiagram, classDiagram, stateDiagram, erDiagram, gantt, mindmap — each with its own syntax. architecture-beta is the type built specifically for cloud and system architecture diagrams. It introduced two new primitives: service (a leaf node with an icon and label) and group (a container that can hold services and other groups).
The architecture-beta type ships a small built-in icon set: internet, cloud, database, disk, and server. That is enough for a generic three-tier diagram, but not enough to draw a real AWS architecture. AWS alone has hundreds of services with distinct iconography that engineers and reviewers expect to see in a diagram.
The fix is provider icon packs. Mermaid exposes an iconPacks option that lets renderers register additional icon collections. LatixEngine ships 856 official AWS icons preregistered, so every aws:<icon-name> slug just works in the editor and in any Mermaid renderer bundled with the same icon pack.
How do you add AWS icons to a Mermaid diagram?
Inside the LatixEngine editor there is nothing to install or configure — every AWS icon is already registered. You reference an icon by its slug inside the parentheses of a service or group declaration.
architecture-beta
service ec2(aws:ec2-instance-contents)[EC2 Instance]
service s3(aws:arch-amazon-simple-storage-service)[S3 Bucket]
ec2:R <--> L:s3If you are self-hosting Mermaid and want to register the AWS icon pack yourself, fetch the catalog at latixengine.com/icons.json and pass it to mermaid.registerIconPacks during initialization. Each entry in the catalog has a provider, a slug, and a human-readable name.
AWS slugs are not always intuitive. Lambda is aws:arch-aws-lambda, not aws:lambda. S3 is aws:arch-amazon-simple-storage-service, not aws:s3. Always check the slug at latixengine.com/icons.json before assuming a name.
What does the syntax look like for an AWS VPC diagram?
Here is a complete diagram of a VPC with a public subnet (Internet Gateway, EC2 web server, NAT) and a private subnet (EC2 application server). This is the canonical AWS web-app reference architecture, written as Mermaid source.
architecture-beta
service internet(internet)[Internet]
group region(aws:region)[AWS Region]
group vpc(aws:virtual-private-cloud-vpc)[VPC] in region
service igw(aws:res-amazon-vpc-internet-gateway)[Internet Gateway] in vpc
group public_subnet(aws:public-subnet)[Public Subnet] in vpc
service ec2_public(aws:ec2-instance-contents)[EC2 Instance] in public_subnet
service nat(aws:res-amazon-vpc-nat-gateway)[NAT Instance] in public_subnet
group private_subnet(aws:private-subnet)[Private Subnet] in vpc
service ec2_private(aws:ec2-instance-contents)[EC2 Instance] in private_subnet
internet:L <--> R:igw
igw:T <--> R:ec2_public
igw:L <--> R:nat
nat:B <--> T:ec2_privateRead it top to bottom: the diagram declares the internet as a free-standing service, opens an AWS Region group, nests a VPC inside it, then a public and a private subnet inside the VPC. Services live inside the relevant subnet via the in group-id clause. The four edge lines at the bottom describe the traffic flow.
Which AWS slugs map to the most common services?
These are the slugs you will reach for most often when drawing AWS architecture in Mermaid. The full catalog of 856 AWS slugs is available at latixengine.com/icons.json.
| AWS service | Mermaid slug |
|---|---|
| EC2 instance | aws:ec2-instance-contents |
| Lambda function | aws:arch-aws-lambda |
| S3 bucket | aws:arch-amazon-simple-storage-service |
| API Gateway | aws:arch-amazon-api-gateway |
| CloudFront | aws:arch-amazon-cloudfront |
| DynamoDB | aws:arch-amazon-dynamodb |
| RDS | aws:arch-amazon-rds |
| VPC (group) | aws:virtual-private-cloud-vpc |
| Public subnet (group) | aws:public-subnet |
| Private subnet (group) | aws:private-subnet |
| Internet Gateway | aws:res-amazon-vpc-internet-gateway |
| NAT Gateway | aws:res-amazon-vpc-nat-gateway |
| Region (group) | aws:region |
The two prefixes you will see most are arch- (architectural product icons used at the service level) and res- (resource icons used for sub-components like gateways, endpoints, and access points). When in doubt, pick the arch- variant for top-level services and the res- variant for plumbing inside a VPC.
How do you connect AWS services with edges and ports?
Mermaid architecture-beta uses port-anchored edges. Each edge specifies which side of the source node the line leaves and which side of the target node it enters. Ports are single letters: L (left), R (right), T (top), B (bottom).
igw:T <--> R:ec2_publicThat line says: connect the Internet Gateway from its top port to the EC2 instance on its right port. Port choice controls layout — pick L/R for horizontal flows (request paths) and T/B for vertical ones (data flowing into storage). Avoid mixing the same source port twice; the renderer will overlap the lines.
Can you draw multi-AZ or multi-region diagrams in Mermaid?
Yes. Groups nest arbitrarily, so a multi-AZ layout is just two subnet groups inside the same VPC, each containing their own services.
architecture-beta
group region(aws:region)[us-east-1]
group vpc(aws:virtual-private-cloud-vpc)[VPC] in region
group az1(aws:public-subnet)[AZ a · Public] in vpc
service ec2a(aws:ec2-instance-contents)[Web a] in az1
group az2(aws:public-subnet)[AZ b · Public] in vpc
service ec2b(aws:ec2-instance-contents)[Web b] in az2For multi-region, declare two separate region groups at the top level and put a peering or replication line between the inner resources.
How does Mermaid for AWS compare to draw.io, Lucidchart, and Cloudcraft?
Each tool optimises for a different workflow. Mermaid wins when diagrams need to live inside markdown, version control, or documentation pipelines. The GUI tools win when stakeholders want to drag-and-drop in a browser. Here is the honest comparison.
| Capability | Mermaid + LatixEngine | draw.io | Lucidchart | Cloudcraft |
|---|---|---|---|---|
| Text-based source | Yes | XML | No | No |
| Diffs cleanly in git | Yes | Partial | No | No |
| Renders in GitHub PRs | Partial (SVG export) | No | No | No |
| Free | Yes | Yes | Freemium | Freemium |
| Native AWS icons | 856 | Bundled | Bundled | AWS-only |
| Login required | No | No | Yes | Yes |
| 3D isometric view | No | No | No | Yes |
| Best for | Docs, READMEs, ADRs | Anything visual | Teams, shared canvases | AWS cost and 3D |
If your diagrams live next to code in a README, a Markdown ADR, or a Notion page, the markdown-native flow wins on every long-running maintenance metric. If your diagrams live in a slide deck for executives, a GUI tool will be faster.
Can you export the Mermaid AWS diagram to SVG, PNG, or markdown?
Yes. LatixEngine exports three formats directly from the editor toolbar:
- SVG — vector format, scales for prints and high-DPI displays, embed in static documentation.
- PNG — raster format, paste into Slack, Notion, Confluence, or any tool that does not parse SVG.
- Markdown — the raw mermaid code fence, drop into a README or wiki where Mermaid rendering is supported.
For documentation that lives in GitHub, the safest path today is SVG export and commit the SVG alongside the .mmd source. That way the diagram renders identically everywhere, and the source is still diffable.
What if my Mermaid renderer does not have the AWS icon pack?
Three options, ranked by effort:
- Use the LatixEngine editor directly at latixengine.com/editor and export SVG or PNG when you need to embed the diagram somewhere.
- Self-host the icons. Fetch the catalog at latixengine.com/icons.json, then register the pack with Mermaid's mermaid.registerIconPacks API during initialization.
- Fall back to the generic Mermaid icons (cloud, server, database) and treat the diagram as schematic. Loss of fidelity, but works in any vanilla Mermaid renderer.
Frequently asked questions
Is LatixEngine free to use for AWS diagrams?
Yes. LatixEngine is free with no login and no usage limits. There is no paid tier today; a paid tier is planned for advanced features only, with the core editor remaining free.
Do I need to install anything to draw AWS diagrams in Mermaid?
No. LatixEngine runs entirely in the browser. There is no CLI, no build step, and no account.
How many AWS icons does LatixEngine support?
856 AWS icons covering both architectural product icons (the arch- prefix used for top-level services) and resource icons (the res- prefix used for gateways, endpoints, and sub-components).
Does this also work for Azure and GCP diagrams?
Yes. The exact same architecture-beta syntax works with azure: and gcp: slugs. Azure has 626 icons and GCP has 216, for 1698 cloud icons across the three providers.
Will GitHub render Mermaid AWS architecture-beta diagrams in a README?
Not reliably yet. GitHub renders Mermaid flowchart and sequenceDiagram natively, but architecture-beta with custom icon packs is still inconsistent across renderers. The recommended workflow today is to author in LatixEngine, export to SVG, and commit the SVG alongside the .mmd source.
Can I use a custom AWS icon that is not in the catalog?
Not in the current version. Custom icon support via SVG upload or URL reference is on the public roadmap at latixengine.com/roadmap.
Paste any example in this post into the LatixEngine editor and see it render with native AWS icons. No login, no install.
Open the editor →