What is Amazon ECS?

Amazon ECS is a fully managed container orchestration service for running Docker containers on AWS.

Amazon Elastic Container Service (ECS) is a fully managed service that runs and scales Docker containers on AWS. You package your app into a container image, tell ECS how many copies to run, and ECS keeps them healthy for you.

Why use ECS?

  • No orchestration software to install or operate.
  • Deep integration with AWS: IAM, VPC, CloudWatch, load balancers, and ECR.
  • Two ways to run: Fargate (serverless) or EC2 (your own instances).

Think of ECS as the scheduler: you describe what to run, and ECS decides where and how to keep it running.

Example

Example · bash
# Check that the AWS CLI can reach ECS in your account
aws ecs list-clusters --region us-east-1

When to use it

  • A SaaS company runs its microservices as Docker containers on ECS to avoid managing Kubernetes control planes.
  • A media platform uses ECS to orchestrate video-transcoding containers that spin up on demand and stop when done.
  • An e-commerce site deploys its checkout API as ECS services so AWS handles container restarts and health checks automatically.

More examples

Describe an ECS Cluster

Retrieves the name, status, and running task count for an existing ECS cluster using the AWS CLI.

Example · bash
aws ecs describe-clusters \
  --clusters my-cluster \
  --query 'clusters[0].{name:clusterName,status:status,tasks:runningTasksCount}'

List Running Tasks in a Cluster

Shows all task ARNs currently in the RUNNING state inside the specified cluster.

Example · bash
aws ecs list-tasks \
  --cluster my-cluster \
  --desired-status RUNNING \
  --output table

Create a Minimal ECS Cluster

Creates a new ECS cluster backed by Fargate and Fargate Spot with Fargate as the default capacity provider.

Example · bash
aws ecs create-cluster \
  --cluster-name demo-cluster \
  --capacity-providers FARGATE FARGATE_SPOT \
  --default-capacity-provider-strategy \
      capacityProvider=FARGATE,weight=1

Discussion

  • Be the first to comment on this lesson.