SlideShare a Scribd company logo
1 of 46
DOCKER ON ECS
- Deepak Kumar
Prerequisite:
● Basic Understanding of Docker
● We used spring boot as jar for the tutorial
● Removed System dependent paths
● Dockerized Spring boot application - docker-maven-plugin
● Permissions / Memory usage etc. Defined in Dockerfile.
● Containerized spring boot application . for details refer this link
● New Relic in base level image
● New Relic Integration - for dev and prod
● Access logs on console
● Git tag in images - git-commit-id-plugin - dirty/non-dirty
● Support for multiple ECRs
● Distributed Tracing in New Relic - enable in newrelic.yml
● Generic image version -CI/CD
● Multiple ECR support -PROD/ DEV
Image Level Changes?
Agenda
● Dockerization of Microservice - Pending Parts
● Container Orchestration on AWS
● Service Discovery
● Service Load Balancing
● Logging
● Auto Scaling
● Storage
● Notifications
● Image Level Changes
● Continuous Integration & Delivery
● Live Deployment
● Comparison with kubernetes
● Technologies which allow us to:
○ Create multi-node container clusters
○ Manage multiple containers easily
○ Automate container lifecycle
Examples: ECS, kubernetes,docker swarm, mesos etc.
What is Container Orchestration?
Why Do We Need Container Orchestration?
● Horizontal scalability across - multiple hosts
● Grouping of related containers
● Automatic failure detection and recovery
● Seamless updates
● Docker container orchestration service by AWS
● Operates on top of EC2
● Built-in private Docker registry (ECR)
● Uses AWS architecture internally.
ECS - EC2 Container Service
Why Use ECS?
● Free private registry -ECR
● Built-in security
○ Assign IAM Roles to Docker containers
○ Docker registry authentication using IAM
● Native integration with ELB and Auto Scaling
● Full support from AWS
● Built on AWS architecture
ECS Components
● Cluster - a group of container instances
● Container Instance - an EC2 instance that hosts containers
● Task - a set of related Docker containers
● Task Definition - a template which defines a task
● Service - a group of identical tasks
Cluster
● A group of container instances
● Supports multiple Availability Zones
● Bound to a specific AWS region
Container Instance - EC2
instance● An EC2 instance running Docker with an ECS agent
● May be deployed from an official AWS AMI
● May be deployed using an Auto Scaling group
● Can be of any EC2 instance type / size
Task
● A set of one or more related containers
● Deployed to a cluster
● Containers within a task are placed on the same host
Task Definition
1. Serves as a “template” for tasks
2. Allows to define most of the Docker features accessible via
docker run (image, volumes, networking, env vars...)
3. Allows to define CPU and memory limits for the tasks
4. Can assign an IAM role to a task
5. Configurable using JSON Configurable- User
Service
● An abstraction above tasks
● Deploys multiple “copies” from a task definition
● Maintains the desired number of running tasks
● May bind to a load balancer
ECS - Summary & Best Practices
● Use ECS to easily manage containerized apps on AWS
● Deploy ECS instances in multiple AZs for high
availability
● Choose an instance type that is appropriate for your
apps
● Centralized logging is recommended
Question:
How does a client know where to
send a request when a service
runs on multiple nodes?
● Cloud environments change all the time
● IP addresses and ports are assigned dynamically
● Auto Scaling launches and terminates instances
● Some instances might be under maintenance or upgrade
Service Discovery?
A mechanism which allows a client to find out the network location of a
service automatically
Need?
Service
Discovery
Service Discovery Using a Load Balancer
Auto Scaling in ECS
AutoScaling : Automatically adjusting the capacity of the
application’s infrastructure based on load.
● Service Auto Scaling - adjusting the number of running ECS
tasks for the given service
● Cluster Auto Scaling - adjusting the number of EC2
instances in the cluster
Note : Both types rely on CloudWatch metrics
ECS Resource Allocation
● Each container gets a portion of the CPU and memory of the
host on which it runs
● This capacity is reserved for each container
● The remaining capacity is shared among all containers
● Resource allocation is configured in the task definition
CPU Resource Allocation
● Each ECS instance has 1024 CPU units per CPU core
● A container gets a relative amount of CPU cycles based on the
configured units
● The configured units are reserved for the container
● CPU allocation is only relevant when there is competition on
host resources
● The remaining CPU capacity may be used by other containers
Memory Resource Allocation
● Soft limit - the amount is reserved for the container
but may be exceeded if capacity is available
● Hard limit - container is killed when trying to
exceed the reserved amount
● Must use one limit type but may use both together
Service Auto Scaling
● Adding more containers to handle an increasing load
● Configured inside ECS
● Use CPU and memory usage to trigger scaling events
● May use custom CloudWatch metrics too
● “Do we have enough compute power?”
Cluster Auto Scaling
● Adding more instances to accommodate an increasing
number of containers
● Configured via EC2 Auto Scaling
● Use CPU and memory reservation to trigger scaling events
● “Do we have room for more containers?”
Auto Scaling - Summary & Best Practices
● Configure both Service Auto Scaling and Cluster Auto Scaling
● Scale services based on utilization
● Scale clusters based on reservation
● Service Auto Scaling is much faster than Cluster Auto Scaling
● Leave some spare capacity on each host
○ Allows the cluster to scale in time
Ref: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cloudwatch-
metrics.html
Static Port
Problem
Persist data among containers on
multiple hosts?
Storage
Notifications:
Current Logging:
● Saw: Group logging
○ Install Saw https://github.com/TylerBrock/saw
○ saw watch hotelier_logs --expand
● Dokr
○ pip install dokr https://pypi.org/project/dokr/
○ Per Task logging
■ Install ecs-cli first
■ dokr log
■ dokr deploy {cluster_name} {service_name} {tag}
■ Dokr
● ECS Monitor
○ Install ecs-monitor https://github.com/tombolaltd/ecs-
monitor
● New Relic in base level image
● New Relic Integration - for dev and prod
● Access logs on console
● Git tag in images - git-commit-id-plugin - dirty/non-dirty
● Support for multiple ECRs
● Distributed Tracing in New Relic - enable in newrelic.yml
● Generic image version -CI/CD
● Multiple ECR support -PROD/ DEV
Image Level Changes?
CI/CD + Jenkins + ECS
CI/CD with ECS - Workflow
1. Checkout source from version control to Jenkins server
2. Login into ECS (use dokr plugin)
3. Clean older images
4. Build a new Docker image
5. Push the new image to ECR
6. Update the task definition & service
7. ECS updates the containers on the cluster
8. Send Deployment Notifications
CI/CD with ECS
● ECS can use Docker images from ECR or any other registry
● You can specify which images to deploy using task definitions
● ECS allows you to perform rolling updates to running services
● Updates can be triggered automatically using the ECS API
● Jenkins can be used to automate the process
Failure Case
Success Case
Tagging Strategy
● It is important to implement a proper tagging strategy when
using Docker for CI/CD
● Common tag values:
○ Application version (“1.3”)
○ CI/CD build number (“136”)
○ Git SHA value (“c31dxes”)
● Using one of the above will make sure your tags are unique
CI/CD - Summary & Best Practices
● Build new Docker images and push them to ECR using
jenkins only
● Use Jenkins to trigger rolling updates on ECS
● Implement a proper tagging strategy
● Don’t Use “latest” Tag when deploying on Production.
ECS Monitor : plugin link
Tools Used
● Jenkins
● Slack
● Cloudwatch for monitoring
● dokr (pypi) - Must for prod deployment and logs
● ecs-cli (aws)
● ecs-deploy (pypi)
● ecs-monitor (React)
● New Relic
Questions?

More Related Content

What's hot

Autoscaling Kubernetes
Autoscaling KubernetesAutoscaling Kubernetes
Autoscaling Kubernetescraigbox
 
Orchestrating Docker Containers with Google Kubernetes on OpenStack
Orchestrating Docker Containers with Google Kubernetes on OpenStackOrchestrating Docker Containers with Google Kubernetes on OpenStack
Orchestrating Docker Containers with Google Kubernetes on OpenStackTrevor Roberts Jr.
 
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 OverviewWyn B. Van Devanter
 
What's new in Kubernetes
What's new in KubernetesWhat's new in Kubernetes
What's new in KubernetesDaniel Smith
 
Meteor South Bay Meetup - Kubernetes & Google Container Engine
Meteor South Bay Meetup - Kubernetes & Google Container EngineMeteor South Bay Meetup - Kubernetes & Google Container Engine
Meteor South Bay Meetup - Kubernetes & Google Container EngineKit Merker
 
Leveraging Amzon EC2 Container Services for Container Orchestration
Leveraging Amzon EC2 Container Services for Container OrchestrationLeveraging Amzon EC2 Container Services for Container Orchestration
Leveraging Amzon EC2 Container Services for Container OrchestrationNeeraj Shah
 
AWS ECS Quick Introduction
AWS ECS Quick IntroductionAWS ECS Quick Introduction
AWS ECS Quick IntroductionVinothini Raju
 
Kubernetes Networking - Sreenivas Makam - Google - CC18
Kubernetes Networking - Sreenivas Makam - Google - CC18Kubernetes Networking - Sreenivas Makam - Google - CC18
Kubernetes Networking - Sreenivas Makam - Google - CC18CodeOps Technologies LLP
 
Containers kuberenetes
Containers kuberenetesContainers kuberenetes
Containers kuberenetescsegayan
 
Running containers in AWS
Running containers in AWSRunning containers in AWS
Running containers in AWSAndrewMay59
 
Angular2, Spring Boot, Docker Swarm
Angular2, Spring Boot, Docker SwarmAngular2, Spring Boot, Docker Swarm
Angular2, Spring Boot, Docker Swarm🐊 Erwin Alberto
 
Scaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceScaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceBen Hall
 
Kubernetes "Ubernetes" Cluster Federation by Quinton Hoole (Google, Inc) Huaw...
Kubernetes "Ubernetes" Cluster Federation by Quinton Hoole (Google, Inc) Huaw...Kubernetes "Ubernetes" Cluster Federation by Quinton Hoole (Google, Inc) Huaw...
Kubernetes "Ubernetes" Cluster Federation by Quinton Hoole (Google, Inc) Huaw...Quinton Hoole
 
Stateful set in kubernetes implementation & usecases
Stateful set in kubernetes implementation & usecases Stateful set in kubernetes implementation & usecases
Stateful set in kubernetes implementation & usecases Krishna-Kumar
 

What's hot (19)

Autoscaling Kubernetes
Autoscaling KubernetesAutoscaling Kubernetes
Autoscaling Kubernetes
 
Kubernetes 101
Kubernetes 101Kubernetes 101
Kubernetes 101
 
What is Kubernets
What is  KubernetsWhat is  Kubernets
What is Kubernets
 
Developer workflow with docker
Developer workflow with dockerDeveloper workflow with docker
Developer workflow with docker
 
Orchestrating Docker Containers with Google Kubernetes on OpenStack
Orchestrating Docker Containers with Google Kubernetes on OpenStackOrchestrating Docker Containers with Google Kubernetes on OpenStack
Orchestrating Docker Containers with Google Kubernetes on OpenStack
 
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
 
What's new in Kubernetes
What's new in KubernetesWhat's new in Kubernetes
What's new in Kubernetes
 
Meteor South Bay Meetup - Kubernetes & Google Container Engine
Meteor South Bay Meetup - Kubernetes & Google Container EngineMeteor South Bay Meetup - Kubernetes & Google Container Engine
Meteor South Bay Meetup - Kubernetes & Google Container Engine
 
Leveraging Amzon EC2 Container Services for Container Orchestration
Leveraging Amzon EC2 Container Services for Container OrchestrationLeveraging Amzon EC2 Container Services for Container Orchestration
Leveraging Amzon EC2 Container Services for Container Orchestration
 
AWS ECS Quick Introduction
AWS ECS Quick IntroductionAWS ECS Quick Introduction
AWS ECS Quick Introduction
 
Kubernetes Networking - Sreenivas Makam - Google - CC18
Kubernetes Networking - Sreenivas Makam - Google - CC18Kubernetes Networking - Sreenivas Makam - Google - CC18
Kubernetes Networking - Sreenivas Makam - Google - CC18
 
Containers kuberenetes
Containers kuberenetesContainers kuberenetes
Containers kuberenetes
 
Containers kuberenetes
Containers kuberenetesContainers kuberenetes
Containers kuberenetes
 
Running containers in AWS
Running containers in AWSRunning containers in AWS
Running containers in AWS
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes Introduction
 
Angular2, Spring Boot, Docker Swarm
Angular2, Spring Boot, Docker SwarmAngular2, Spring Boot, Docker Swarm
Angular2, Spring Boot, Docker Swarm
 
Scaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceScaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container Service
 
Kubernetes "Ubernetes" Cluster Federation by Quinton Hoole (Google, Inc) Huaw...
Kubernetes "Ubernetes" Cluster Federation by Quinton Hoole (Google, Inc) Huaw...Kubernetes "Ubernetes" Cluster Federation by Quinton Hoole (Google, Inc) Huaw...
Kubernetes "Ubernetes" Cluster Federation by Quinton Hoole (Google, Inc) Huaw...
 
Stateful set in kubernetes implementation & usecases
Stateful set in kubernetes implementation & usecases Stateful set in kubernetes implementation & usecases
Stateful set in kubernetes implementation & usecases
 

Similar to Docker on Amazon ECS

Docker on AWS - the Right Way
Docker on AWS - the Right WayDocker on AWS - the Right Way
Docker on AWS - the Right WayAllCloud
 
Deliver Docker Containers Continuously On AWS - DevOpsCon Munich 2016
Deliver Docker Containers Continuously On AWS - DevOpsCon Munich 2016Deliver Docker Containers Continuously On AWS - DevOpsCon Munich 2016
Deliver Docker Containers Continuously On AWS - DevOpsCon Munich 2016Philipp Garbe
 
Docker Container automatisiert nach AWS deployen - Continuous Lifecycle 2016
Docker Container automatisiert nach AWS deployen  - Continuous Lifecycle 2016Docker Container automatisiert nach AWS deployen  - Continuous Lifecycle 2016
Docker Container automatisiert nach AWS deployen - Continuous Lifecycle 2016Philipp Garbe
 
Deliver Docker Containers Continuously on AWS - QCon 2017
Deliver Docker Containers Continuously on AWS - QCon 2017Deliver Docker Containers Continuously on AWS - QCon 2017
Deliver Docker Containers Continuously on AWS - QCon 2017Philipp Garbe
 
AWS Workshop 102
AWS Workshop 102AWS Workshop 102
AWS Workshop 102lynn80827
 
AWS re:Invent 2016: Development Workflow with Docker and Amazon ECS (CON302)
AWS re:Invent 2016: Development Workflow with Docker and Amazon ECS (CON302)AWS re:Invent 2016: Development Workflow with Docker and Amazon ECS (CON302)
AWS re:Invent 2016: Development Workflow with Docker and Amazon ECS (CON302)Amazon Web Services
 
Scalable Spark deployment using Kubernetes
Scalable Spark deployment using KubernetesScalable Spark deployment using Kubernetes
Scalable Spark deployment using Kubernetesdatamantra
 
Kubernetes in Docker
Kubernetes in DockerKubernetes in Docker
Kubernetes in Dockerdocker-athens
 
Velocity NYC 2016 - Containers @ Netflix
Velocity NYC 2016 - Containers @ NetflixVelocity NYC 2016 - Containers @ Netflix
Velocity NYC 2016 - Containers @ Netflixaspyker
 
ECS and Docker at Okta
ECS and Docker at OktaECS and Docker at Okta
ECS and Docker at OktaJon Todd
 
Introduction to Container Storage Interface (CSI)
Introduction to Container Storage Interface (CSI)Introduction to Container Storage Interface (CSI)
Introduction to Container Storage Interface (CSI)Idan Atias
 
Netflix and Containers: Not A Stranger Thing
Netflix and Containers:  Not A Stranger ThingNetflix and Containers:  Not A Stranger Thing
Netflix and Containers: Not A Stranger Thingaspyker
 
Netflix and Containers: Not Stranger Things
Netflix and Containers: Not Stranger ThingsNetflix and Containers: Not Stranger Things
Netflix and Containers: Not Stranger ThingsAll Things Open
 
Re:invent 2016 Container Scheduling, Execution and AWS Integration
Re:invent 2016 Container Scheduling, Execution and AWS IntegrationRe:invent 2016 Container Scheduling, Execution and AWS Integration
Re:invent 2016 Container Scheduling, Execution and AWS Integrationaspyker
 
Docker dev ops for cd meetup 12-14
Docker dev ops for cd meetup 12-14Docker dev ops for cd meetup 12-14
Docker dev ops for cd meetup 12-14Simon Storm
 
Continuous Delivery to Amazon EC2 Container Service
Continuous Delivery to Amazon EC2 Container ServiceContinuous Delivery to Amazon EC2 Container Service
Continuous Delivery to Amazon EC2 Container ServiceAmazon Web Services
 
Working with microservices and Amazon ECS at Airtime
Working with microservices and Amazon ECS at AirtimeWorking with microservices and Amazon ECS at Airtime
Working with microservices and Amazon ECS at AirtimeAmazon Web Services
 
Ghost Environment
Ghost EnvironmentGhost Environment
Ghost EnvironmentPratipD
 

Similar to Docker on Amazon ECS (20)

Docker on AWS - the Right Way
Docker on AWS - the Right WayDocker on AWS - the Right Way
Docker on AWS - the Right Way
 
Deliver Docker Containers Continuously On AWS - DevOpsCon Munich 2016
Deliver Docker Containers Continuously On AWS - DevOpsCon Munich 2016Deliver Docker Containers Continuously On AWS - DevOpsCon Munich 2016
Deliver Docker Containers Continuously On AWS - DevOpsCon Munich 2016
 
Docker Container automatisiert nach AWS deployen - Continuous Lifecycle 2016
Docker Container automatisiert nach AWS deployen  - Continuous Lifecycle 2016Docker Container automatisiert nach AWS deployen  - Continuous Lifecycle 2016
Docker Container automatisiert nach AWS deployen - Continuous Lifecycle 2016
 
AWS ECS workshop
AWS ECS workshopAWS ECS workshop
AWS ECS workshop
 
Deliver Docker Containers Continuously on AWS - QCon 2017
Deliver Docker Containers Continuously on AWS - QCon 2017Deliver Docker Containers Continuously on AWS - QCon 2017
Deliver Docker Containers Continuously on AWS - QCon 2017
 
AWS Workshop 102
AWS Workshop 102AWS Workshop 102
AWS Workshop 102
 
AWS re:Invent 2016: Development Workflow with Docker and Amazon ECS (CON302)
AWS re:Invent 2016: Development Workflow with Docker and Amazon ECS (CON302)AWS re:Invent 2016: Development Workflow with Docker and Amazon ECS (CON302)
AWS re:Invent 2016: Development Workflow with Docker and Amazon ECS (CON302)
 
Scalable Spark deployment using Kubernetes
Scalable Spark deployment using KubernetesScalable Spark deployment using Kubernetes
Scalable Spark deployment using Kubernetes
 
Kubernetes in Docker
Kubernetes in DockerKubernetes in Docker
Kubernetes in Docker
 
Velocity NYC 2016 - Containers @ Netflix
Velocity NYC 2016 - Containers @ NetflixVelocity NYC 2016 - Containers @ Netflix
Velocity NYC 2016 - Containers @ Netflix
 
Kubernetes intro
Kubernetes introKubernetes intro
Kubernetes intro
 
ECS and Docker at Okta
ECS and Docker at OktaECS and Docker at Okta
ECS and Docker at Okta
 
Introduction to Container Storage Interface (CSI)
Introduction to Container Storage Interface (CSI)Introduction to Container Storage Interface (CSI)
Introduction to Container Storage Interface (CSI)
 
Netflix and Containers: Not A Stranger Thing
Netflix and Containers:  Not A Stranger ThingNetflix and Containers:  Not A Stranger Thing
Netflix and Containers: Not A Stranger Thing
 
Netflix and Containers: Not Stranger Things
Netflix and Containers: Not Stranger ThingsNetflix and Containers: Not Stranger Things
Netflix and Containers: Not Stranger Things
 
Re:invent 2016 Container Scheduling, Execution and AWS Integration
Re:invent 2016 Container Scheduling, Execution and AWS IntegrationRe:invent 2016 Container Scheduling, Execution and AWS Integration
Re:invent 2016 Container Scheduling, Execution and AWS Integration
 
Docker dev ops for cd meetup 12-14
Docker dev ops for cd meetup 12-14Docker dev ops for cd meetup 12-14
Docker dev ops for cd meetup 12-14
 
Continuous Delivery to Amazon EC2 Container Service
Continuous Delivery to Amazon EC2 Container ServiceContinuous Delivery to Amazon EC2 Container Service
Continuous Delivery to Amazon EC2 Container Service
 
Working with microservices and Amazon ECS at Airtime
Working with microservices and Amazon ECS at AirtimeWorking with microservices and Amazon ECS at Airtime
Working with microservices and Amazon ECS at Airtime
 
Ghost Environment
Ghost EnvironmentGhost Environment
Ghost Environment
 

Recently uploaded

(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...Call Girls in Nagpur High Profile
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAbhinavSharma374939
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 

Recently uploaded (20)

(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog Converter
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 

Docker on Amazon ECS

  • 1. DOCKER ON ECS - Deepak Kumar
  • 2. Prerequisite: ● Basic Understanding of Docker ● We used spring boot as jar for the tutorial ● Removed System dependent paths ● Dockerized Spring boot application - docker-maven-plugin ● Permissions / Memory usage etc. Defined in Dockerfile. ● Containerized spring boot application . for details refer this link
  • 3. ● New Relic in base level image ● New Relic Integration - for dev and prod ● Access logs on console ● Git tag in images - git-commit-id-plugin - dirty/non-dirty ● Support for multiple ECRs ● Distributed Tracing in New Relic - enable in newrelic.yml ● Generic image version -CI/CD ● Multiple ECR support -PROD/ DEV Image Level Changes?
  • 4. Agenda ● Dockerization of Microservice - Pending Parts ● Container Orchestration on AWS ● Service Discovery ● Service Load Balancing ● Logging ● Auto Scaling ● Storage ● Notifications ● Image Level Changes ● Continuous Integration & Delivery ● Live Deployment ● Comparison with kubernetes
  • 5. ● Technologies which allow us to: ○ Create multi-node container clusters ○ Manage multiple containers easily ○ Automate container lifecycle Examples: ECS, kubernetes,docker swarm, mesos etc. What is Container Orchestration?
  • 6. Why Do We Need Container Orchestration? ● Horizontal scalability across - multiple hosts ● Grouping of related containers ● Automatic failure detection and recovery ● Seamless updates
  • 7.
  • 8. ● Docker container orchestration service by AWS ● Operates on top of EC2 ● Built-in private Docker registry (ECR) ● Uses AWS architecture internally. ECS - EC2 Container Service
  • 9. Why Use ECS? ● Free private registry -ECR ● Built-in security ○ Assign IAM Roles to Docker containers ○ Docker registry authentication using IAM ● Native integration with ELB and Auto Scaling ● Full support from AWS ● Built on AWS architecture
  • 10. ECS Components ● Cluster - a group of container instances ● Container Instance - an EC2 instance that hosts containers ● Task - a set of related Docker containers ● Task Definition - a template which defines a task ● Service - a group of identical tasks
  • 11. Cluster ● A group of container instances ● Supports multiple Availability Zones ● Bound to a specific AWS region
  • 12. Container Instance - EC2 instance● An EC2 instance running Docker with an ECS agent ● May be deployed from an official AWS AMI ● May be deployed using an Auto Scaling group ● Can be of any EC2 instance type / size
  • 13. Task ● A set of one or more related containers ● Deployed to a cluster ● Containers within a task are placed on the same host
  • 14. Task Definition 1. Serves as a “template” for tasks 2. Allows to define most of the Docker features accessible via docker run (image, volumes, networking, env vars...) 3. Allows to define CPU and memory limits for the tasks 4. Can assign an IAM role to a task 5. Configurable using JSON Configurable- User
  • 15. Service ● An abstraction above tasks ● Deploys multiple “copies” from a task definition ● Maintains the desired number of running tasks ● May bind to a load balancer
  • 16.
  • 17. ECS - Summary & Best Practices ● Use ECS to easily manage containerized apps on AWS ● Deploy ECS instances in multiple AZs for high availability ● Choose an instance type that is appropriate for your apps ● Centralized logging is recommended
  • 18. Question: How does a client know where to send a request when a service runs on multiple nodes?
  • 19. ● Cloud environments change all the time ● IP addresses and ports are assigned dynamically ● Auto Scaling launches and terminates instances ● Some instances might be under maintenance or upgrade Service Discovery? A mechanism which allows a client to find out the network location of a service automatically Need?
  • 21. Service Discovery Using a Load Balancer
  • 22. Auto Scaling in ECS AutoScaling : Automatically adjusting the capacity of the application’s infrastructure based on load. ● Service Auto Scaling - adjusting the number of running ECS tasks for the given service ● Cluster Auto Scaling - adjusting the number of EC2 instances in the cluster Note : Both types rely on CloudWatch metrics
  • 23. ECS Resource Allocation ● Each container gets a portion of the CPU and memory of the host on which it runs ● This capacity is reserved for each container ● The remaining capacity is shared among all containers ● Resource allocation is configured in the task definition
  • 24. CPU Resource Allocation ● Each ECS instance has 1024 CPU units per CPU core ● A container gets a relative amount of CPU cycles based on the configured units ● The configured units are reserved for the container ● CPU allocation is only relevant when there is competition on host resources ● The remaining CPU capacity may be used by other containers
  • 25. Memory Resource Allocation ● Soft limit - the amount is reserved for the container but may be exceeded if capacity is available ● Hard limit - container is killed when trying to exceed the reserved amount ● Must use one limit type but may use both together
  • 26. Service Auto Scaling ● Adding more containers to handle an increasing load ● Configured inside ECS ● Use CPU and memory usage to trigger scaling events ● May use custom CloudWatch metrics too ● “Do we have enough compute power?”
  • 27. Cluster Auto Scaling ● Adding more instances to accommodate an increasing number of containers ● Configured via EC2 Auto Scaling ● Use CPU and memory reservation to trigger scaling events ● “Do we have room for more containers?”
  • 28.
  • 29. Auto Scaling - Summary & Best Practices ● Configure both Service Auto Scaling and Cluster Auto Scaling ● Scale services based on utilization ● Scale clusters based on reservation ● Service Auto Scaling is much faster than Cluster Auto Scaling ● Leave some spare capacity on each host ○ Allows the cluster to scale in time Ref: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cloudwatch- metrics.html
  • 31. Persist data among containers on multiple hosts? Storage
  • 33.
  • 34. Current Logging: ● Saw: Group logging ○ Install Saw https://github.com/TylerBrock/saw ○ saw watch hotelier_logs --expand ● Dokr ○ pip install dokr https://pypi.org/project/dokr/ ○ Per Task logging ■ Install ecs-cli first ■ dokr log ■ dokr deploy {cluster_name} {service_name} {tag} ■ Dokr ● ECS Monitor ○ Install ecs-monitor https://github.com/tombolaltd/ecs- monitor
  • 35. ● New Relic in base level image ● New Relic Integration - for dev and prod ● Access logs on console ● Git tag in images - git-commit-id-plugin - dirty/non-dirty ● Support for multiple ECRs ● Distributed Tracing in New Relic - enable in newrelic.yml ● Generic image version -CI/CD ● Multiple ECR support -PROD/ DEV Image Level Changes?
  • 37. CI/CD with ECS - Workflow 1. Checkout source from version control to Jenkins server 2. Login into ECS (use dokr plugin) 3. Clean older images 4. Build a new Docker image 5. Push the new image to ECR 6. Update the task definition & service 7. ECS updates the containers on the cluster 8. Send Deployment Notifications
  • 38. CI/CD with ECS ● ECS can use Docker images from ECR or any other registry ● You can specify which images to deploy using task definitions ● ECS allows you to perform rolling updates to running services ● Updates can be triggered automatically using the ECS API ● Jenkins can be used to automate the process
  • 39.
  • 42. Tagging Strategy ● It is important to implement a proper tagging strategy when using Docker for CI/CD ● Common tag values: ○ Application version (“1.3”) ○ CI/CD build number (“136”) ○ Git SHA value (“c31dxes”) ● Using one of the above will make sure your tags are unique
  • 43. CI/CD - Summary & Best Practices ● Build new Docker images and push them to ECR using jenkins only ● Use Jenkins to trigger rolling updates on ECS ● Implement a proper tagging strategy ● Don’t Use “latest” Tag when deploying on Production.
  • 44. ECS Monitor : plugin link
  • 45. Tools Used ● Jenkins ● Slack ● Cloudwatch for monitoring ● dokr (pypi) - Must for prod deployment and logs ● ecs-cli (aws) ● ecs-deploy (pypi) ● ecs-monitor (React) ● New Relic