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.

AWS ECS Fargate architecture diagram: ALB in a public subnet routes to an ECS service on Fargate that reads RDS in a private subnetAWS ECS Fargate architecture diagram: ALB in a public subnet routes to an ECS service on Fargate that reads RDS in a private 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]-> db

Open this diagram in the playground

ECS with Redis cache and RDS.

Add ElastiCache beside the service for session or query caching.

AWS ECS architecture diagram: ALB routes to ECS which caches in ElastiCache and reads RDSAWS ECS architecture diagram: ALB routes to ECS which caches in ElastiCache and reads RDS
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]-> db

Open this diagram in the playground

Pattern notes for Amazon ECS.

Placement and relationship rules ArchLex enforces for this service.

Ask an agent to draw it.

Install the ArchLex skill or connect the free MCP server, then paste this prompt.

Agent skill install
npx skills add baires/archlex
Draw 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.

Browse all examples

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

Diagram Amazon ECS as code.