Amazon Elastic Container Service

Learn how to deploy and manage containerized applications using Amazon Elastic Container Service (ECS).

Amazon Elastic Container Service (ECS) is a fully managed container orchestration service provided by AWS. It simplifies the deployment and management of containerized applications, allowing us to run Docker containers at scale. ECS integrates seamlessly with other AWS services, providing a flexible and efficient solution for deploying and managing containerized workloads.

Press + to interact

How ECS works

ECS builds and deploys scalable containerized applications on AWS without managing servers. Its architecture is divided into three functional layers: provisioning, controller, and capacity management.

Provisioning

Provisioning consists of the tools used as an interface to manage and deploy our containers and applications in ECS. There are five provisioning tools we can use to deploy and manage ECS operations:

  • AWS Command Line Interface (CLI)

  • AWS Software Development Kit (SDK)

  • AWS Cloud Developer Kit (CDK)

  • AWS Copilot

  • AWS Management Console

Capacity

The capacity layer provides the compute infrastructure where containers run. ECS supports three types of compute environments:

  • Amazon EC2: It is used for VM-based, user-managed capacity.

  • AWS FargateAWS Fargate is a compute engine that enables us to run containers without managing the underlying EC2 instances. It does away with infrastructure management and provides a serverless experience for running our containers.: It is used for serverless container execution.

  • On-premises servers: It is used for running workloads via ECS Anywhere.

These resources are organized into an ECS cluster, a logical grouping of capacity used by the controller to place and run tasks. A cluster doesn’t provide compute itself, but it defines the scope within which ECS can manage resources. We can configure a cluster to use one or more capacity types (like EC2 and Fargate in the same cluster).

When using EC2 instances, each instance runs the ECS agent, a lightweight process that does the following:

  • It registers the instance with the cluster.

  • It starts and stops containers based on instructions from the ECS control plane.

  • It reports container and instance status back to ECS.

The ECS agent is preinstalled on ECS-optimized AMIs but can also be installed manually on compatible Linux distributions. For Fargate, the agent is abstracted away. AWS manages the underlying infrastructure and container lifecycle for Fargate.

Controller

The controller layer is responsible for orchestrating tasks and services. It uses definitions and configuration provided by the developer to schedule, launch, and monitor containers.

At the core of this layer is the ...