AWS · Amazon ECS · Diagram as code
AWS ECS / Fargate architecture diagram
Describe container services on ECS, including Fargate launch type, behind an Application Load Balancer. ArchLex checks subnet placement and typed connections to caches and databases.
ALB to ECS on Fargate to RDS.
Public load balancer, private ECS service labeled for Fargate, and a database subnet.
provider aws
direction LR
validation normal
account prod {
region us-east-1 {
vpc main {
subnet public {
lb: alb["Web ALB"]
}
subnet private-app {
api: ecs["API on Fargate"]
}
subnet private-db {
db: rds["PostgreSQL"]
}
}
}
}
lb -[routes]-> api
api -[reads]-> dbECS with Redis cache and RDS.
Add ElastiCache beside the service for session or query caching.
provider aws
direction LR
validation normal
lb: alb["ALB"]
api: ecs["API on Fargate"]
cache: elasticache["Redis"]
db: rds["PostgreSQL"]
lb -[routes]-> api
api -[caches]-> cache
api -[reads]-> dbPattern notes for Amazon ECS.
Placement and relationship rules ArchLex enforces for this service.
- ECS vs Fargate in the catalog. Use ecs for the running service. Label it ["API on Fargate"] when the launch type matters. The separate fargate catalog id is available, but ALB routes and datastore reads are declared against ecs today.
- Placement. ECS tasks that need private networking belong in a subnet inside a VPC. Put the ALB in a public subnet and the service in a private-app subnet so the diagram matches how traffic flows.
- Valid connections. alb -[routes]-> ecs, ecs -[reads]-> rds|dynamodb|s3|elasticache|secrets-manager, ecs -[caches]-> elasticache, and ecs -[writes]-> s3|rds|dynamodb. Wrong endpoints get AWS-RELATIONSHIP-INVALID-ENDPOINT-001.
Ask an agent to draw it.
Install the ArchLex skill or connect the free MCP server, then paste this prompt.
npx skills add baires/archlexDraw an AWS ECS on Fargate architecture diagram with an ALB in a public subnet, the ECS service in a private subnet, and RDS in a database subnet. Validate placement and give me a playground link.Prefer MCP? Follow the MCP server guide.
Related AWS examples.
- Minimal Vertical SliceRDS Proxy, RDS Database, and ECS Service
- Display Labels & Named InstancesInstance names and custom display labels distinguishing primary and replica databases
- Classic 3-Tier Web ArchitectureApplication Load Balancer distributing to ECS container tasks connected to RDS
- Containerized App with In-Memory CacheALB distributing traffic to ECS microservices cached by ElastiCache and backed by RDS
Amazon ECS diagram questions.
How do I show Fargate on an ECS architecture diagram?
Use the ecs resource and set a display label such as ["API on Fargate"]. ArchLex renders the ECS icon and validates ALB routes and datastore edges against ecs.
Does ECS need to be inside a subnet?
For diagrams that show VPC networking, yes—place ecs inside a subnet scope. ArchLex containment rules expect networked compute in the right boundary.
Can I connect ECS to ElastiCache and RDS?
Yes. Use ecs -[caches]-> elasticache and ecs -[reads]-> rds (or -[writes]-> for writes). Those relationship endpoints are declared in the AWS pack.
Is this the same as an EKS diagram?
No. ECS is Amazon's container orchestrator; EKS is managed Kubernetes. Use the EKS service page when you want cluster semantics.
More AWS service diagrams.
Open source · MIT licensed