Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Operating ECS in production

Operating ECS in production

Michael Wittig

April 12, 2018
Tweet

More Decks by Michael Wittig

Other Decks in Technology

Transcript

  1. Hello! I am Michael Wittig AWS in Action (2nd ed)

    cloudonaut.io AWS Community Hero Independent AWS Consultant Twitter @hellomichibye 2
  2. ECS Cluster 4 ECS Cluster ECS Instance = EC2 Instance

    running ecs-agent ECS optimized AMI ECS Instance ECS Instance
  3. Task Definition 5 ECS Cluster aws ecs run-task \ --count

    2 Task Definition Image ... ECS Task 1..N Container ECS Task 1..N Container
  4. ECS Scheduling 6 ECS Cluster ECS Instance ECS Instance ECS

    Instance ECS Task 1..N Container ECS Task 1..N Container Placement constraints and strategies
  5. ECS Networking ◎ Public/Private Load Balancer ◎ Elastic Network Interface

    (ENI) per task ◦ Public IP ◦ Private IP ◦ Per Task Security Group 7
  6. ECS Service 8 ECS Cluster Task Definition ECS Task ECS

    Task ECS Service ◎ Observer ◎ ENI ◎ Load Balancer ◎ Deployment
  7. Implementing Instance Draining ◎ Auto Scaling Lifecycle hook ◦ Drain

    Instance ◦ Wait until drained ◦ Complete Lifecycle hook 16
  8. Tasks are not rescheduled once places! Your last batch of

    ECS instances will end up with 0 tasks! 17
  9. 20 ECS Cluster Available: CPU 100 Memory 200 Available: CPU

    100 Memory 200 Available: CPU 100 Memory 200 Available: CPU 300 Memory 600 Task CPU 200 Memory 200
  10. Schedulable Containers 1. Define largest possible task (CPU/memory) 2. For

    each instance: a. Calculate how many largest possible tasks would fit b. Report to CloudWatch 3. Scale based on the sum of this metric 21 Credits http://garbe.io/blog/2017/04/12/a-better-solution-to-ecs-autoscaling/
  11. 22 ECS Cluster Available: CPU 100 Memory 200 Schedulable 0

    Available: CPU 100 Memory 200 Schedulable 0 Available: CPU 100 Memory 200 Schedulable 0 Available: CPU 300 Memory 600 Schedulable 0 Largest Task CPU 200 Memory 200
  12. Public load balancing 25 ECS Cluster ECS Instance ECS Instance

    ECS Task 1..N Container ECS Task 1..N Container ECS Task 1..N Container Load Balancer (ALB) ◎ Path based ◎ Host based DNS
  13. Internal load balancing 27 ECS Task Frontend LB (internet-facing) ECS

    Task ECS Task Catalog (internal) ECS Task ECS Task Shopping card (internal) ECS Task ECS Task DNS DNS DNS
  14. Catalog Catalog Internal Route 53 (with per task ENI) 28

    ECS Task Frontend LB (internet-facing) ECS Task ECS Task ECS Task ECS Task ECS Task ECS Task DNS DNS DNS
  15. Credits Special thanks to all the people who made and

    released these awesome resources for free: ◎ Presentation template by SlidesCarnival ◎ Photographs by Pexels 30