Overview of Elastic Container Service (ECS)

Sep 23, 2024

Elastic Container Service (ECS) Overview

What is ECS?

  • ECS: Managed service to run containers, typically using Docker.
  • Docker: Tool to launch containers, ensuring isolation between container instances.
  • ECS Functionality: Launch, set up, and monitor Docker containers on ECS clusters.

Infrastructure Options for Running Docker Containers

  • Serverless Option (Fargate)
    • Hands-off approach.
    • Easier to use for beginners.
  • Managed Option (EC2 Instances)
    • Requires management of EC2 instances.
    • Involves software upgrades, patches, and security management.

Scalability with ECS

  • Auto Scaling: Handle variable volume based on metrics like traffic, memory, or CPU utilization.
  • Use Cases: Useful for ad hoc jobs or full-scale services needing constant container availability.

Cost Efficiency

  • Multiple Containers on Single Compute Resource: Host multiple Docker tasks on one instance.
  • Reduced Overhead with Docker: Only one operating system needed for multiple containers.

Comparison to Other Options

  • Lambda: Serverless; focus on code without infrastructure concerns.
  • EC2: Needs code deployment and infrastructure management.
  • ECS: Middle ground offering containerization advantages with less infrastructure management than EC2.

How ECS Works from a User Perspective

Setting Up ECS

  • Docker File: Define settings, operating system, dependencies, source code, and startup scripts.
  • Build Docker Image: Upload to Elastic Container Repository (ECR).
    • ECR stores image histories for easy rollback.

Defining Tasks

  • Task: Abstraction over containers; tells ECS how to spin up Docker containers.
    • Can contain multiple containers (e.g., REST API and database separation).
    • Specify resources, port mappings, etc.

Setting Up Clusters

  • Cluster: Abstract resource farm with EC2 instances or Fargate.
  • Launching Tasks: Specify tasks to run on a cluster.

Services and Scalability

  • Service: Suitable for long-running applications, specifying a minimum number of tasks.
    • Monitors containers for health and provides metrics and dashboard tools.
  • Load Balancer: Distributes traffic across containers, ensuring resource availability.

Additional Resources

  • Video walkthroughs available for console setup using Docker files.

For more detailed explanations, additional resources such as video links are provided in the original lecture content.