SlideShare a Scribd company logo
Managed Container Orchestration
with ECS
Philipp Garbe (@pgarbe)
Scout24
Managed Container Orchestration with Amazon ECS
● Philipp Garbe
● Lead Platform Engineer @Scout24
● Docker Captain
● Living in Bavaria
● Working in the Cloud
About Me
Our purpose: Inspiring your best
decisions. We connect people,
cars and homes.
Platform Engineering
Improve the developer experience
With kind permissions of
Alexey Gravanov
Managed Container Orchestration with Amazon ECS
How to run it in production?
So many choices...
Amazon ECS
Docker Swarm
Azure
Container
Services
Cloud Foundry’s
Diego
https://www.linux.com/news/8-open-source-CONTAINER-ORCHESTRATION-TOOLS-KNOW
CoreOS
Fleet
Google Container
Engine
Kubernetes
Mesosphere
Marathon
Amazon ECS
Docker Swarm
Azure
Container
Services
Cloud Foundry’s
Diego
https://www.linux.com/news/8-open-source-CONTAINER-ORCHESTRATION-TOOLS-KNOW
CoreOS
Fleet
Google Container
Engine
Kubernetes
Mesosphere
Marathon
Deep Integration with AWS
● Cluster and Services can be created with CloudFormation
● Tasks have their own IAM role
● Dynamic port mapping with ALB
Easy to maintain
● Cluster state is managed by AWS
Follows our IT principals
β‡’ All orchestration tools can run containers!
Why ECS?
Under the hood
What? It’s not managed?
ECS has no AutoScaling? No automated Node draining?
BUT: We don’t want to run / care about the cluster
Resources:
Service:
Type: 'Custom::InfinityService'
Properties:
ServiceToken: 'arn:aws:lambda:eu-west-1:123456789012:function:angus'
ServiceName: my-service
ImageName: 210987654321.dkr.ecr.eu-west-1.amazonaws.com/awesome-app
ContainerPort: 9000
Make it simple
Infinity & Angus
Infinity
Infinity = Managed ECS Cluster
ECS +
● Automated node draining
● Automated Scaling
● Cross-Account Proxy
● Watchdog Lambda
● Some tweaks
Automated Node Draining
The Problem
ECS offers Node Draining, but ASG is not interested in it
Automated Node Draining
ASG Lifecycle Hook +
SNS + Lambda
Automated Scaling
The Problem
No proper CloudWatch metric to scale out and in
● CPU Utilization
● Memory Utilization
● CPU Reservation
● Memory Reservation
ECS Metrics
New metric: # of schedulable containers
Example
Have enough resources for 1 - 2 of our max containers
Scale out when # of schedulable containers < 1
Scale in when # of schedulable containers > 2
How many schedulable containers?
How many schedulable containers?
How many schedulable containers?
How many schedulable containers?
Cross-Account Proxy
The Problem
TaskRoleArn supports only roles of the same account
Default Roles
ecsAutoScalingRole
ecsContainerInstanceRole
ecsServiceRole
ecsTaskRole
● Read CloudWatch Metrics
● Modify App AutoScaling
● ECR: Get Images
● ECS: De/Register
Container Instances
● De/Register Instances
with Load Balancer
● Everything your task
needs to do
Managed Container Orchestration with Amazon ECS
Managed Container Orchestration with Amazon ECS
● Re-route call to ECS-Agent
● ECS-Agent gets credentials based
on configured TaskRole
● TaskRole needs only one permission:
AssumeRole
● X-Acc-Proxy assumes role
(Role ARN comes from Docker Label)
● X-Acc-Proxy returns credentials
from assumed role
Cross Account Proxy
Managed Container Orchestration with Amazon ECS
WatchDog Lambda
The Problem
Timeout of creating an ECS service which don’t get healthy is 3h!
WatchDog Lambda
Lambda who checks for status codes like
● β€œEssential container in task exited”
● β€œTask failed ELB health checks”
β‡’ Cancels the CloudFormation stack update
● HealthCheck in cfn-init
● β€œVersion” in UserData
● Partitions for images and logs
● Container cleanup ECS_ENGINE_TASK_CLEANUP_WAIT_DURATION
Tweaks
Angus
>500 lines of CloudFormation template
● Load balancer
● Security Groups
● Auto scaling
● Roles
● Alarms
ECS Service and Taskdefinition
Managed Container Orchestration with Amazon ECS
Resources:
Service:
Type: 'Custom::InfinityService'
Properties:
ServiceToken: 'arn:aws:lambda:eu-west-1:123456789012:function:angus'
ServiceName: my-service
ImageName: 210987654321.dkr.ecr.eu-west-1.amazonaws.com/awesome-app
ContainerPort: 9000
Make it simple
● Like AWS Service Catalog but for managed services
● Translator to map properties of a custom resource to CloudFormation
stack parameters
● Handles the whole CloudFormation workflow
● Supports versioned templates
● Allow to roll out template changes to existing stacks
What is Angus?
Angus
Team: stack.yaml
CloudFormation specific
Angus specific
Template specific
Service:
Type: 'Custom::InfinityService'
Properties:
ServiceToken: >
'arn:aws:lambda:eu-west-1:123456789012:function:angus'
ServiceName: my-service
ImageName: nginx
Cpu: 512
Configuration:
- MY_ENV_VAR: my-value
Team: stack.yaml
Service:
Type: 'Custom::InfinityService'
Properties:
ServiceToken: >
'arn:aws:lambda:eu-west-1:123456789012:function:angus'
ServiceName: my-service
ImageName: nginx
Cpu: 512
Configuration:
- MY_ENV_VAR: my-value
Defines service type
(which template should be used)
Defines stack name in
platform account
Arn of Angus lambda
Team: stack.yaml
Service:
Type: 'Custom::InfinityService'
Properties:
ServiceToken: >
'arn:aws:lambda:eu-west-1:123456789012:function:angus'
ServiceName: my-service
ImageName: nginx
Cpu: 512
Configuration:
- MY_ENV_VAR: my-value
Platform: my-service
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
ImageName:
Type: String
Description: Name of the Docker Image
Cpu:
Type: Number
Default: 512
MinValue: 0
MaxValue: 4096
Description: CPU reservation for the task
Configuration1:
Type: String
Description: An item of possible environment variables
Default: ''
Template Versioning
● Allows you to introduce new features (like HealthCheckPath)
● Allows you to apply new features from AWS
Rollout strategies
● Canary releases for existing stacks
● For new stacks
But: Be backwards compatible!
Questions ?
Automated Node Draining:
https://aws.amazon.com/blogs/compute/how-to-automate-container-instance-draining-in-amazon-ecs/
IAM Reference:
https://iam.cloudonaut.io
CloudFormation Hacks:
http://garbe.io/blog/2017/07/17/cloudformation-hacks/
AutoScaling of ECS clusters:
● http://garbe.io/blog/2017/04/12/a-better-solution-to-ecs-autoscaling/
● https://help.spotinst.com/hc/en-us/articles/115004452129-EC2-Container-Service-ECS-Autoscaler
High quality CloudFormation templates
http://templates.cloudonaut.io
Useful resources
www.scout24.com
Philipp Garbe
Twitter: @pgarbe
Blog: garbe.io

More Related Content

PDF
JavaDay Lviv: Serverless Archtiectures
PDF
ECS and ECR deep dive
PDF
DevOps Days Tel Aviv - Serverless Architecture
PDF
Netflix Container Runtime - Titus - for Container Camp 2016
PPTX
Riga dev day: Lambda architecture at AWS
PPTX
Container orchestration overview
PPTX
Container Orchestration with Docker Swarm and Kubernetes
PDF
ApacheCon NA - Apache Camel K: connect your Knative serverless applications w...
JavaDay Lviv: Serverless Archtiectures
ECS and ECR deep dive
DevOps Days Tel Aviv - Serverless Architecture
Netflix Container Runtime - Titus - for Container Camp 2016
Riga dev day: Lambda architecture at AWS
Container orchestration overview
Container Orchestration with Docker Swarm and Kubernetes
ApacheCon NA - Apache Camel K: connect your Knative serverless applications w...

What's hot (8)

PPTX
Netflix0SS Services on Docker
PDF
Kubernetes on AWS
PPTX
Kubernetes @ Nanit by Chen Fisher
PPTX
Webcast - Making kubernetes production ready
PDF
Building Out Your Kafka Developer CDC Ecosystem
PDF
Sf bay area Kubernetes meetup dec8 2016 - deployment models
PDF
Riga DevDays 2017 - Efficient AWS Lambda
PPTX
CI Implementation with Kubernetes at LivePerson by Saar Demri
Netflix0SS Services on Docker
Kubernetes on AWS
Kubernetes @ Nanit by Chen Fisher
Webcast - Making kubernetes production ready
Building Out Your Kafka Developer CDC Ecosystem
Sf bay area Kubernetes meetup dec8 2016 - deployment models
Riga DevDays 2017 - Efficient AWS Lambda
CI Implementation with Kubernetes at LivePerson by Saar Demri
Ad

Similar to Managed Container Orchestration with Amazon ECS (20)

PPTX
Amazon ECS.pptx tasks conatiner ecs new car
PPTX
ECS and Docker at Okta
PDF
Running Docker clusters on AWS (June 2016)
PPTX
AWS ECS Meetup Talentica
PDF
Running Docker Containers on AWS
PPTX
Weaveworks at AWS re:Invent 2016: Operations Management with Amazon ECS
PDF
Introduction to Amazon EC2 Container Service
PPTX
ECS - from 0 to 100
PDF
Running Docker clusters on AWS (November 2016)
PDF
Amazon ECS (March 2016)
PPTX
Docker on Amazon ECS
PDF
Deliver Docker Containers Continuously on AWS - QCon 2017
PDF
intro elastic container service amazon aws
PDF
ecs-presentation
PPTX
AWS Elastic Container Service (ECS) with a CI Pipeline Overview
PDF
Artem Zhurbila - docker clusters (solit 2015)
PPTX
AWS ECS LESSONS LEARNED
PDF
Docker Container automatisiert nach AWS deployen - Continuous Lifecycle 2016
PDF
Deliver Docker Containers Continuously On AWS - DevOpsCon Munich 2016
PDF
Getting started with Amazon ECS
Amazon ECS.pptx tasks conatiner ecs new car
ECS and Docker at Okta
Running Docker clusters on AWS (June 2016)
AWS ECS Meetup Talentica
Running Docker Containers on AWS
Weaveworks at AWS re:Invent 2016: Operations Management with Amazon ECS
Introduction to Amazon EC2 Container Service
ECS - from 0 to 100
Running Docker clusters on AWS (November 2016)
Amazon ECS (March 2016)
Docker on Amazon ECS
Deliver Docker Containers Continuously on AWS - QCon 2017
intro elastic container service amazon aws
ecs-presentation
AWS Elastic Container Service (ECS) with a CI Pipeline Overview
Artem Zhurbila - docker clusters (solit 2015)
AWS ECS LESSONS LEARNED
Docker Container automatisiert nach AWS deployen - Continuous Lifecycle 2016
Deliver Docker Containers Continuously On AWS - DevOpsCon Munich 2016
Getting started with Amazon ECS
Ad

More from Philipp Garbe (6)

PDF
Run Jenkins as Managed Product on ECS - AWS Meetup
PDF
Is Platform Engineering the new Ops?
PDF
Finding Cars and Hunting Down Logs - ElasticSearch @AutoScout24
PDF
Deliver docker containers continuously on aws
PDF
ElasticSearch on AWS
PDF
DockerCon 2016 Seattle Recap
Run Jenkins as Managed Product on ECS - AWS Meetup
Is Platform Engineering the new Ops?
Finding Cars and Hunting Down Logs - ElasticSearch @AutoScout24
Deliver docker containers continuously on aws
ElasticSearch on AWS
DockerCon 2016 Seattle Recap

Recently uploaded (20)

PDF
Testing WebRTC applications at scale.pdf
PPTX
Job_Card_System_Styled_lorem_ipsum_.pptx
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PDF
WebRTC in SignalWire - troubleshooting media negotiation
PDF
πŸ’° π”πŠπ“πˆ πŠπ„πŒπ„ππ€ππ†π€π πŠπˆππ„π‘πŸ’πƒ π‡π€π‘πˆ 𝐈𝐍𝐈 πŸπŸŽπŸπŸ“ πŸ’°
Β 
PPTX
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
PPTX
Introduction to Information and Communication Technology
PDF
Cloud-Scale Log Monitoring _ Datadog.pdf
PPTX
international classification of diseases ICD-10 review PPT.pptx
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
PDF
Tenda Login Guide: Access Your Router in 5 Easy Steps
PDF
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PPTX
artificial intelligence overview of it and more
PPTX
Introuction about WHO-FIC in ICD-10.pptx
PPTX
Introuction about ICD -10 and ICD-11 PPT.pptx
PDF
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
PDF
An introduction to the IFRS (ISSB) Stndards.pdf
PPTX
Funds Management Learning Material for Beg
PPTX
presentation_pfe-universite-molay-seltan.pptx
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
Β 
Testing WebRTC applications at scale.pdf
Job_Card_System_Styled_lorem_ipsum_.pptx
The New Creative Director: How AI Tools for Social Media Content Creation Are...
WebRTC in SignalWire - troubleshooting media negotiation
πŸ’° π”πŠπ“πˆ πŠπ„πŒπ„ππ€ππ†π€π πŠπˆππ„π‘πŸ’πƒ π‡π€π‘πˆ 𝐈𝐍𝐈 πŸπŸŽπŸπŸ“ πŸ’°
Β 
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
Introduction to Information and Communication Technology
Cloud-Scale Log Monitoring _ Datadog.pdf
international classification of diseases ICD-10 review PPT.pptx
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
Tenda Login Guide: Access Your Router in 5 Easy Steps
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
artificial intelligence overview of it and more
Introuction about WHO-FIC in ICD-10.pptx
Introuction about ICD -10 and ICD-11 PPT.pptx
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
An introduction to the IFRS (ISSB) Stndards.pdf
Funds Management Learning Material for Beg
presentation_pfe-universite-molay-seltan.pptx
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
Β 

Managed Container Orchestration with Amazon ECS