Amazon Elastic Container Service (ECS)

Amazon Elastic Container Service (ECS) is a regional, Docker-supported Amazon Web Services service that lets users run, stop, and manage Docker containers on a cluster, scaling containers across a group of instances.

AI Practitioner focus

  • ECS can run containerized custom inference, data processing, or agent components when a team needs more runtime control than a managed AI API provides.
  • Choose Fargate for serverless container capacity or EC2 capacity for host-level control; the customer still owns the container image, model/application security, scaling choices, and observability.

Key points

  • An ECS cluster is a combination of tasks or services executed on Amazon EC2 instances, AWS Fargate, or (via ECS Anywhere) external on-premises servers and VMs.
  • Task definition — a JSON blueprint for one or more containers, specifying the container image(s), CPU/memory allocation, networking mode, and IAM task role, among other settings.
  • Task — a running instantiation of a task definition; the actual container(s) launched on EC2, Fargate, or External capacity.
  • Service — maintains a specified desired count of tasks running at all times, restarting tasks that fail or stop, and can register its tasks with a load balancer.
  • Distinct from Amazon Elastic Kubernetes Service (EKS): ECS is an AWS-proprietary container orchestrator with a simpler, AWS-only API, while EKS is managed Kubernetes with a portable, open-source API and a steeper learning curve; both support EC2 and Fargate launch types.
  • Capacity is configured through launch types (EC2, Fargate, External) or through capacity providers, which are the recommended abstraction: the built-in FARGATE and FARGATE_SPOT providers for serverless capacity, and Auto Scaling group-backed capacity providers for self-managed EC2. A capacity provider strategy can combine up to 20 capacity providers, mixing baseline EC2/Fargate capacity with Fargate Spot for burst.
  • Amazon ECS Managed Instances (added September 2025) is a newer capacity option between EC2 and Fargate: AWS provisions, patches, and scales EC2 instances on Bottlerocket for your tasks while you keep access to EC2 instance-type selection.
  • Can scale ECS clusters using Auto Scaling based on CPU usage and other Auto Scaling rules.
  • Using an Application Load Balancer, ECS enables dynamic port mapping and path-based routing.
  • Provides Multi-AZ support for ECS clusters.
  • Two main use cases:
    • Microservices — an architectural method that decouples complex applications into smaller, independent services.
    • Batch Jobs — short-lived packages executed using containers.
  • Can pull images from repositories within Amazon Elastic Container Registry (ECR) and deploy them within ECS clusters.

Sources