Babysitter generating-aws-diagrams
Generates DrawIO XML diagrams for Amazon Web Services architectures from text descriptions or images. Analyzes existing .drawio files to extract AWS components. Use for AWS architecture diagrams, cloud infrastructure documentation, or when converting AWS diagram images to editable DrawIO format.
git clone https://github.com/a5c-ai/babysitter
T=$(mktemp -d) && git clone --depth=1 https://github.com/a5c-ai/babysitter "$T" && mkdir -p ~/.claude/skills && cp -r "$T/library/specializations/devops-sre-platform/skills/generating-aws-diagrams" ~/.claude/skills/a5c-ai-babysitter-generating-aws-diagrams && rm -rf "$T"
library/specializations/devops-sre-platform/skills/generating-aws-diagrams/SKILL.mdAWS DrawIO Diagram Generator
Generates professional DrawIO XML diagrams for Amazon Web Services architectures.
Capabilities
- Extract - Analyze existing DrawIO XML files to identify AWS shapes, connections, and structure
- Identify - Recognize AWS service icons from architecture diagram images
- Generate - Create valid DrawIO XML from images or text descriptions
- Convert - Transform AWS architecture diagrams into editable DrawIO format
Quick Reference
AWS Shape Patterns
There are two icon types. Use service icons when labeling the AWS service itself, and instance icons when representing a specific resource.
Service icon (colored square background) — for labeling the service:
shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.{shape_name}
Instance icon (bare icon, no background) — for specific resources:
shape=mxgraph.aws4.{shape_name};fillColor={category_color}
CRITICAL: Always keep
set to the category color. Without it the icon renders white/invisible. The only difference from a service icon is the absence of thefillColorbackground square — never removeresourceIconwhen using an instance icon.fillColor
| Scenario | Icon Type | Label Example |
|---|---|---|
| The AWS service itself | Service (with background) | "AWS Lambda", "Amazon RDS" |
| A specific resource/instance | Instance (no background) | "Order Processor", "Users Table" |
| Multiple instances of same service | Instance (no background) | "ECS Task 1", "ECS Task 2" |
CRITICAL: Underscore-Separated Names
Multi-word AWS shape names use UNDERSCORES in style properties!
(correct)step_functions
(correct)api_gateway
(correct)kinesis_data_streams
(WRONG - will not render)step functions
(WRONG - will not render)api gateway
The aws4.xml stencil defines names with spaces, but DrawIO's style parser requires underscores.
Always look up exact names in
before using.assets/aws-icons.json
Common AWS Services
| Service | Service Icon (with background) | Instance Icon (no background) |
|---|---|---|
| Lambda | | |
| Amazon S3 | | |
| Amazon EC2 | | |
| DynamoDB | | |
| API Gateway | | |
| Amazon SQS | | |
| Amazon SNS | | |
| Step Functions | | |
| Amazon ECS | | |
| Amazon RDS | | |
AWS Container Types
| Container | Use Case |
|---|---|
| aws_cloud | Top-level AWS Cloud boundary |
| aws_region | Region grouping |
| aws_availability_zone | AZ grouping |
| aws_vpc | VPC boundary |
| aws_public_subnet | Public subnet |
| aws_private_subnet | Private subnet |
| aws_security_group | Security group boundary |
| aws_auto_scaling_group | Auto scaling group |
| aws_account | AWS Account boundary |
| aws_corporate_datacenter | Corporate datacenter |
| aws_generic_group | Generic grouping |
| aws_step_functions_workflow | Step Functions workflow |
| aws_elastic_beanstalk_container | Elastic Beanstalk app |
Task 1: Analyze a DrawIO File
Use this workflow to extract and document all components from an existing DrawIO file.
Steps
- Read the file - Load the
XML file.drawio - Parse structure - Extract all
elements<mxCell> - Identify shapes - Find cells with
vertex="1" - Identify connections - Find cells with
edge="1" - Extract styles - Parse style strings for each element
- Map hierarchy - Build container/child relationships using
attributeparent - Generate report - Output findings in structured format
Input
- Path to
file.drawio
Output
Generate a Markdown report with:
# DrawIO Analysis Report ## Summary - Total shapes: X - Total connections: Y - Containers: Z ## Shape Inventory | ID | Label | Type | Position | Parent | |----|-------|------|----------|--------| | abc | Lambda | mxgraph.aws4.lambda | (100,200) | vpc1 | ## Connection Matrix | From | To | Label | Type | |------|-----|-------|------| | Lambda | DynamoDB | API | solid | ## Container Hierarchy - VPC (vpc1) - Lambda (lambda1) - Lambda (lambda2) - DynamoDB (db1) ## Style Analysis ### Unique Shapes Found - mxgraph.aws4.lambda (4 instances) - mxgraph.aws4.dynamodb (2 instances)
Task 2: Convert Image to DrawIO
Use this workflow to recreate an AWS architecture diagram from an image.
Steps
-
Analyze image - Identify all visual elements:
- AWS service icons (shape, color, label)
- Containers/boundaries (color, border style)
- Connections (solid, dashed, arrows)
- Labels and text
-
Map to library - For each identified element:
- Look up in
by visual signature or labelassets/aws-icons.json - Match containers to
assets/aws-containers.json - CRITICAL: Verify underscore-separated names for multi-word services (e.g.,
, notstep_functions
)step functions - Note any unrecognized elements
- Look up in
-
Estimate layout - Determine positions:
- Identify container boundaries first
- Place icons within containers
- Estimate x,y coordinates and dimensions
- Standard icon size: 64x64 pixels
-
Generate XML - Build the DrawIO structure:
- Start with base template from
assets/templates/drawio-base.xml - Add containers first (they become parents)
- Add service icons with correct parent references
- Add connections between shapes
- Start with base template from
-
Create confidence report - Document accuracy:
- List all identified components
- Note any uncertain matches
- Flag potential issues
Input
- AWS architecture diagram image (PNG/JPG)
Output
- Valid
XML file.drawio - Confidence report (Markdown)
Confidence Report Format
# Conversion Confidence Report ## Overall Confidence: 85% ## Identified Components ### High Confidence (>90%) - Lambda x4 - Clear icon match - DynamoDB x2 - Clear icon match - VPC container - Purple border, correct label ### Medium Confidence (70-90%) - Step Functions - Icon similar, label confirms (using `step_functions` with underscores) ### Low Confidence (<70%) - Unknown icon at position (300, 400) - Mapped to generic service ## Connection Accuracy - 12/14 connections clearly visible - 2 connections inferred from layout ## Notes - VPC subnet grouping identified - Bidirectional arrows on 3 connections
Task 3: Create DrawIO from Description
Use this workflow to generate a new AWS diagram from text specifications.
Steps
-
Parse requirements - Extract from description:
- Required AWS services
- Container/grouping needs
- Connection requirements
- Layout preferences
-
Select components - From libraries:
- Look up services in
assets/aws-icons.json - Choose containers from
assets/aws-containers.json - Choose icon type: Use service icons (with background) for generic service labels, instance icons (no background) for specific resources (see Quick Reference)
- VERIFY: Underscore-separated names for multi-word services in style strings
- Select connection styles
- Look up services in
-
Plan layout - Design the arrangement:
- Determine canvas size
- Position containers first
- Arrange services logically (left-to-right data flow, top-to-bottom hierarchy)
- Standard spacing: 120px between 64x64 icons
-
Generate XML - Build the diagram:
- Use
as starting pointassets/templates/drawio-base.xml - Add elements in order: containers, services, connections
- Assign unique IDs to all elements
- Use
-
Validate - Check the output:
- All requested components present
- Connections reference valid IDs
- Layout is logical and readable
Input
- Text description of desired AWS architecture
Output
- Valid
XML file.drawio
Example Input
Create an AWS serverless architecture with: - VPC container - API Gateway triggering Lambda - Lambda connecting to DynamoDB and S3 - Step Functions orchestrating the workflow
Example Output Structure
<mxfile ...> <diagram name="AWS Architecture"> <mxGraphModel ...> <root> <mxCell id="0" /> <mxCell id="1" parent="0" /> <!-- VPC Container --> <mxCell id="vpc" value="VPC" style="..." vertex="1" parent="1"> <mxGeometry x="50" y="50" width="700" height="400" /> </mxCell> <!-- API Gateway --> <mxCell id="api_gateway" value="API Gateway" style="...resIcon=mxgraph.aws4.api_gateway" vertex="1" parent="vpc"> <mxGeometry x="50" y="100" width="64" height="64" /> </mxCell> <!-- More shapes... --> <!-- Connections --> <mxCell id="conn_api_gateway_to_lambda" edge="1" source="api_gateway" target="lambda" style="..." /> </root> </mxGraphModel> </diagram> </mxfile>
Shape Library Reference
Looking Up an AWS Service
- Open
assets/aws-icons.json - Search by
orservice_namerecognition_keywords - Use the
for complete stylingdrawio_shape.full_style - Or construct style using:
shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.{shape_name}
Service Coverage:
- 264 AWS services across 24 categories
- 96.6% validated against mxgraph.aws4 library (255/264 services)
- 9 unvalidated services (deprecated or newer than aws4.xml stencil) — see
for the list. For these, use a visually similar validated service icon or a generic shape.references/ICON-COMPATIBILITY.md
Key AWS Specifications
- Icon size: 64x64 pixels
- Font color: #232F3E universally (dark gray)
- Fill color varies by category (not per-service)
- Arrow style: open arrow, 2pt stroke,
#232F3E
Look up the exact
category, fillColor, and full_style for any service in assets/aws-icons.json. All 24 categories with colors are listed there.
Visual Best Practices
See references/DIAGRAM-BEST-PRACTICES.md for full guidelines. Key rules:
- Connection labels — always add:
labelBackgroundColor=#FFFFFF;fontSize=10;fontColor=#232F3E; - strokeWidth — use
for most connections,1
only for primary data paths (max 1–3 per diagram)2 - Consolidate connections when 3+ cross the same corridor into a single labeled edge
XML Structure Quick Reference
For complete XML examples and detailed structure, see references/xml-examples.md.
The key building blocks:
- Shape:
with<mxCell id="api_gateway" value="Label" style="..." vertex="1" parent="1"><mxGeometry> - Connection:
<mxCell id="conn_api_gateway_to_lambda" edge="1" source="api_gateway" target="lambda" style="..."> - Container: Shape with
in style; children setcontainer=1
to container IDparent - Root cells: Every diagram needs
and<mxCell id="0"/><mxCell id="1" parent="0"/>
ID Naming Rules
- Full service names —
, notapi_gateway
;apigw
, notstep_functionsstepfn - Role suffixes for duplicates —
,lambda_api_handler
, notlambda_processor
,lambda1lambda2 - Connection IDs —
using full IDsconn_{source}_to_{target}
See references/DIAGRAM-BEST-PRACTICES.md for complete ID naming convention.
For XML parsing and extraction techniques, see references/xml-parser-guide.md.
Troubleshooting
Icon Not Displaying
- CRITICAL: Verify multi-word shape names use UNDERSCORES:
, NOTstep_functionsstep functions - For service icons: verify both
ANDshape=mxgraph.aws4.resourceIcon
are presentresIcon=mxgraph.aws4.{name} - For instance icons: verify
is used directly (noshape=mxgraph.aws4.{name}
wrapper)resourceIcon - NEVER use
/productIcon
— always useprIcon
/resourceIcon
for service iconsresIcon - Check assets/aws-icons.json for exact shape name
- Ensure
is presentvertex="1" - Check that
has valid width/height (64x64)<mxGeometry>
Wrong Icon Type (Background vs No Background)
See the Quick Reference section for the full definition of each icon type. In summary:
- Service icon:
— labels the AWS service itselfshape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.{name} - Instance icon:
— represents a specific resource;shape=mxgraph.aws4.{name};fillColor={category_color}
is required or the icon renders whitefillColor
Connection Not Rendering
- Verify source and target IDs exist
- Ensure
is setedge="1" - Check that source/target shapes are vertices
Shapes Not Inside Container
- Set child's
attribute to container's IDparent - Ensure container has
in stylecontainer=1 - Position child coordinates relative to container (not absolute)
Label Not Showing
- Check
attribute is setvalue - Verify
is reasonable (12-14 for AWS)fontSize - Ensure
is setfontColor=#232F3E
File Won't Open in DrawIO
- Validate XML structure (proper closing tags)
- Ensure
andid="0"
root cells existid="1" - Check for special characters in labels (use
for newlines)

Desktop Integration
After generating a
.drawio file, you can validate and preview it:
- Validate:
python scripts/validate-drawio.py output.drawio --verbose - Analyze:
python scripts/analyze-existing.py output.drawio --markdown - Validate Icons:
python scripts/validate-aws-icons.py - Export PNG:
./scripts/export-diagram.sh output.drawio png - Open in DrawIO:
./scripts/open-diagram.sh output.drawio
Requires DrawIO Desktop. Install on macOS:
brew install drawio
Files in This Skill
| File | Purpose |
|---|---|
| This file - main instructions |
| Assets | |
| AWS service icon database (264 services) |
| AWS container/group and connection styles |
| Base XML template |
| Shape insertion template |
| Connection template |
| References | |
| Icon validation reference (255/264 validated) |
| Visual design and layout guidelines |
| Detailed XML parsing reference |
| Copy-paste XML examples |
| Positioning and layout guide |
| Style string reference |
| Scripts | |
| Validate .drawio XML structure |
| Validate AWS icon compatibility |
| Auto-fix icon shape names |
| Bulk fix icon references in .drawio files |
| Extract available shapes from DrawIO stencil |
| Extract shapes/connections from .drawio files |
| Export to PNG/PDF via DrawIO Desktop CLI |
| Open .drawio file in DrawIO Desktop |