SlideShare a Scribd company logo
1 of 25
Container Cluster
Management with AWS
ECS
Anshul Patel
Talentica DevOps Engineering
Team
What is Docker container ?
 Open platform to build, ship and run distributed applications
 Groups application with all the dependencies, shared libs
 Compared to Traditional Virtualized system, which encapsulates
OS + Kernel, Docker has same Kernel Space
 Isolation between different containers is done through
Namespaces, Cgroups, Network Interfaces
 Current Docker Engine Stable version 1.11.2 (2016-05-31)
 Default Engine Execution Driver : libcontainer
 Docker uses libcontainer to manipulate Namespaces, Cgroups,
Network Interfaces
Why Docker ?
 Lightweight, Open and Secure
 Portable and efficient in comparison to VM
 Accelerates Developer onboarding
 Empower Developer creativity
 Eliminates Environmental Inconsistencies
 Ability to scale quickly
 Reduces time to market of your application
Why Docker ?
Why Container Cluster Management System ?
 Provides clustering layer for controlling the deployment of your
containers onto the underlying hosts
 Manages container lifecycle within the cluster
 Scheduling Containers across the cluster
 Abstracting developers away from underlying machines
 Scaling containers
 Increases robustness and resilience of distributed containerized
application
What is AWS ECS (EC2 Container Service) ?
 Highly scalable, fast, container management service from Amazon
Web Services.
 Easily run, stop and manage Docker containers on cluster of
Amazon EC2 instances
 Schedules the placement of Docker containers across your cluster
based on resource needs, availability and requirements
 Eliminates need for you to operate your own cluster management
systems or write wrappers/logic for scaling your underlying
infrastructure
Components of ECS
 Cluster - Logical group of container instances
 Container Instance - Runs ECS agents and is registered to
cluster
 Task Definition - Description of application to be deployed
 Scheduler - Method of placing task on container instance
 Task - An instantiation of task definition running on container
instance
 Service - Runs and maintains predefined tasks simultaneously
 Container - Docker Container created during task instantiation
ECS Architecture
ECS Architecture
Key Components
 Agent Communication Service - Gateway between ECS agents
and ECS backend cluster management engine
 API - Provides cluster state information
 Cluster Management Engine - Provides cluster coordination and
state management
 Key/Value Store - It is used to storing cluster state information
ECS Architecture
 It isn’t a blackbox, runs on your own EC2(Container) instances
 ECS cluster is collection of EC2(Container) Instances
 ECS agent is installed on each of EC2(Container) Instances
 ECS agent registers instance to centralised ECS service
 ECS agent handles incoming requests for container deployment
 ECS agent handles the lifecycle of container
Creating ECS Cluster
 Cluster can be created using AWS Console, alternatively you can
create using aws ecs CLI
 AWS Container Instance Requirement
 Linux Kernel > = 3.10
 Docker > = 1.5.0
 ECS container agent
 Nanny process to monitor ECS agent (For eg: ecs-init )
 Amazon ECS optimized AMI is preconfigured with these
requirements
Launching EC2 container Instances
Points to remember
 ec2InstanceRole must be created
 If the EC2 instance is required to be part of pre-defined cluster,
following should be added in user data
#/bin/bash
echo ECS_CLUSTER=your_cluster_name >> /etc/ecs/ecs.config
 During the launch of AMI, it will consist of two EBS, one for OS
and another for Docker’s use.
ECS Task Definition
 Task definition is 1 or more container definitions
 It defines
 Docker Images to use
 Port and Drive Volume Mapping
 CPU and memory to use with container
 Whether containers are linked
 Environmental variable which is required to be passed to
container
 Whether task should continue if container finishes or fails
ECS Scheduler
 By default, AWS supports two ways for scheduling
 Running Tasks
 Services
 Apart from the above, StartTask API of ECS can be used to write
custom scheduler. Currently Amazon has developed PoC scheduler
for Mesos
ECS Running Tasks
 Instantiation of Task Definition
 Task can be either short lived or long lived. (For eg: event-driven-
data task or batch jobs)
 Architecturally all containers belonging to same task, have to run
on the same machine. In order to run container on different
machine, new task should be created.
 Co-location of containers can be achieved by grouping them in the
same task
ECS services
 Allows you to run and maintain a specified/desired number of
instances ( For eg : webservers )
 If any tasks should fail or stop for any reason, ECS service
scheduler launches another instance of your task definition to
maintain desired count
Deploying ECS Cluster
 Create a Load Balancer
 Create a Launch configuration
 Create a Autoscaling group, which specifies the desired number of
instances
 Create a task definition
 Create a service
ECS Container Instance Autoscaling
 ECS provides cluster-level parameters which can give the cluster
utilization statistics
 MemoryReservation - Current % of reserved memory by
cluster
 MemoryUtilization - Current % of utilized memory by cluster
 CPUReservation - Current % of reserved CPU by cluster
 CPUUtilization - Current % of utilized CPU by cluster
 CloudWatch Alarms on the above parameters enables to Scale
Up/Down the ECS cluster
ECS Task Autoscaling
 ECS also provides the facility to scale up the tasks in the service.
 Tasks can be autoscaled on following ECS service parameters
 CPUUtilization - Current % CPU utilization by ECS service
 MemoryUtilization - Current % Memory Utilization by ECS
service
EC2 Container Registry
 AWS managed Docker container registry
 Stores and Manages Docker Images
 Hosts images in a highly available and scalable architecture
 It is integrated with ECS
 No upfront fee, pay only for the data stored
Key Advantages of ECS Service
 ECS is monitoring status of Docker containers, so if it goes down it
will be deployed automatically
 ASG is monitoring your EC2 instances, if one instance goes down,
it will spawn new instance
 ECS can do zero-downtime deployments of new version ( Blue -
Green deployments )
 Updation requires two things
 Create new revision of task
 Update the revision in the service
Key Challenges
 No direct relation between EC2 Autoscaling and Task Autoscaling
 ELB works with 1:1 port mapping, so if the number of tasks is
equal to the number of instances, scheduler will not attempt to
deploy another task
 Service Discovery
ECS Limits
Resource Default Limit
Number of clusters per region, per account 1000
Number of container instances per cluster 1000
Number of services per cluster 500
ECS Limits
Resource Default Limit
Number of load balancers per service 1
Number of tasks per service (the desired
count)
1000
Number of tasks launched (count) per run-
task
10
Number of container instances per start-
task
10
Throttle on container instance registration
rate
1 per second / 60 max per minute
Task definition size limit 32 KiB
Task definition max containers 10
Throttle on task definition registration rate 1 per second / 60 max per minute
Thanks & Questions ?

More Related Content

What's hot

Continuous integration with Docker and Ansible
Continuous integration with Docker and AnsibleContinuous integration with Docker and Ansible
Continuous integration with Docker and Ansible
Dmytro Slupytskyi
 

What's hot (20)

CoreOS: The Inside and Outside of Linux Containers
CoreOS: The Inside and Outside of Linux ContainersCoreOS: The Inside and Outside of Linux Containers
CoreOS: The Inside and Outside of Linux Containers
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Fluentd and docker monitoring
Fluentd and docker monitoringFluentd and docker monitoring
Fluentd and docker monitoring
 
Beginning mesos
Beginning mesosBeginning mesos
Beginning mesos
 
OpenEBS - Containerized Storage for Containers
OpenEBS  - Containerized Storage for ContainersOpenEBS  - Containerized Storage for Containers
OpenEBS - Containerized Storage for Containers
 
Swarm docker bangalore_meetup
Swarm docker bangalore_meetupSwarm docker bangalore_meetup
Swarm docker bangalore_meetup
 
Apache Bookkeeper and Apache Zookeeper for Apache Pulsar
Apache Bookkeeper and Apache Zookeeper for Apache PulsarApache Bookkeeper and Apache Zookeeper for Apache Pulsar
Apache Bookkeeper and Apache Zookeeper for Apache Pulsar
 
DockerCon EU 2015: From Local Development to Production Deployments using Ama...
DockerCon EU 2015: From Local Development to Production Deployments using Ama...DockerCon EU 2015: From Local Development to Production Deployments using Ama...
DockerCon EU 2015: From Local Development to Production Deployments using Ama...
 
(APP303) Lightning Fast Deploys with Docker Containers and AWS | AWS re:Inven...
(APP303) Lightning Fast Deploys with Docker Containers and AWS | AWS re:Inven...(APP303) Lightning Fast Deploys with Docker Containers and AWS | AWS re:Inven...
(APP303) Lightning Fast Deploys with Docker Containers and AWS | AWS re:Inven...
 
Exploring Openstack Swift(Object Storage) and Swiftstack
Exploring Openstack Swift(Object Storage) and Swiftstack Exploring Openstack Swift(Object Storage) and Swiftstack
Exploring Openstack Swift(Object Storage) and Swiftstack
 
Play Support in Cloud Foundry
Play Support in Cloud FoundryPlay Support in Cloud Foundry
Play Support in Cloud Foundry
 
Swarm mode
Swarm modeSwarm mode
Swarm mode
 
Monitoring Dell Infrastructure using Docker & Microservices
Monitoring Dell Infrastructure using Docker & MicroservicesMonitoring Dell Infrastructure using Docker & Microservices
Monitoring Dell Infrastructure using Docker & Microservices
 
How Postman adopted Docker
How Postman adopted DockerHow Postman adopted Docker
How Postman adopted Docker
 
Continuous integration with Docker and Ansible
Continuous integration with Docker and AnsibleContinuous integration with Docker and Ansible
Continuous integration with Docker and Ansible
 
Py Con 2017
Py Con 2017Py Con 2017
Py Con 2017
 
Kubernetes HA @ AppDirect - Montreal Kubernetes Meetup
Kubernetes HA @ AppDirect - Montreal Kubernetes MeetupKubernetes HA @ AppDirect - Montreal Kubernetes Meetup
Kubernetes HA @ AppDirect - Montreal Kubernetes Meetup
 
Intro to docker
Intro to dockerIntro to docker
Intro to docker
 
Securing & Monitoring Your K8s Cluster with RBAC and Prometheus”.
Securing & Monitoring Your K8s Cluster with RBAC and Prometheus”.Securing & Monitoring Your K8s Cluster with RBAC and Prometheus”.
Securing & Monitoring Your K8s Cluster with RBAC and Prometheus”.
 
Container Orchestration @Docker Meetup Hamburg
Container Orchestration @Docker Meetup HamburgContainer Orchestration @Docker Meetup Hamburg
Container Orchestration @Docker Meetup Hamburg
 

Viewers also liked

Untitled Presentation
Untitled PresentationUntitled Presentation
Untitled Presentation
Purushotham P
 
ASTD to ATD- The Five Characteristics of an Adaptive Culture-Blog Post 2014
ASTD to ATD- The Five Characteristics of an Adaptive Culture-Blog Post 2014ASTD to ATD- The Five Characteristics of an Adaptive Culture-Blog Post 2014
ASTD to ATD- The Five Characteristics of an Adaptive Culture-Blog Post 2014
KHADEIDRA LE GENDRE, M.A.
 
Reference check form (3)
Reference check form (3)Reference check form (3)
Reference check form (3)
anne Mercie
 

Viewers also liked (20)

Why not you(1)
Why not you(1)Why not you(1)
Why not you(1)
 
Manifesto Introduction
Manifesto IntroductionManifesto Introduction
Manifesto Introduction
 
Tutorial Slideshare
Tutorial SlideshareTutorial Slideshare
Tutorial Slideshare
 
Cloud Computing Security
Cloud Computing SecurityCloud Computing Security
Cloud Computing Security
 
Global Artists
Global Artists Global Artists
Global Artists
 
My just right book
My just right bookMy just right book
My just right book
 
Cost average efekt
Cost average efektCost average efekt
Cost average efekt
 
Untitled Presentation
Untitled PresentationUntitled Presentation
Untitled Presentation
 
Doodling graphic recording
Doodling graphic recordingDoodling graphic recording
Doodling graphic recording
 
Summer traininig-report ntpc anta content
Summer traininig-report ntpc anta contentSummer traininig-report ntpc anta content
Summer traininig-report ntpc anta content
 
ASTD to ATD- The Five Characteristics of an Adaptive Culture-Blog Post 2014
ASTD to ATD- The Five Characteristics of an Adaptive Culture-Blog Post 2014ASTD to ATD- The Five Characteristics of an Adaptive Culture-Blog Post 2014
ASTD to ATD- The Five Characteristics of an Adaptive Culture-Blog Post 2014
 
Ejercios resueltos analogik
Ejercios resueltos analogikEjercios resueltos analogik
Ejercios resueltos analogik
 
Report About Eng. Materials
Report About Eng. MaterialsReport About Eng. Materials
Report About Eng. Materials
 
99 pledges official ppt pdf
99 pledges official ppt pdf99 pledges official ppt pdf
99 pledges official ppt pdf
 
summer training report ntpc anta
summer training report ntpc antasummer training report ntpc anta
summer training report ntpc anta
 
Proposisi Logika Informatika
Proposisi Logika InformatikaProposisi Logika Informatika
Proposisi Logika Informatika
 
Reference check form (3)
Reference check form (3)Reference check form (3)
Reference check form (3)
 
Lucky seven game using 7 segment display in fpga
Lucky seven game using 7 segment display in fpgaLucky seven game using 7 segment display in fpga
Lucky seven game using 7 segment display in fpga
 
Ntpc anta training presentation
Ntpc anta training presentation Ntpc anta training presentation
Ntpc anta training presentation
 
Zaman Mesolitikum
Zaman MesolitikumZaman Mesolitikum
Zaman Mesolitikum
 

Similar to AWS ECS Meetup Talentica

SRV201 Getting Started with Docker on AWS
SRV201 Getting Started with Docker on AWSSRV201 Getting Started with Docker on AWS
SRV201 Getting Started with Docker on AWS
Amazon Web Services
 

Similar to AWS ECS Meetup Talentica (20)

Running containers in AWS
Running containers in AWSRunning containers in AWS
Running containers in AWS
 
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 EC2 container service
Amazon EC2 container serviceAmazon EC2 container service
Amazon EC2 container service
 
Walk-through: Amazon ECS
Walk-through: Amazon ECSWalk-through: Amazon ECS
Walk-through: Amazon ECS
 
Serverless and mixed container orchestration and request routing on AWS
Serverless and mixed container orchestration and request routing on AWSServerless and mixed container orchestration and request routing on AWS
Serverless and mixed container orchestration and request routing on AWS
 
Running containerized application in AWS ECS
Running containerized application in AWS ECSRunning containerized application in AWS ECS
Running containerized application in AWS ECS
 
AWS Elastic Container Service (ECS) with a CI Pipeline Overview
AWS Elastic Container Service (ECS) with a CI Pipeline OverviewAWS Elastic Container Service (ECS) with a CI Pipeline Overview
AWS Elastic Container Service (ECS) with a CI Pipeline Overview
 
ECS and ECR deep dive
ECS and ECR deep diveECS and ECR deep dive
ECS and ECR deep dive
 
Amazon ECS with Docker | AWS Public Sector Summit 2016
Amazon ECS with Docker | AWS Public Sector Summit 2016Amazon ECS with Docker | AWS Public Sector Summit 2016
Amazon ECS with Docker | AWS Public Sector Summit 2016
 
Docker on AWS - the Right Way
Docker on AWS - the Right WayDocker on AWS - the Right Way
Docker on AWS - the Right Way
 
State of the Union: Containers on AWS
State of the Union: Containers on AWSState of the Union: Containers on AWS
State of the Union: Containers on AWS
 
Amazon Web Services EC2 Container Service (ECS)
Amazon Web Services EC2 Container Service (ECS)Amazon Web Services EC2 Container Service (ECS)
Amazon Web Services EC2 Container Service (ECS)
 
AWS Community Day - Andrew May - Running Containers in AWS
AWS Community Day - Andrew May - Running Containers in AWS  AWS Community Day - Andrew May - Running Containers in AWS
AWS Community Day - Andrew May - Running Containers in AWS
 
ECS in action
ECS in actionECS in action
ECS in action
 
Advanced Container Scheduling
Advanced Container SchedulingAdvanced Container Scheduling
Advanced Container Scheduling
 
Getting Started with Docker on AWS
Getting Started with Docker on AWSGetting Started with Docker on AWS
Getting Started with Docker on AWS
 
SRV201 Getting Started with Docker on AWS
SRV201 Getting Started with Docker on AWSSRV201 Getting Started with Docker on AWS
SRV201 Getting Started with Docker on AWS
 
ECS & ECR Deep Dive - 김기완 솔루션즈 아키텍트 :: AWS Container Day
ECS & ECR Deep Dive - 김기완 솔루션즈 아키텍트 :: AWS Container DayECS & ECR Deep Dive - 김기완 솔루션즈 아키텍트 :: AWS Container Day
ECS & ECR Deep Dive - 김기완 솔루션즈 아키텍트 :: AWS Container Day
 
Scheduling Containers on Amazon ECS
Scheduling Containers on Amazon ECSScheduling Containers on Amazon ECS
Scheduling Containers on Amazon ECS
 
Amazon EKS Deep Dive
Amazon EKS Deep DiveAmazon EKS Deep Dive
Amazon EKS Deep Dive
 

More from Anshul Patel (9)

Chaos engineering with Litmus Chaos Framework
Chaos engineering with Litmus Chaos FrameworkChaos engineering with Litmus Chaos Framework
Chaos engineering with Litmus Chaos Framework
 
Docker Fundamentals
Docker FundamentalsDocker Fundamentals
Docker Fundamentals
 
Chaos Engineering with Gremlin Platform
Chaos Engineering with Gremlin PlatformChaos Engineering with Gremlin Platform
Chaos Engineering with Gremlin Platform
 
Chaos Engineering
Chaos EngineeringChaos Engineering
Chaos Engineering
 
Introduction to docker_notary_v1.0.0
Introduction to docker_notary_v1.0.0Introduction to docker_notary_v1.0.0
Introduction to docker_notary_v1.0.0
 
Linux Operating System Fundamentals
Linux Operating System FundamentalsLinux Operating System Fundamentals
Linux Operating System Fundamentals
 
Building CLI Applications with Golang
Building CLI Applications with GolangBuilding CLI Applications with Golang
Building CLI Applications with Golang
 
Linux kit meetup_v1.0.0
Linux kit meetup_v1.0.0Linux kit meetup_v1.0.0
Linux kit meetup_v1.0.0
 
Meetup on Apache Zookeeper
Meetup on Apache ZookeeperMeetup on Apache Zookeeper
Meetup on Apache Zookeeper
 

Recently uploaded

Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Monica Sydney
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
ydyuyu
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
ayvbos
 
一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理
F
 

Recently uploaded (20)

Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
 
Local Call Girls in Gomati 9332606886 HOT & SEXY Models beautiful and charmi...
Local Call Girls in Gomati  9332606886 HOT & SEXY Models beautiful and charmi...Local Call Girls in Gomati  9332606886 HOT & SEXY Models beautiful and charmi...
Local Call Girls in Gomati 9332606886 HOT & SEXY Models beautiful and charmi...
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
 
PIC Microcontroller Structure & Assembly Language.ppsx
PIC Microcontroller Structure & Assembly Language.ppsxPIC Microcontroller Structure & Assembly Language.ppsx
PIC Microcontroller Structure & Assembly Language.ppsx
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
 
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac RoomVip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
 
一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理
 
Call girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girlsCall girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girls
 
Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call GirlsMira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
 
💚 Call Girls Bahraich 9332606886 High Profile Call Girls You Can Get The S...
💚 Call Girls Bahraich   9332606886  High Profile Call Girls You Can Get The S...💚 Call Girls Bahraich   9332606886  High Profile Call Girls You Can Get The S...
💚 Call Girls Bahraich 9332606886 High Profile Call Girls You Can Get The S...
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
 
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
 

AWS ECS Meetup Talentica

  • 1. Container Cluster Management with AWS ECS Anshul Patel Talentica DevOps Engineering Team
  • 2. What is Docker container ?  Open platform to build, ship and run distributed applications  Groups application with all the dependencies, shared libs  Compared to Traditional Virtualized system, which encapsulates OS + Kernel, Docker has same Kernel Space  Isolation between different containers is done through Namespaces, Cgroups, Network Interfaces  Current Docker Engine Stable version 1.11.2 (2016-05-31)  Default Engine Execution Driver : libcontainer  Docker uses libcontainer to manipulate Namespaces, Cgroups, Network Interfaces
  • 3. Why Docker ?  Lightweight, Open and Secure  Portable and efficient in comparison to VM  Accelerates Developer onboarding  Empower Developer creativity  Eliminates Environmental Inconsistencies  Ability to scale quickly  Reduces time to market of your application
  • 5. Why Container Cluster Management System ?  Provides clustering layer for controlling the deployment of your containers onto the underlying hosts  Manages container lifecycle within the cluster  Scheduling Containers across the cluster  Abstracting developers away from underlying machines  Scaling containers  Increases robustness and resilience of distributed containerized application
  • 6. What is AWS ECS (EC2 Container Service) ?  Highly scalable, fast, container management service from Amazon Web Services.  Easily run, stop and manage Docker containers on cluster of Amazon EC2 instances  Schedules the placement of Docker containers across your cluster based on resource needs, availability and requirements  Eliminates need for you to operate your own cluster management systems or write wrappers/logic for scaling your underlying infrastructure
  • 7. Components of ECS  Cluster - Logical group of container instances  Container Instance - Runs ECS agents and is registered to cluster  Task Definition - Description of application to be deployed  Scheduler - Method of placing task on container instance  Task - An instantiation of task definition running on container instance  Service - Runs and maintains predefined tasks simultaneously  Container - Docker Container created during task instantiation
  • 9. ECS Architecture Key Components  Agent Communication Service - Gateway between ECS agents and ECS backend cluster management engine  API - Provides cluster state information  Cluster Management Engine - Provides cluster coordination and state management  Key/Value Store - It is used to storing cluster state information
  • 10. ECS Architecture  It isn’t a blackbox, runs on your own EC2(Container) instances  ECS cluster is collection of EC2(Container) Instances  ECS agent is installed on each of EC2(Container) Instances  ECS agent registers instance to centralised ECS service  ECS agent handles incoming requests for container deployment  ECS agent handles the lifecycle of container
  • 11. Creating ECS Cluster  Cluster can be created using AWS Console, alternatively you can create using aws ecs CLI  AWS Container Instance Requirement  Linux Kernel > = 3.10  Docker > = 1.5.0  ECS container agent  Nanny process to monitor ECS agent (For eg: ecs-init )  Amazon ECS optimized AMI is preconfigured with these requirements
  • 12. Launching EC2 container Instances Points to remember  ec2InstanceRole must be created  If the EC2 instance is required to be part of pre-defined cluster, following should be added in user data #/bin/bash echo ECS_CLUSTER=your_cluster_name >> /etc/ecs/ecs.config  During the launch of AMI, it will consist of two EBS, one for OS and another for Docker’s use.
  • 13. ECS Task Definition  Task definition is 1 or more container definitions  It defines  Docker Images to use  Port and Drive Volume Mapping  CPU and memory to use with container  Whether containers are linked  Environmental variable which is required to be passed to container  Whether task should continue if container finishes or fails
  • 14. ECS Scheduler  By default, AWS supports two ways for scheduling  Running Tasks  Services  Apart from the above, StartTask API of ECS can be used to write custom scheduler. Currently Amazon has developed PoC scheduler for Mesos
  • 15. ECS Running Tasks  Instantiation of Task Definition  Task can be either short lived or long lived. (For eg: event-driven- data task or batch jobs)  Architecturally all containers belonging to same task, have to run on the same machine. In order to run container on different machine, new task should be created.  Co-location of containers can be achieved by grouping them in the same task
  • 16. ECS services  Allows you to run and maintain a specified/desired number of instances ( For eg : webservers )  If any tasks should fail or stop for any reason, ECS service scheduler launches another instance of your task definition to maintain desired count
  • 17. Deploying ECS Cluster  Create a Load Balancer  Create a Launch configuration  Create a Autoscaling group, which specifies the desired number of instances  Create a task definition  Create a service
  • 18. ECS Container Instance Autoscaling  ECS provides cluster-level parameters which can give the cluster utilization statistics  MemoryReservation - Current % of reserved memory by cluster  MemoryUtilization - Current % of utilized memory by cluster  CPUReservation - Current % of reserved CPU by cluster  CPUUtilization - Current % of utilized CPU by cluster  CloudWatch Alarms on the above parameters enables to Scale Up/Down the ECS cluster
  • 19. ECS Task Autoscaling  ECS also provides the facility to scale up the tasks in the service.  Tasks can be autoscaled on following ECS service parameters  CPUUtilization - Current % CPU utilization by ECS service  MemoryUtilization - Current % Memory Utilization by ECS service
  • 20. EC2 Container Registry  AWS managed Docker container registry  Stores and Manages Docker Images  Hosts images in a highly available and scalable architecture  It is integrated with ECS  No upfront fee, pay only for the data stored
  • 21. Key Advantages of ECS Service  ECS is monitoring status of Docker containers, so if it goes down it will be deployed automatically  ASG is monitoring your EC2 instances, if one instance goes down, it will spawn new instance  ECS can do zero-downtime deployments of new version ( Blue - Green deployments )  Updation requires two things  Create new revision of task  Update the revision in the service
  • 22. Key Challenges  No direct relation between EC2 Autoscaling and Task Autoscaling  ELB works with 1:1 port mapping, so if the number of tasks is equal to the number of instances, scheduler will not attempt to deploy another task  Service Discovery
  • 23. ECS Limits Resource Default Limit Number of clusters per region, per account 1000 Number of container instances per cluster 1000 Number of services per cluster 500
  • 24. ECS Limits Resource Default Limit Number of load balancers per service 1 Number of tasks per service (the desired count) 1000 Number of tasks launched (count) per run- task 10 Number of container instances per start- task 10 Throttle on container instance registration rate 1 per second / 60 max per minute Task definition size limit 32 KiB Task definition max containers 10 Throttle on task definition registration rate 1 per second / 60 max per minute

Editor's Notes

  1. Apart from the libcontainer, docker is compatible with Openvz Systemd-nspawn Libvirt-lxc Libvirt-sandbox qemu/kvm BSD jails Solaris zones LXC What does a driver do ? Provides a way to manipulate namespaces, control groups, network interfaces, firewall rules, apparmor profiles Why libcontainer ? Can manipulate the above mentioned things in a consistent and predictable way, without depending on userland packages.
  2. AMI  US-WEST-2 : amzn-ami-2016.03.c-amazon-ecs-optimized
  3. 1 core = 1,024 CPU units Calculation Memory MemoryReservation = ( Total MB of memory reserved by tasks in cluster * 100 )/ Total MB registered by container instances in cluster MemoryUtilization = ( Total MB of memory used by tasks in cluster * 100 ) / Total MB of memory registered by container instances in cluster CPU CPUReservavtion = ( Total CPU units reserved by tasks in cluster * 100 )/ Total CPU units registered by containers instances in cluster CPUUtilization = (Total CPU units used by tasks in cluster * 100)/ Total CPU units registered by container instances in cluster in cluster
  4. CPU Service CPU Utilization = ( Total CPU units used by tasks in service * 100 ) / ( Total CPU units reserved in task definition * number of tasks in service ) Memory Service Memory Utilization = ( Total MB of memory used by tasks in service * 100)/(Total MB of memory reserved in task definition * number of tasks)
  5. First point : Set tasks much higher than EC2 instances, so if the EC2 Instance scaling happens, it will automatically schedule the tasks Second point : Use HAProxy or Traefik LB