Reference
Examples and Use Cases
Representative DAC patterns for serverless, networking, application, and AI-driven workflows.
Common patterns
| Pattern | Best fit |
|---|---|
| Single resource | S3 bucket, Lambda, or DynamoDB reference diagram |
| Network topology | VPC, subnets, ALB, NAT, IGW, and service placement |
| Application platform | ECS or Lambda services with data and messaging layers |
| Multi-region | Replicated services or failover topology |
| AI-generated diagram | Human prompt -> MCP -> DAC YAML -> PNG or draw.io |
Serverless worker pipeline
yaml
Diagram:
DefinitionFiles:
- Type: URL
Url: "https://raw.githubusercontent.com/fernandofatech/diagram-as-code/main/definitions/definition-for-aws-icons-light.yaml"
Resources:
Canvas:
Type: AWS::Diagram::Canvas
Children: [Cloud]
Cloud:
Type: AWS::Diagram::Cloud
Preset: AWSCloudNoLogo
Children: [App, Queue, Worker]
App:
Type: AWS::Lambda::Function
Title: API Lambda
Queue:
Type: AWS::SQS::Queue
Worker:
Type: AWS::Lambda::Function
Title: Worker Lambda
Links:
- Source: App
Target: Queue
TargetArrowHead:
Type: Open
- Source: Queue
Target: Worker
TargetArrowHead:
Type: OpenFrontend + API + data stack
yaml
Diagram:
DefinitionFiles:
- Type: URL
Url: "https://raw.githubusercontent.com/fernandofatech/diagram-as-code/main/definitions/definition-for-aws-icons-light.yaml"
Resources:
Canvas:
Type: AWS::Diagram::Canvas
Direction: vertical
Children: [Users, Cloud]
Users:
Type: AWS::Diagram::HorizontalStack
Children: [Web, Mobile]
Web:
Type: AWS::Diagram::Resource
Preset: User
Title: Web User
Mobile:
Type: AWS::Diagram::Resource
Preset: Mobile client
Cloud:
Type: AWS::Diagram::Cloud
Preset: AWSCloudNoLogo
Direction: vertical
Children: [Api, Data]
Api:
Type: AWS::Diagram::HorizontalStack
Children: [Gateway, Service]
Gateway:
Type: AWS::ApiGateway
Title: Public API
Service:
Type: AWS::Lambda::Function
Title: Orders Service
Data:
Type: AWS::Diagram::HorizontalStack
Children: [Redis, Database]
Redis:
Type: AWS::ElastiCache::CacheCluster
Database:
Type: AWS::RDS::DBCluster
Links:
- Source: Web
Target: Gateway
TargetArrowHead:
Type: Open
- Source: Mobile
Target: Gateway
TargetArrowHead:
Type: Open
- Source: Gateway
Target: Service
TargetArrowHead:
Type: Open
- Source: Service
Target: Redis
TargetArrowHead:
Type: Open
- Source: Service
Target: Database
TargetArrowHead:
Type: Open