Architecture pattern

Run a containerized web application on Amazon ECS and Fargate

Store immutable images in Amazon ECR, deploy tasks with Amazon ECS on AWS Fargate, route HTTP traffic through an Application Load Balancer, and observe the service in CloudWatch.

Official AWS sources reviewed 2026-07-25.

Architecture flow

  1. Store image: A deployment references a versioned container image in ECR.
  2. Schedule and run: ECS maintains the service while Fargate supplies task compute.
  3. Route traffic: An Application Load Balancer forwards requests to healthy task targets.
  4. Observe: Logs, metrics, Container Insights, and alarms show service health.

Text alternative: Amazon ECS deploys a versioned image from Amazon ECR as tasks on AWS Fargate. An Application Load Balancer sends requests to healthy tasks, and Amazon CloudWatch receives logs and operational metrics.

How the services connect

The deployment plane pulls a versioned image from ECR; ECS then replaces and scales tasks on Fargate. Pin immutable image identifiers and separate task execution permissions from application task permissions.

The Application Load Balancer targets task IP addresses when awsvpc networking is used. Coordinate health checks, security groups, deregistration delay, and rolling-deployment capacity.

Send structured container output to CloudWatch Logs and alarm on user-facing signals. Container Insights adds useful detail but also telemetry volume and cost.

Tradeoffs and caveats

  • Retains standard container packaging while removing host fleet operations.
  • Fargate simplifies capacity management but gives less host-level control than ECS on EC2.
  • ALB, Fargate resources, image storage and transfer, and observability are billed separately.

AWS services in this pattern

Primary AWS sources