Skip to content

Ecs

Basics

  • ECS is a service that accepts containers & additional configurations to define where and how to run containers
  • Its managed container based compute service
  • ECS runs in either EC2 mode or Fargate mode
  • ECS runs containers in clusters
  • Images are stored in a container regists like DockerHub or ECR
  • Container Definition - Where container is, which port it runs on
  • Task - Is a self contained application. It could have one or more containers in it
  • Task Definition - Resources like CPU , memory used by Task , networking mode, EC2 or Fargate, Task Role i.e. IAM Role task can assume
  • For easy understanding Container Definition is like a Dockerfile while Taks Definition is like DockerCompose file
  • ECS Service - How a task is scaled, how many copies of a task can run
  • Tasks or Services are deployed in a ECS Cluster

Cluster Modes

  • Cluster performs tasks like scheduling, orchestration, cluster management & placement engine that decides where to run containers

EC2 Mode

  • Cluser is created within a VPC
  • EC2 instances are used to run containers
  • ECS provision EC2 instances but user has to manage them
  • Number of Container Hosts (i.e. EC2) are defined in ASG configuration

Fargate Mode

  • No management of EC2 or Container hosts
  • AWS manages a Fargate Shared Infrastructure
  • Fargate also runs instances inside VPC
  • The tasks are injected from Shared Farget Infra into VPC & is given an ENI that has IP address from the VPC