---
description: "Network topology, infrastructure architecture, and software system mapping in draw.io with cloud, on-prem, and hybrid layouts"
triggers:
- network diagram
- infrastructure diagram
- software architecture
- topology
- cloud architecture
- aws diagram
- azure diagram
- gcp diagram
- on-prem
- hybrid cloud
- load balancer
- firewall
- vpc
- subnet
globs:
- "**/*.drawio"
- "**/*.drawio.svg"
---
# Network & Software Architecture Mapping
## Diagram Type Selection
| Need | Diagram Type | Shape Library |
|------|-------------|---------------|
| Physical network layout | Network Topology | `mxgraph.network` |
| Cloud infrastructure (AWS) | AWS Architecture | `mxgraph.aws4` |
| Cloud infrastructure (Azure) | Azure Architecture | `mxgraph.azure` |
| Cloud infrastructure (GCP) | GCP Architecture | `mxgraph.gcp2` |
| Kubernetes cluster layout | K8s Diagram | `mxgraph.kubernetes` |
| Microservice communication | Service Map | General + custom |
| CI/CD pipeline | Pipeline Diagram | Flowchart + custom |
| On-prem data center | Rack Diagram | `mxgraph.rack` |
| Security zones / DMZ | Zone Diagram | Swimlanes + shapes |
| Hybrid cloud | Multi-cloud | Combined libraries |
---
## Shape Libraries
### Enabling Cloud Libraries
In draw.io: **File > Open Library From > Search** or enable from the left panel.
| Library | Prefix | Key Shapes |
|---------|--------|-----------|
| AWS 4 | `mxgraph.aws4` | EC2, S3, RDS, Lambda, VPC, ALB, CloudFront, Route53, ECS, EKS |
| Azure | `mxgraph.azure` | VM, App Service, SQL DB, Functions, AKS, Front Door, Key Vault |
| GCP | `mxgraph.gcp2` | Compute Engine, GKE, Cloud Run, BigQuery, Cloud SQL, Pub/Sub |
| Kubernetes | `mxgraph.kubernetes` | Pod, Service, Deployment, Ingress, ConfigMap, PVC, Node |
| Network | `mxgraph.network` | Router, switch, firewall, server, desktop, cloud, database |
| Cisco | `mxgraph.cisco19` | Cisco-specific network hardware icons |
| Rack | `mxgraph.rack` | Server rack, UPS, patch panel, switch unit |
---
## Network Topology
### Basic LAN/WAN Topology
```xml
```
---
## AWS Architecture
### Three-Tier Web Application
```xml
```
### AWS Style Guide
| Service Category | Icon Fill | Examples |
|-----------------|-----------|----------|
| Compute | `#ED7100` (orange) | EC2, Lambda, ECS, Fargate |
| Storage | `#3F8624` (green) | S3, EBS, EFS |
| Database | `#C925D1` (purple) | RDS, DynamoDB, ElastiCache |
| Networking | `#8C4FFF` (violet) | VPC, ALB, CloudFront, Route53 |
| Security | `#DD344C` (red) | IAM, WAF, Shield, KMS |
| Management | `#E7157B` (pink) | CloudWatch, CloudTrail, Config |
---
## Azure Architecture
### Key Azure Shapes
```
App Service: shape=mxgraph.azure.app_service;
AKS: shape=mxgraph.azure.kubernetes_services;
SQL Database: shape=mxgraph.azure.azure_sql_database;
Functions: shape=mxgraph.azure.function_apps;
Front Door: shape=mxgraph.azure.front_doors;
Key Vault: shape=mxgraph.azure.key_vaults;
Storage: shape=mxgraph.azure.storage;
Cosmos DB: shape=mxgraph.azure.azure_cosmos_db;
VNET: shape=mxgraph.azure.virtual_networks;
```
### Azure Resource Group Pattern
```xml
```
---
## GCP Architecture
### Key GCP Shapes
```
Compute Engine: shape=mxgraph.gcp2.compute_engine;
GKE: shape=mxgraph.gcp2.google_kubernetes_engine;
Cloud Run: shape=mxgraph.gcp2.cloud_run;
Cloud SQL: shape=mxgraph.gcp2.cloud_sql;
BigQuery: shape=mxgraph.gcp2.bigquery;
Pub/Sub: shape=mxgraph.gcp2.cloud_pubsub;
Cloud Storage: shape=mxgraph.gcp2.cloud_storage;
Cloud Functions: shape=mxgraph.gcp2.cloud_functions;
```
---
## Kubernetes Cluster Diagrams
### K8s Deployment Topology
```xml
```
---
## Microservice Architecture
### Service Mesh Pattern
```xml
```
---
## Zone / Security Diagrams
### DMZ Architecture
Use nested containers to represent security zones:
```xml
```
### Zone Color Convention
| Zone | Fill | Stroke | Trust Level |
|------|------|--------|-------------|
| External | `#FFEBEE` | `#B85450` (red) | Untrusted |
| DMZ | `#FFF3E0` | `#D6B656` (amber) | Semi-trusted |
| Internal | `#E8F5E9` | `#82B366` (green) | Trusted |
| Management | `#E3F2FD` | `#6C8EBF` (blue) | Admin only |
---
## Connection Style Guide
| Connection Type | Style | Use |
|----------------|-------|-----|
| Synchronous (HTTP/gRPC) | `strokeColor=#666;strokeWidth=2;endArrow=block;endFill=1;` | Request/response |
| Asynchronous (events) | `strokeColor=#D6B656;strokeWidth=1;dashed=1;endArrow=open;` | Pub/sub, message queues |
| Database access | `strokeColor=#B85450;strokeWidth=1;endArrow=diamond;endFill=0;` | Read/write to DB |
| Monitoring / logs | `strokeColor=#999;strokeWidth=1;dashed=1;dashPattern=4 4;endArrow=open;` | Observability |
| Bidirectional | `strokeColor=#666;strokeWidth=1;endArrow=block;startArrow=block;endFill=1;startFill=1;` | WebSocket, streaming |
---
## Layout Best Practices
1. **Flow direction** — Traffic flows top-to-bottom (internet at top, databases at bottom) or left-to-right
2. **Group by zone** — Use dashed containers for VPCs, subnets, namespaces, security zones
3. **Color by function** — Compute (blue), storage (green), database (yellow/red), network (purple)
4. **Label protocols** — Add edge labels: `HTTPS`, `gRPC`, `AMQP`, `TCP/5432`
5. **Show redundancy** — Use grouped icons or `(3x)` labels for replicated components
6. **Add a legend** — Include a box in the corner explaining colors, line styles, and icon meanings
7. **Use layers** — Separate physical, logical, and security views into draw.io layers