SlideShare une entreprise Scribd logo
1  sur  45
Télécharger pour lire hors ligne
Deliver Docker Containers
Continuously on AWS
Philipp Garbe
@pgarbe
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
● Philipp Garbe
● Lead Developer @Scout24
● Docker Captain
● Living in Bavaria
● Working in the Cloud
About Me
“Hello ECS”
Our first ECS cluster
ECS Cluster: Deployment Options
AWS Console AWS CLI ECS CLI CloudFormation
Easy to start Yes No Yes No
Automation No Yes Yes Yes
Infrastructure as
Code
No No No Yes
Auto Scaling Yes Yes No Yes
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
KeyName:
Type: AWS::EC2::KeyPair::KeyName
Description: EC2 KeyPair to enable SSH access.
...
Resources:
ECSCluster:
Type: AWS::ECS::Cluster
ECSAutoScalingGroup:
Type: AWS::AutoScaling::AutoScalingGroup
Properties:
VPCZoneIdentifier: !Ref ServiceSubnets
LaunchConfigurationName: !Ref LaunchConfig
MinSize: !Ref ClusterMinSize
MaxSize: !Ref ClusterMaxSize
LaunchConfig:
Type: AWS::AutoScaling::LaunchConfiguration
Metadata:
AWS::CloudFormation::Init:
config:
commands:
01_add_instance_to_cluster:
command: !Sub |
#!/bin/bash
echo ECS_CLUSTER=${ECSCluster} >> /etc/ecs/ecs.config
Properties:
ImageId: !FindInMap: [AWSRegionToAMI, Ref: AWS::Region, AMIID]
InstanceType: !Ref InstanceType
IamInstanceProfile: !Ref EC2InstanceProfile
KeyName: !Ref KeyName
...
Outputs:
ClusterName:
Value: !Ref ECSCluster
Export:
Name: !Sub "${AWS::StackName}-ClusterName"
The first deployment
Container Definition
● Image
● Port mapping
● Mount points
● Network options
● Docker options
Task Definition
● IAM Task Role
● Volumes
● Network Mode
● Task Placement Constraints
Service Description
● Loadbalancer
● AutoScaling
● Deployment Configuration
● Task Placement Strategy
ECS Service: Deployment Options
AWS Console AWS CLI ECS CLI CloudFormation
Easy to start Yes No Yes No
Automation No Yes Yes Yes
Configuration as
Code
No No Partially Yes
Auto Scaling Yes Yes No Yes
Load Balancer Yes Yes No Yes
Task Placement Yes Yes No No *
WebApp:
Type: AWS::ECS::Service
Properties:
Cluster:
"Fn::ImportValue": !Sub "${ClusterStack}-ClusterName"
TaskDefinition: !Ref TaskDefinition
DesiredCount: !Ref DesiredCount
DeploymentConfiguration:
MaximumPercent: 200
MinimumHealthyPercent: 100
Role: !Ref ServiceAuthRole
LoadBalancers:
- ContainerName: nginx
ContainerPort: 80
TargetGroupArn: !Ref TargetGroup
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
DesiredCount:
Type: Number
ClusterStack:
Type: String
Description: Name of the cluster stack
...
Resources:
TaskDefinition:
Type: AWS::ECS::TaskDefinition
Properties:
TaskRoleArn: !Ref TaskAuthRole
ContainerDefinitions:
- Name: nginx
Image: !Sub nginx:${Version}
Cpu: '2048'
PortMappings:
- ContainerPort: 80
Memory: '1024'
Essential: 'true'
Load Balancing
Application Load Balancer (ALB)
Static Port Mapping (ELB)
Dynamic Port Mapping (ALB)
Up & Down
● Two different kinds of scaling (cluster and service)
○ Cluster: Use cpu / memory reservation metrics
○ Service: Use cpu / memory utilization metrics
● Scale down to save money, but avoid endless-loop
● Scaling takes awhile to take effect
● ASG is not aware of ECS
AutoScaling: Conclusion
AutoScaling: Rule of Thumb
Threshold = (1 - max(Container Reservation) /
Total Capacity of a single Container Instance) * 100
Example:
Container instance capacity: 2048 MB
Container reservation: 512 MB
Threshold = (1 - 512 / 2048) * 100
Threshold = 75%
Node draining
● Finally supported by ECS
● Use Lifecycle Hooks
https://aws.amazon.com/blogs/compute/how-to-automate-container-instance-draining-in-amazon-ecs/
Best practices for ECS Cluster
● ASG UpdatePolicy defines deployment strategy
● cfn-init: Ensure Docker and ECS-Agent is running
● Put build no in UserData to enforce new EC2 instances
Volumes
EBS vs EFS
Security
IAM Security 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
https://iam.cloudonaut.io
How to protect yourself
EC2
● Disallow access to metadata service from tasks (containers)
iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32
--jump DROP
IAM
● Give the instance role only the credentials it needs (according to aws docs)
● 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
Summary
What did we miss?
● Networking
● Logging
● Monitoring
● CloudWatch Events
● EC2 System Manager parameter store
Where ECS shines…
● Stable Environment
● Catched up with task placement engine
● Native support of IAM
● AutoScaling for hosts and services
● CloudFormation all the way
● Does not support all the Docker features (e.g. HEALTHCHECK)
● Disconnect between Docker Compose and Task Definition
● Network philosophy is different (Still no SecurityGroups for Containers)
● Volumes still not natively supported (3rd party tools needed)
● It’s not a managed container service
And where not...
https://boards.greenhouse.io/scout24
Philipp Garbe
http://garbe.io
@pgarbe
https://github.com/pgarbe

Contenu connexe

Tendances

IDI 2020 - Containers Meet Serverless
IDI 2020 - Containers Meet ServerlessIDI 2020 - Containers Meet Serverless
IDI 2020 - Containers Meet ServerlessMassimo Ferre'
 
AWS Elastic Container Service - DockerHN
AWS Elastic Container Service - DockerHNAWS Elastic Container Service - DockerHN
AWS Elastic Container Service - DockerHNNguyen Anh Tu
 
Running your dockerized application(s) on AWS Elastic Container Service
Running your dockerized application(s) on AWS Elastic Container ServiceRunning your dockerized application(s) on AWS Elastic Container Service
Running your dockerized application(s) on AWS Elastic Container ServiceMarco Pas
 
AWS Lambda at JUST EAT
AWS Lambda at JUST EATAWS Lambda at JUST EAT
AWS Lambda at JUST EATAndrew Brown
 
Containers Meetup (AWS+CNCF) Milano Jan 15th 2020
Containers Meetup (AWS+CNCF) Milano Jan 15th 2020Containers Meetup (AWS+CNCF) Milano Jan 15th 2020
Containers Meetup (AWS+CNCF) Milano Jan 15th 2020Massimo Ferre'
 
Kubernetes Operations (KOPS)
Kubernetes Operations (KOPS)Kubernetes Operations (KOPS)
Kubernetes Operations (KOPS)Jakir Patel
 
OpenEBS - Containerized Storage for Containers
OpenEBS  - Containerized Storage for ContainersOpenEBS  - Containerized Storage for Containers
OpenEBS - Containerized Storage for ContainersUmasankar Mukkara
 
docker-machine, docker-compose, docker-swarm 覚書
docker-machine, docker-compose, docker-swarm 覚書docker-machine, docker-compose, docker-swarm 覚書
docker-machine, docker-compose, docker-swarm 覚書じゅん なかざ
 
Kubernetes and Amazon ECS
Kubernetes and Amazon ECSKubernetes and Amazon ECS
Kubernetes and Amazon ECSGeert Pante
 
Getting Started with Docker On AWS
Getting Started with Docker On AWSGetting Started with Docker On AWS
Getting Started with Docker On AWSAmazon Web Services
 
Building and Scaling a Containerized Microservice - DevDay Austin 2017
Building and Scaling a Containerized Microservice - DevDay Austin 2017Building and Scaling a Containerized Microservice - DevDay Austin 2017
Building and Scaling a Containerized Microservice - DevDay Austin 2017Amazon Web Services
 
Automating aws infrastructure and code deployments using Ansible @WebEngage
Automating aws infrastructure and code deployments using Ansible @WebEngageAutomating aws infrastructure and code deployments using Ansible @WebEngage
Automating aws infrastructure and code deployments using Ansible @WebEngageVishal Uderani
 
HashiCorp at Just Eat
HashiCorp at Just EatHashiCorp at Just Eat
HashiCorp at Just EatAndrew Brown
 
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014Amazon Web Services
 
Packer + Ansible을 이용한 AMI 생성 및 AutoScaling Group 이미지 교체 이야기
Packer + Ansible을 이용한 AMI 생성 및 AutoScaling Group 이미지 교체 이야기Packer + Ansible을 이용한 AMI 생성 및 AutoScaling Group 이미지 교체 이야기
Packer + Ansible을 이용한 AMI 생성 및 AutoScaling Group 이미지 교체 이야기창훈 정
 
Container Orchestration using Kubernetes
Container Orchestration using KubernetesContainer Orchestration using Kubernetes
Container Orchestration using KubernetesHesham Amin
 

Tendances (20)

ecs-presentation
ecs-presentationecs-presentation
ecs-presentation
 
IDI 2020 - Containers Meet Serverless
IDI 2020 - Containers Meet ServerlessIDI 2020 - Containers Meet Serverless
IDI 2020 - Containers Meet Serverless
 
AWS Elastic Container Service - DockerHN
AWS Elastic Container Service - DockerHNAWS Elastic Container Service - DockerHN
AWS Elastic Container Service - DockerHN
 
Running your dockerized application(s) on AWS Elastic Container Service
Running your dockerized application(s) on AWS Elastic Container ServiceRunning your dockerized application(s) on AWS Elastic Container Service
Running your dockerized application(s) on AWS Elastic Container Service
 
AWS Lambda at JUST EAT
AWS Lambda at JUST EATAWS Lambda at JUST EAT
AWS Lambda at JUST EAT
 
Containers Meetup (AWS+CNCF) Milano Jan 15th 2020
Containers Meetup (AWS+CNCF) Milano Jan 15th 2020Containers Meetup (AWS+CNCF) Milano Jan 15th 2020
Containers Meetup (AWS+CNCF) Milano Jan 15th 2020
 
Amazon EC2 Container Service
Amazon EC2 Container ServiceAmazon EC2 Container Service
Amazon EC2 Container Service
 
London Hug 19/5 - Terraform in Production
London Hug 19/5 - Terraform in ProductionLondon Hug 19/5 - Terraform in Production
London Hug 19/5 - Terraform in Production
 
Kubernetes Operations (KOPS)
Kubernetes Operations (KOPS)Kubernetes Operations (KOPS)
Kubernetes Operations (KOPS)
 
OpenEBS - Containerized Storage for Containers
OpenEBS  - Containerized Storage for ContainersOpenEBS  - Containerized Storage for Containers
OpenEBS - Containerized Storage for Containers
 
docker-machine, docker-compose, docker-swarm 覚書
docker-machine, docker-compose, docker-swarm 覚書docker-machine, docker-compose, docker-swarm 覚書
docker-machine, docker-compose, docker-swarm 覚書
 
Kubernetes and Amazon ECS
Kubernetes and Amazon ECSKubernetes and Amazon ECS
Kubernetes and Amazon ECS
 
Getting Started with Docker On AWS
Getting Started with Docker On AWSGetting Started with Docker On AWS
Getting Started with Docker On AWS
 
Docker Elastic Beanstalk
Docker Elastic BeanstalkDocker Elastic Beanstalk
Docker Elastic Beanstalk
 
Building and Scaling a Containerized Microservice - DevDay Austin 2017
Building and Scaling a Containerized Microservice - DevDay Austin 2017Building and Scaling a Containerized Microservice - DevDay Austin 2017
Building and Scaling a Containerized Microservice - DevDay Austin 2017
 
Automating aws infrastructure and code deployments using Ansible @WebEngage
Automating aws infrastructure and code deployments using Ansible @WebEngageAutomating aws infrastructure and code deployments using Ansible @WebEngage
Automating aws infrastructure and code deployments using Ansible @WebEngage
 
HashiCorp at Just Eat
HashiCorp at Just EatHashiCorp at Just Eat
HashiCorp at Just Eat
 
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
 
Packer + Ansible을 이용한 AMI 생성 및 AutoScaling Group 이미지 교체 이야기
Packer + Ansible을 이용한 AMI 생성 및 AutoScaling Group 이미지 교체 이야기Packer + Ansible을 이용한 AMI 생성 및 AutoScaling Group 이미지 교체 이야기
Packer + Ansible을 이용한 AMI 생성 및 AutoScaling Group 이미지 교체 이야기
 
Container Orchestration using Kubernetes
Container Orchestration using KubernetesContainer Orchestration using Kubernetes
Container Orchestration using Kubernetes
 

En vedette

Announcing AWS CodeBuild - January 2017 Online Teck Talks
Announcing AWS CodeBuild - January 2017 Online Teck TalksAnnouncing AWS CodeBuild - January 2017 Online Teck Talks
Announcing AWS CodeBuild - January 2017 Online Teck TalksAmazon Web Services
 
Aws Lambda Cart Microservice Server Less
Aws Lambda Cart Microservice Server LessAws Lambda Cart Microservice Server Less
Aws Lambda Cart Microservice Server LessDhanu Gupta
 
Zoraya harika
Zoraya harikaZoraya harika
Zoraya harikazobordon
 
Privacy: a short intro
Privacy: a short introPrivacy: a short intro
Privacy: a short introPaul Bush
 
Autonomic Dysreflexia
Autonomic DysreflexiaAutonomic Dysreflexia
Autonomic DysreflexiaJane Sarnicki
 
Ppt.examen final pamela addona
Ppt.examen final pamela addonaPpt.examen final pamela addona
Ppt.examen final pamela addonapameaddona
 
Career In Financial Planning
Career In Financial PlanningCareer In Financial Planning
Career In Financial PlanningSanjeev Kumar G
 
Automation of Deep learning training with AWS Step Functions
Automation of Deep learning training with AWS Step FunctionsAutomation of Deep learning training with AWS Step Functions
Automation of Deep learning training with AWS Step Functionsmizugokoro
 
Insights to MVP/ Design Sprints by Heist.
Insights to MVP/ Design Sprints by Heist.Insights to MVP/ Design Sprints by Heist.
Insights to MVP/ Design Sprints by Heist.Heist
 
Kube-AWS
Kube-AWSKube-AWS
Kube-AWSCoreOS
 
AWS Survival Guide
AWS Survival GuideAWS Survival Guide
AWS Survival GuideKen Johnson
 
Texto analizado morfológicamente.odp
Texto analizado morfológicamente.odpTexto analizado morfológicamente.odp
Texto analizado morfológicamente.odpTesi Romero
 
Micro services infrastructure with AWS and Ansible
Micro services infrastructure with AWS and AnsibleMicro services infrastructure with AWS and Ansible
Micro services infrastructure with AWS and AnsibleBamdad Dashtban
 
DeNA流Scrumとcommのチームビルディング
DeNA流ScrumとcommのチームビルディングDeNA流Scrumとcommのチームビルディング
DeNA流ScrumとcommのチームビルディングTakeshi Kaise
 

En vedette (20)

Announcing AWS CodeBuild - January 2017 Online Teck Talks
Announcing AWS CodeBuild - January 2017 Online Teck TalksAnnouncing AWS CodeBuild - January 2017 Online Teck Talks
Announcing AWS CodeBuild - January 2017 Online Teck Talks
 
Technical Track
Technical TrackTechnical Track
Technical Track
 
AWS Perú Meetup - Arquitecting for HA by Raul Hugo
AWS Perú Meetup - Arquitecting for HA by Raul HugoAWS Perú Meetup - Arquitecting for HA by Raul Hugo
AWS Perú Meetup - Arquitecting for HA by Raul Hugo
 
Aws Lambda Cart Microservice Server Less
Aws Lambda Cart Microservice Server LessAws Lambda Cart Microservice Server Less
Aws Lambda Cart Microservice Server Less
 
Tarea 4
Tarea 4Tarea 4
Tarea 4
 
Zoraya harika
Zoraya harikaZoraya harika
Zoraya harika
 
Privacy: a short intro
Privacy: a short introPrivacy: a short intro
Privacy: a short intro
 
Autonomic Dysreflexia
Autonomic DysreflexiaAutonomic Dysreflexia
Autonomic Dysreflexia
 
02_PAPUA
02_PAPUA02_PAPUA
02_PAPUA
 
Corporate Volunteering in China
Corporate Volunteering in ChinaCorporate Volunteering in China
Corporate Volunteering in China
 
Ppt.examen final pamela addona
Ppt.examen final pamela addonaPpt.examen final pamela addona
Ppt.examen final pamela addona
 
Career In Financial Planning
Career In Financial PlanningCareer In Financial Planning
Career In Financial Planning
 
Automation of Deep learning training with AWS Step Functions
Automation of Deep learning training with AWS Step FunctionsAutomation of Deep learning training with AWS Step Functions
Automation of Deep learning training with AWS Step Functions
 
Insights to MVP/ Design Sprints by Heist.
Insights to MVP/ Design Sprints by Heist.Insights to MVP/ Design Sprints by Heist.
Insights to MVP/ Design Sprints by Heist.
 
Kube-AWS
Kube-AWSKube-AWS
Kube-AWS
 
20160629 aws well-architected
20160629 aws well-architected20160629 aws well-architected
20160629 aws well-architected
 
AWS Survival Guide
AWS Survival GuideAWS Survival Guide
AWS Survival Guide
 
Texto analizado morfológicamente.odp
Texto analizado morfológicamente.odpTexto analizado morfológicamente.odp
Texto analizado morfológicamente.odp
 
Micro services infrastructure with AWS and Ansible
Micro services infrastructure with AWS and AnsibleMicro services infrastructure with AWS and Ansible
Micro services infrastructure with AWS and Ansible
 
DeNA流Scrumとcommのチームビルディング
DeNA流ScrumとcommのチームビルディングDeNA流Scrumとcommのチームビルディング
DeNA流Scrumとcommのチームビルディング
 

Similaire à Deliver Docker Containers Continuously on AWS - QCon 2017

Docker clusters on AWS with Amazon ECS and Kubernetes
Docker clusters on AWS with Amazon ECS and KubernetesDocker clusters on AWS with Amazon ECS and Kubernetes
Docker clusters on AWS with Amazon ECS and KubernetesJulien SIMON
 
Weaveworks at AWS re:Invent 2016: Operations Management with Amazon ECS
Weaveworks at AWS re:Invent 2016: Operations Management with Amazon ECSWeaveworks at AWS re:Invent 2016: Operations Management with Amazon ECS
Weaveworks at AWS re:Invent 2016: Operations Management with Amazon ECSWeaveworks
 
Advanced Scheduling with Amazon ECS (September 2017)
Advanced Scheduling with Amazon ECS (September 2017)Advanced Scheduling with Amazon ECS (September 2017)
Advanced Scheduling with Amazon ECS (September 2017)Julien SIMON
 
Monitoring Containers at Scale - September Webinar Series
Monitoring Containers at Scale - September Webinar SeriesMonitoring Containers at Scale - September Webinar Series
Monitoring Containers at Scale - September Webinar SeriesAmazon Web Services
 
Advanced Task Scheduling with Amazon ECS
Advanced Task Scheduling with Amazon ECSAdvanced Task Scheduling with Amazon ECS
Advanced Task Scheduling with Amazon ECSJulien SIMON
 
Docker on Amazon ECS
Docker on Amazon ECSDocker on Amazon ECS
Docker on Amazon ECSDeepak Kumar
 
Managed Container Orchestration with Amazon ECS
Managed Container Orchestration with Amazon ECSManaged Container Orchestration with Amazon ECS
Managed Container Orchestration with Amazon ECSPhilipp Garbe
 
Amazon ECS (March 2016)
Amazon ECS (March 2016)Amazon ECS (March 2016)
Amazon ECS (March 2016)Julien SIMON
 
Introduction to Amazon EC2 Container Service
Introduction to Amazon EC2 Container ServiceIntroduction to Amazon EC2 Container Service
Introduction to Amazon EC2 Container Servicechristophertcannon
 
February 2016 Webinar Series - EC2 Container Service Deep Dive
February 2016 Webinar Series - EC2 Container Service Deep Dive February 2016 Webinar Series - EC2 Container Service Deep Dive
February 2016 Webinar Series - EC2 Container Service Deep Dive Amazon Web Services
 
Artem Zhurbila - docker clusters (solit 2015)
Artem Zhurbila - docker clusters (solit 2015)Artem Zhurbila - docker clusters (solit 2015)
Artem Zhurbila - docker clusters (solit 2015)Artem Zhurbila
 
AWS reinvent 2019 recap - Riyadh - Containers and Serverless - Paul Maddox
AWS reinvent 2019 recap - Riyadh - Containers and Serverless - Paul MaddoxAWS reinvent 2019 recap - Riyadh - Containers and Serverless - Paul Maddox
AWS reinvent 2019 recap - Riyadh - Containers and Serverless - Paul MaddoxAWS Riyadh User Group
 
reInvent 2021 Recap and k9s review
reInvent 2021 Recap and k9s reviewreInvent 2021 Recap and k9s review
reInvent 2021 Recap and k9s reviewFaheem Memon
 
AWS Workshop 102
AWS Workshop 102AWS Workshop 102
AWS Workshop 102lynn80827
 
Max Körbächer - AWS EKS and beyond master your Kubernetes deployment on AWS -...
Max Körbächer - AWS EKS and beyond master your Kubernetes deployment on AWS -...Max Körbächer - AWS EKS and beyond master your Kubernetes deployment on AWS -...
Max Körbächer - AWS EKS and beyond master your Kubernetes deployment on AWS -...Codemotion
 
Max Körbächer - AWS EKS and beyond – master your Kubernetes deployment on AWS...
Max Körbächer - AWS EKS and beyond – master your Kubernetes deployment on AWS...Max Körbächer - AWS EKS and beyond – master your Kubernetes deployment on AWS...
Max Körbächer - AWS EKS and beyond – master your Kubernetes deployment on AWS...Codemotion
 
Running Docker clusters on AWS (November 2016)
Running Docker clusters on AWS (November 2016)Running Docker clusters on AWS (November 2016)
Running Docker clusters on AWS (November 2016)Julien SIMON
 
Running Docker clusters on AWS (June 2016)
Running Docker clusters on AWS (June 2016)Running Docker clusters on AWS (June 2016)
Running Docker clusters on AWS (June 2016)Julien SIMON
 

Similaire à Deliver Docker Containers Continuously on AWS - QCon 2017 (20)

Docker clusters on AWS with Amazon ECS and Kubernetes
Docker clusters on AWS with Amazon ECS and KubernetesDocker clusters on AWS with Amazon ECS and Kubernetes
Docker clusters on AWS with Amazon ECS and Kubernetes
 
Weaveworks at AWS re:Invent 2016: Operations Management with Amazon ECS
Weaveworks at AWS re:Invent 2016: Operations Management with Amazon ECSWeaveworks at AWS re:Invent 2016: Operations Management with Amazon ECS
Weaveworks at AWS re:Invent 2016: Operations Management with Amazon ECS
 
Advanced Scheduling with Amazon ECS (September 2017)
Advanced Scheduling with Amazon ECS (September 2017)Advanced Scheduling with Amazon ECS (September 2017)
Advanced Scheduling with Amazon ECS (September 2017)
 
Monitoring Containers at Scale - September Webinar Series
Monitoring Containers at Scale - September Webinar SeriesMonitoring Containers at Scale - September Webinar Series
Monitoring Containers at Scale - September Webinar Series
 
Advanced Task Scheduling with Amazon ECS
Advanced Task Scheduling with Amazon ECSAdvanced Task Scheduling with Amazon ECS
Advanced Task Scheduling with Amazon ECS
 
Docker on Amazon ECS
Docker on Amazon ECSDocker on Amazon ECS
Docker on Amazon ECS
 
Managed Container Orchestration with Amazon ECS
Managed Container Orchestration with Amazon ECSManaged Container Orchestration with Amazon ECS
Managed Container Orchestration with Amazon ECS
 
Amazon ECS (March 2016)
Amazon ECS (March 2016)Amazon ECS (March 2016)
Amazon ECS (March 2016)
 
Introduction to Amazon EC2 Container Service
Introduction to Amazon EC2 Container ServiceIntroduction to Amazon EC2 Container Service
Introduction to Amazon EC2 Container Service
 
February 2016 Webinar Series - EC2 Container Service Deep Dive
February 2016 Webinar Series - EC2 Container Service Deep Dive February 2016 Webinar Series - EC2 Container Service Deep Dive
February 2016 Webinar Series - EC2 Container Service Deep Dive
 
Artem Zhurbila - docker clusters (solit 2015)
Artem Zhurbila - docker clusters (solit 2015)Artem Zhurbila - docker clusters (solit 2015)
Artem Zhurbila - docker clusters (solit 2015)
 
AWS reinvent 2019 recap - Riyadh - Containers and Serverless - Paul Maddox
AWS reinvent 2019 recap - Riyadh - Containers and Serverless - Paul MaddoxAWS reinvent 2019 recap - Riyadh - Containers and Serverless - Paul Maddox
AWS reinvent 2019 recap - Riyadh - Containers and Serverless - Paul Maddox
 
reInvent 2021 Recap and k9s review
reInvent 2021 Recap and k9s reviewreInvent 2021 Recap and k9s review
reInvent 2021 Recap and k9s review
 
AWS Workshop 102
AWS Workshop 102AWS Workshop 102
AWS Workshop 102
 
Max Körbächer - AWS EKS and beyond master your Kubernetes deployment on AWS -...
Max Körbächer - AWS EKS and beyond master your Kubernetes deployment on AWS -...Max Körbächer - AWS EKS and beyond master your Kubernetes deployment on AWS -...
Max Körbächer - AWS EKS and beyond master your Kubernetes deployment on AWS -...
 
Max Körbächer - AWS EKS and beyond – master your Kubernetes deployment on AWS...
Max Körbächer - AWS EKS and beyond – master your Kubernetes deployment on AWS...Max Körbächer - AWS EKS and beyond – master your Kubernetes deployment on AWS...
Max Körbächer - AWS EKS and beyond – master your Kubernetes deployment on AWS...
 
應用開發新思維
應用開發新思維應用開發新思維
應用開發新思維
 
Running Docker clusters on AWS (November 2016)
Running Docker clusters on AWS (November 2016)Running Docker clusters on AWS (November 2016)
Running Docker clusters on AWS (November 2016)
 
Amazon ECS Deep Dive
Amazon ECS Deep DiveAmazon ECS Deep Dive
Amazon ECS Deep Dive
 
Running Docker clusters on AWS (June 2016)
Running Docker clusters on AWS (June 2016)Running Docker clusters on AWS (June 2016)
Running Docker clusters on AWS (June 2016)
 

Plus de Philipp Garbe

Run Jenkins as Managed Product on ECS - AWS Meetup
Run Jenkins as Managed Product on ECS - AWS MeetupRun Jenkins as Managed Product on ECS - AWS Meetup
Run Jenkins as Managed Product on ECS - AWS MeetupPhilipp Garbe
 
Is Platform Engineering the new Ops?
Is Platform Engineering the new Ops?Is Platform Engineering the new Ops?
Is Platform Engineering the new Ops?Philipp Garbe
 
Finding Cars and Hunting Down Logs - ElasticSearch @AutoScout24
Finding Cars and Hunting Down Logs - ElasticSearch @AutoScout24Finding Cars and Hunting Down Logs - ElasticSearch @AutoScout24
Finding Cars and Hunting Down Logs - ElasticSearch @AutoScout24Philipp Garbe
 
Deliver docker containers continuously on aws
Deliver docker containers continuously on awsDeliver docker containers continuously on aws
Deliver docker containers continuously on awsPhilipp Garbe
 
ElasticSearch on AWS
ElasticSearch on AWSElasticSearch on AWS
ElasticSearch on AWSPhilipp Garbe
 
DockerCon 2016 Seattle Recap
DockerCon 2016 Seattle RecapDockerCon 2016 Seattle Recap
DockerCon 2016 Seattle RecapPhilipp Garbe
 

Plus de Philipp Garbe (6)

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

Dernier

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 

Dernier (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 

Deliver Docker Containers Continuously on AWS - QCon 2017

  • 1. Deliver Docker Containers Continuously on AWS Philipp Garbe @pgarbe
  • 2. 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
  • 3. ● Philipp Garbe ● Lead Developer @Scout24 ● Docker Captain ● Living in Bavaria ● Working in the Cloud About Me
  • 5. Our first ECS cluster
  • 6. ECS Cluster: Deployment Options AWS Console AWS CLI ECS CLI CloudFormation Easy to start Yes No Yes No Automation No Yes Yes Yes Infrastructure as Code No No No Yes Auto Scaling Yes Yes No Yes
  • 7. AWSTemplateFormatVersion: '2010-09-09' Parameters: KeyName: Type: AWS::EC2::KeyPair::KeyName Description: EC2 KeyPair to enable SSH access. ... Resources: ECSCluster: Type: AWS::ECS::Cluster ECSAutoScalingGroup: Type: AWS::AutoScaling::AutoScalingGroup Properties: VPCZoneIdentifier: !Ref ServiceSubnets LaunchConfigurationName: !Ref LaunchConfig MinSize: !Ref ClusterMinSize MaxSize: !Ref ClusterMaxSize LaunchConfig: Type: AWS::AutoScaling::LaunchConfiguration Metadata: AWS::CloudFormation::Init: config: commands: 01_add_instance_to_cluster: command: !Sub | #!/bin/bash echo ECS_CLUSTER=${ECSCluster} >> /etc/ecs/ecs.config Properties: ImageId: !FindInMap: [AWSRegionToAMI, Ref: AWS::Region, AMIID] InstanceType: !Ref InstanceType IamInstanceProfile: !Ref EC2InstanceProfile KeyName: !Ref KeyName ... Outputs: ClusterName: Value: !Ref ECSCluster Export: Name: !Sub "${AWS::StackName}-ClusterName"
  • 9. Container Definition ● Image ● Port mapping ● Mount points ● Network options ● Docker options
  • 10. Task Definition ● IAM Task Role ● Volumes ● Network Mode ● Task Placement Constraints
  • 11. Service Description ● Loadbalancer ● AutoScaling ● Deployment Configuration ● Task Placement Strategy
  • 12. ECS Service: Deployment Options AWS Console AWS CLI ECS CLI CloudFormation Easy to start Yes No Yes No Automation No Yes Yes Yes Configuration as Code No No Partially Yes Auto Scaling Yes Yes No Yes Load Balancer Yes Yes No Yes Task Placement Yes Yes No No *
  • 13. WebApp: Type: AWS::ECS::Service Properties: Cluster: "Fn::ImportValue": !Sub "${ClusterStack}-ClusterName" TaskDefinition: !Ref TaskDefinition DesiredCount: !Ref DesiredCount DeploymentConfiguration: MaximumPercent: 200 MinimumHealthyPercent: 100 Role: !Ref ServiceAuthRole LoadBalancers: - ContainerName: nginx ContainerPort: 80 TargetGroupArn: !Ref TargetGroup AWSTemplateFormatVersion: '2010-09-09' Parameters: DesiredCount: Type: Number ClusterStack: Type: String Description: Name of the cluster stack ... Resources: TaskDefinition: Type: AWS::ECS::TaskDefinition Properties: TaskRoleArn: !Ref TaskAuthRole ContainerDefinitions: - Name: nginx Image: !Sub nginx:${Version} Cpu: '2048' PortMappings: - ContainerPort: 80 Memory: '1024' Essential: 'true'
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28. ● Two different kinds of scaling (cluster and service) ○ Cluster: Use cpu / memory reservation metrics ○ Service: Use cpu / memory utilization metrics ● Scale down to save money, but avoid endless-loop ● Scaling takes awhile to take effect ● ASG is not aware of ECS AutoScaling: Conclusion
  • 29. AutoScaling: Rule of Thumb Threshold = (1 - max(Container Reservation) / Total Capacity of a single Container Instance) * 100 Example: Container instance capacity: 2048 MB Container reservation: 512 MB Threshold = (1 - 512 / 2048) * 100 Threshold = 75%
  • 30. Node draining ● Finally supported by ECS ● Use Lifecycle Hooks https://aws.amazon.com/blogs/compute/how-to-automate-container-instance-draining-in-amazon-ecs/
  • 31. Best practices for ECS Cluster ● ASG UpdatePolicy defines deployment strategy ● cfn-init: Ensure Docker and ECS-Agent is running ● Put build no in UserData to enforce new EC2 instances
  • 35. IAM Security 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 https://iam.cloudonaut.io
  • 36.
  • 37.
  • 38.
  • 39. How to protect yourself EC2 ● Disallow access to metadata service from tasks (containers) iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP IAM ● Give the instance role only the credentials it needs (according to aws docs)
  • 40. ● 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
  • 42. What did we miss? ● Networking ● Logging ● Monitoring ● CloudWatch Events ● EC2 System Manager parameter store
  • 43. Where ECS shines… ● Stable Environment ● Catched up with task placement engine ● Native support of IAM ● AutoScaling for hosts and services ● CloudFormation all the way
  • 44. ● Does not support all the Docker features (e.g. HEALTHCHECK) ● Disconnect between Docker Compose and Task Definition ● Network philosophy is different (Still no SecurityGroups for Containers) ● Volumes still not natively supported (3rd party tools needed) ● It’s not a managed container service And where not...