Thursday, 15 February 2018

AWS ECS

Overview
  • Docker on EC2
  • Alternatives
    • Kubernets (K8s)

Model
  • ECS - cluster management infrastructure
  • Container instance - docker host
    • EC2 instance
    • has ECS agent installed
    • has docker deamon installed
    • runs ECS Tasks
  • Cluster - pool of resources (CPU/memory/networking) partitioned by containers
    • one or more Container instances
    • it can be scaled-up/down as needed (Auto Scaling)
    • spot fleet integration
  • Task
    • See ECS(Task)
  • ECS Event Stream
    • Cluster/Task state changes
    • Uses CloudWatch

AWS Fargate
  • Managed cluster management
  • AWS worries about EC2 resources (cluster)
  • All other ECS gurantees remain in place

ECS (Scheduling engine)
  • Starts a task
  • Based on Blox (open source)
  • Types
    • Services
      • "start it and forget it"
      • long running processes (e.g. "MicroService")
      • behind ELB
      • monitors the one that failed and restarts
    • Batch
      • integrates with Spot Fleet
      • basis for AWS Batch
    • Events
      • Triggered based on CloudWatch Event 
    • Daemon
      • Ensures a task is running on every node in the cluster (e.g. monitoring agent)

ECS (Placement Engine)
  • When instance joins ECS associates metadata (region, instance type, etc.)
  • Selects appropriate container instance capability (cpu, memory, ports)
    • Cluster Constraints (CPU, memory, port)
    • Custom (location, instance type, AMI, custom attributes)
    • Placement Strategies
      • Binpacking
      • Spread (high availability)
      • Affinity (should run together)
        • Anti-affinity (never run together) 
      • Distance instinct (used by Daemon)
    • Placement strategy chaining
      • Spread (Multi-AZ) + Binpack

ECS Agent
  • Runs on Container Instance 
  • Runs in its own Docker container
  • Uses ecs:Poll action to receive commands
  • Coordinates deployments
  • Possible to query its status

ECR
  • EC2 Container Registry
  • Fully managed Docker Container Registry

References
  • http://www.allthingsdistributed.com/2015/07/under-the-hood-of-the-amazon-ec2-container-service.html

No comments:

Post a Comment