SlideShare a Scribd company logo
EC2 CONTAINER SERVICE
AWS + DOCKER
+
DOCKER
DOCKER
DOCKER ISโ€ฆ
โ–ธ Application virtualisation
โ–ธ A container with everything your app needs
โ–ธ code; runtime; tools; environment; OS
โ–ธ Building, running and management of these containers
DOCKER
WHY DOCKER
โ–ธ Empowers creativity
โ–ธ isolation from platform, machine, language etc.. free developers from
constraints
โ–ธ No more โ€œworks on my machine :troll:โ€
โ–ธ Sharing is trivial (image repositories, docker hub etcโ€ฆ)
โ–ธ Quick to scale
โ–ธ Gives us a platform to pull out services today
DOCKER
HOW IT WORKS
โ–ธ Each container shares the underlying host
kernel (itโ€™s why they boot so quickly)
โ–ธ Containers are to VMโ€™s what threads are to
processes
โ–ธ A container isnโ€™t really a VM, but you can treat
it like one for the most part.
HARDWARE
HOST KERNEL
DOCKER ENGINE
GUEST OS GUEST OS
BINS/LIBS BINS/LIBS
APP A APP B
RUNNING A CONTAINER
DOCKER - RUNNING A CONTAINER
> DOCKER RUN HELLO-WORLD
DOCKER - RUNNING A CONTAINER
> DOCKER RUN CENTOS
DOCKERFILE
DOCKER - DOCKERFILE
DOCKERFILE
FROM mhart/alpine-node:6.3.1
# Copy app to a directory called /app
COPY . /app
# Set the working dir to the newly created /app directory
WORKDIR /app
# Run npm install
RUN npm install --production
EXPOSE 1337
CMD ["node", "app.js"]
tracking api - docker ๏ฌle
DOCKER REGISTRY
DOCKER - REGISTRY
EC2 CONTAINER REGISTRY (ECR)
โ–ธ A repository for docker images
โ–ธ AWSโ€™s version of Docker Hub
BIT DOCKER DEMOโ€ฆ
ECS
ECS
ECS ISโ€ฆ
โ–ธ Container orchestration, scheduling and networking
โ–ธ Collections of de๏ฌned tasks running within a cluster
โ–ธ AWSโ€™s answer to Kubernetes, Mesos, Fleet and Swarm
ECS
WHY ECS
โ–ธ Cost - We only pay for the resources we use, much cheaper than beanstalk
โ–ธ Flexibility - Horizontal scaling
โ–ธ Good integration with AWS (duh)
โ–ธ Ef๏ฌciency - Less idle and responsive to spikes (also see the point about cost)
โ–ธ Quickness and ease of release (both new and existing containers)
ECS
WHY ECS
โ–ธ Reliability - If a task dies, ECS will kill it and launch a new on within seconds.
โ–ธ Smart updates - deterministic update policies
โ–ธ Opens doorsโ€ฆ
WHAT WE REALLY CARE ABOUT
ECS - WHAT WE REALLY CARE ABOUT
3 PARTS
โ–ธ Task De๏ฌnitions
โ–ธ Services
โ–ธ Load Balancers - application vs classic
ECS - WHAT WE REALLY CARE ABOUT
TASK DEFINITIONS
Task de๏ฌnitions specify the container information for your application stack, such
as how many containers are part of your task, what system resources they need,
how they are linked together, which host ports they will use.
TASK = MEMORY
CPU
ENVIRONMENT VARIABLES
COMMANDS
VOLUMES AND STORAGE
DOCKER IMAGE(S)
ECS - WHAT WE REALLY CARE ABOUT
TASK DEFINITIONS
โ€ฃ One or more containers
ECS - WHAT WE REALLY CARE ABOUT
TASK DEFINITIONS
โ€ฃ Immutable - when a task is updated, it is classed as a revision
ECS - WHAT WE REALLY CARE ABOUT
SERVICES
A service runs and maintains a โ€œdesired countโ€ of a task de๏ฌnition simultaneously
in an ECS cluster.
ECS - WHAT WE REALLY CARE ABOUT
SERVICES
โ–ธ If any task should fail or stop for any reason, the service scheduler launches
another instance of your task de๏ฌnition to replace it and maintain the desired
count of tasks in the service.
โ–ธ Optionally runs the service behind a load balancer (important for apiโ€™s)
โ–ธ Uses a speci๏ฌed minimum and maximum health percentage to determine
update strategy.
ECS - WHAT WE REALLY CARE ABOUT
SERVICES
If the minimum healthy percent is below 100%, the service scheduler can ignore
the desiredCount temporarily during a deployment. For example, if your service
has a desiredCount of four tasks, a minimum healthy percent of 50% allows the
scheduler to stop two existing tasks before starting two new tasks.
Deployment Configuration - minimum health
ECS - WHAT WE REALLY CARE ABOUT
SERVICES
If a service has a desiredCount of four tasks, a maximumPercent value of 200%
starts four new tasks before stopping the four older tasks (provided that the
cluster resources required to do this are available).
Deployment Configuration - maximum health
UNDER THE HOOD
ECS - UNDER THE HOOD
AWS RESOURCES
โ–ธ EC2
โ–ธ Auto Scaling Groups
โ–ธ Launch Con๏ฌguration
โ–ธ ELB
โ–ธ IAM
ECS - UNDER THE HOOD
COMPUTE
CLUSTER =
ECS AGENT
Amazon Linux x64
ECS AGENT
Amazon Linux x64
AUTO SCALING GROUP
Desired Count = 2
ECS - UNDER THE HOOD
LOAD BALANCERS - CLASSIC
CLUSTER
:80/:443
:80/:443
host port - 8000
host port - 9000
TASK
INSTANCE
TASK
TASK
INSTANCE
TASK
ATTACHED TO HOST PORT ON INSTANCE
ECS - UNDER THE HOOD
LOAD BALANCERS - APPLICATION
CLUSTER
:80/:443
:80/:443
TASK
INSTANCE
TASK
TASK
INSTANCE
TASK
MAPPED AT THE APPLICATION LEVEL
Dynamic port
Dynamic port
DEV PIPELINE
DEV PIPELINE
CREATE
1. Code
2. Docker๏ฌle
3. Git
DEV PIPELINE
TEAMCITY
1. Linux Agent (w/ docker & aws cli)
2. Pulls code from Github
3. Builds docker image and tags it with version
4. Pushes image to the docker repository (AWS ECR in our case)
DEV PIPELINE
OCTOPUS DEPLOY
1. Create release
2. Uses semver to determine which image to use:โ€จ
e.g. Release 1.0.2 will target image at {repositoryurl}/api:v1.0.2โ€จ
Importantly, release 1.0.2.1 will also target {repositoryurl}/api:v1.0.2
3. Create or use a ELB if we need one
4. Create the task de๏ฌnition
5. Create the service
BIT DEMOโ€ฆ

More Related Content

PDF
Getting Started with Docker on AWS
PPTX
Containers on AWS
PDF
Docker Containers Deep Dive
PPTX
Using Terraform for AWS as the IaC tool
ย 
PPTX
Intro to docker and kubernetes
PDF
Kubernetes: An Introduction to the Open Source Container Orchestration Platform
PPTX
Kubernetes Introduction
PDF
AWS OpsWorksใฎใ”็ดนไป‹
Getting Started with Docker on AWS
Containers on AWS
Docker Containers Deep Dive
Using Terraform for AWS as the IaC tool
ย 
Intro to docker and kubernetes
Kubernetes: An Introduction to the Open Source Container Orchestration Platform
Kubernetes Introduction
AWS OpsWorksใฎใ”็ดนไป‹

What's hot (20)

PDF
Introduction of Kubernetes - Trang Nguyen
PDF
Kubernetes - introduction
PDF
[IDG Tech Webinar] โ€œํด๋ผ์šฐ๋“œ ๋น„์šฉ, ๋” ์•„๋‚„ ์ˆ˜ ์žˆ๋‹คโ€ ์‹ค์ „ ํด๋ผ์šฐ๋“œ ๋น„์šฉ ์ตœ์ ํ™” ๊ฐ€์ด๋“œ
PDF
Airbnb, From Monolith to Microservices: How to Scale Your Architecture, Futur...
PDF
Intro to containerization
PDF
Kubernetes scheduling and QoS
PDF
DevJam 2019 - Introduction to Kubernetes
PDF
์ปจํ…Œ์ด๋„ˆ (PaaS) ํ™˜๊ฒฝ์œผ๋กœ์˜ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ „ํ™˜ ๋ฐฉ๋ฒ•๊ณผ ๊ณ ๋ ค์‚ฌํ•ญ
PDF
Kubernetes 101
PPTX
Kubernetes fundamentals
PPTX
CI / CD ( ์ง€์†์ ์ธ ํ†ตํ•ฉ / ์ง€์†์ ์ธ ์ „๋‹ฌ ) ๋ฐœํ‘œ ์ž๋ฃŒ ๋‹ค์šด๋กœ๋“œ
PPTX
Containerization tutorial Containerization Explained
PPTX
Backstage at CNCF Madison.pptx
PPTX
Azure AKS
PPTX
Why to Cloud Native
PDF
Platform Engineering: Manage your infrastructure using Kubernetes and Crossplane
PDF
How Kubernetes helps Devops
PDF
What Is Kubernetes | Kubernetes Introduction | Kubernetes Tutorial For Beginn...
PDF
Introduction to kubernetes
PDF
Principles Of Chaos Engineering - Chaos Engineering Hamburg
Introduction of Kubernetes - Trang Nguyen
Kubernetes - introduction
[IDG Tech Webinar] โ€œํด๋ผ์šฐ๋“œ ๋น„์šฉ, ๋” ์•„๋‚„ ์ˆ˜ ์žˆ๋‹คโ€ ์‹ค์ „ ํด๋ผ์šฐ๋“œ ๋น„์šฉ ์ตœ์ ํ™” ๊ฐ€์ด๋“œ
Airbnb, From Monolith to Microservices: How to Scale Your Architecture, Futur...
Intro to containerization
Kubernetes scheduling and QoS
DevJam 2019 - Introduction to Kubernetes
์ปจํ…Œ์ด๋„ˆ (PaaS) ํ™˜๊ฒฝ์œผ๋กœ์˜ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ „ํ™˜ ๋ฐฉ๋ฒ•๊ณผ ๊ณ ๋ ค์‚ฌํ•ญ
Kubernetes 101
Kubernetes fundamentals
CI / CD ( ์ง€์†์ ์ธ ํ†ตํ•ฉ / ์ง€์†์ ์ธ ์ „๋‹ฌ ) ๋ฐœํ‘œ ์ž๋ฃŒ ๋‹ค์šด๋กœ๋“œ
Containerization tutorial Containerization Explained
Backstage at CNCF Madison.pptx
Azure AKS
Why to Cloud Native
Platform Engineering: Manage your infrastructure using Kubernetes and Crossplane
How Kubernetes helps Devops
What Is Kubernetes | Kubernetes Introduction | Kubernetes Tutorial For Beginn...
Introduction to kubernetes
Principles Of Chaos Engineering - Chaos Engineering Hamburg
Ad

Similar to ecs-presentation (19)

PDF
ECS & ECR Deep Dive - ๊น€๊ธฐ์™„ ์†”๋ฃจ์…˜์ฆˆ ์•„ํ‚คํ…ํŠธ :: AWS Container Day
PDF
Docker clusters on AWS with Amazon ECS and Kubernetes
PPTX
AWS ECS Meetup Talentica
PDF
Amazon EC2 container service
PPTX
AKS components
PDF
๋ฐ์ดํ„ฐ ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜ AWS์™€ ๊ฐ™์ดํ•˜๊ธฐ - ๊น€์ผํ˜ธ ์†”๋ฃจ์…˜์ฆˆ ์•„ํ‚คํ…ํŠธ:: AWS Cloud Track 3 Gaming
PDF
Amazon ECS (March 2016)
PPTX
Weaveworks at AWS re:Invent 2016: Operations Management with Amazon ECS
PDF
intro elastic container service amazon aws
PDF
Satrtup Bootcamp - Scale on AWS
PDF
Microservices: moving parts around
PPT
Scaling drupal horizontally and in cloud
PDF
Gianluca Arbezzano Wordpress: gestione delle installazioni e scalabilitร  con ...
PPTX
Continuous Deployment with Amazon Web Services by Carlos Conde
DOC
AWS.doc
PPTX
Dockerization of Azure Platform
PPTX
Building a Just-in-Time Application Stack for Analysts
PDF
AWSome day 2018 - scalability and cost optimization with container services
PPTX
Azure: Docker Container orchestration, PaaS ( Service Farbic ) and High avail...
ECS & ECR Deep Dive - ๊น€๊ธฐ์™„ ์†”๋ฃจ์…˜์ฆˆ ์•„ํ‚คํ…ํŠธ :: AWS Container Day
Docker clusters on AWS with Amazon ECS and Kubernetes
AWS ECS Meetup Talentica
Amazon EC2 container service
AKS components
๋ฐ์ดํ„ฐ ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜ AWS์™€ ๊ฐ™์ดํ•˜๊ธฐ - ๊น€์ผํ˜ธ ์†”๋ฃจ์…˜์ฆˆ ์•„ํ‚คํ…ํŠธ:: AWS Cloud Track 3 Gaming
Amazon ECS (March 2016)
Weaveworks at AWS re:Invent 2016: Operations Management with Amazon ECS
intro elastic container service amazon aws
Satrtup Bootcamp - Scale on AWS
Microservices: moving parts around
Scaling drupal horizontally and in cloud
Gianluca Arbezzano Wordpress: gestione delle installazioni e scalabilitร  con ...
Continuous Deployment with Amazon Web Services by Carlos Conde
AWS.doc
Dockerization of Azure Platform
Building a Just-in-Time Application Stack for Analysts
AWSome day 2018 - scalability and cost optimization with container services
Azure: Docker Container orchestration, PaaS ( Service Farbic ) and High avail...
Ad

ecs-presentation

  • 3. DOCKER DOCKER ISโ€ฆ โ–ธ Application virtualisation โ–ธ A container with everything your app needs โ–ธ code; runtime; tools; environment; OS โ–ธ Building, running and management of these containers
  • 4. DOCKER WHY DOCKER โ–ธ Empowers creativity โ–ธ isolation from platform, machine, language etc.. free developers from constraints โ–ธ No more โ€œworks on my machine :troll:โ€ โ–ธ Sharing is trivial (image repositories, docker hub etcโ€ฆ) โ–ธ Quick to scale โ–ธ Gives us a platform to pull out services today
  • 5. DOCKER HOW IT WORKS โ–ธ Each container shares the underlying host kernel (itโ€™s why they boot so quickly) โ–ธ Containers are to VMโ€™s what threads are to processes โ–ธ A container isnโ€™t really a VM, but you can treat it like one for the most part. HARDWARE HOST KERNEL DOCKER ENGINE GUEST OS GUEST OS BINS/LIBS BINS/LIBS APP A APP B
  • 7. DOCKER - RUNNING A CONTAINER > DOCKER RUN HELLO-WORLD
  • 8. DOCKER - RUNNING A CONTAINER > DOCKER RUN CENTOS
  • 10. DOCKER - DOCKERFILE DOCKERFILE FROM mhart/alpine-node:6.3.1 # Copy app to a directory called /app COPY . /app # Set the working dir to the newly created /app directory WORKDIR /app # Run npm install RUN npm install --production EXPOSE 1337 CMD ["node", "app.js"] tracking api - docker ๏ฌle
  • 12. DOCKER - REGISTRY EC2 CONTAINER REGISTRY (ECR) โ–ธ A repository for docker images โ–ธ AWSโ€™s version of Docker Hub
  • 14. ECS
  • 15. ECS ECS ISโ€ฆ โ–ธ Container orchestration, scheduling and networking โ–ธ Collections of de๏ฌned tasks running within a cluster โ–ธ AWSโ€™s answer to Kubernetes, Mesos, Fleet and Swarm
  • 16. ECS WHY ECS โ–ธ Cost - We only pay for the resources we use, much cheaper than beanstalk โ–ธ Flexibility - Horizontal scaling โ–ธ Good integration with AWS (duh) โ–ธ Ef๏ฌciency - Less idle and responsive to spikes (also see the point about cost) โ–ธ Quickness and ease of release (both new and existing containers)
  • 17. ECS WHY ECS โ–ธ Reliability - If a task dies, ECS will kill it and launch a new on within seconds. โ–ธ Smart updates - deterministic update policies โ–ธ Opens doorsโ€ฆ
  • 18. WHAT WE REALLY CARE ABOUT
  • 19. ECS - WHAT WE REALLY CARE ABOUT 3 PARTS โ–ธ Task De๏ฌnitions โ–ธ Services โ–ธ Load Balancers - application vs classic
  • 20. ECS - WHAT WE REALLY CARE ABOUT TASK DEFINITIONS Task de๏ฌnitions specify the container information for your application stack, such as how many containers are part of your task, what system resources they need, how they are linked together, which host ports they will use. TASK = MEMORY CPU ENVIRONMENT VARIABLES COMMANDS VOLUMES AND STORAGE DOCKER IMAGE(S)
  • 21. ECS - WHAT WE REALLY CARE ABOUT TASK DEFINITIONS โ€ฃ One or more containers
  • 22. ECS - WHAT WE REALLY CARE ABOUT TASK DEFINITIONS โ€ฃ Immutable - when a task is updated, it is classed as a revision
  • 23. ECS - WHAT WE REALLY CARE ABOUT SERVICES A service runs and maintains a โ€œdesired countโ€ of a task de๏ฌnition simultaneously in an ECS cluster.
  • 24. ECS - WHAT WE REALLY CARE ABOUT SERVICES โ–ธ If any task should fail or stop for any reason, the service scheduler launches another instance of your task de๏ฌnition to replace it and maintain the desired count of tasks in the service. โ–ธ Optionally runs the service behind a load balancer (important for apiโ€™s) โ–ธ Uses a speci๏ฌed minimum and maximum health percentage to determine update strategy.
  • 25. ECS - WHAT WE REALLY CARE ABOUT SERVICES If the minimum healthy percent is below 100%, the service scheduler can ignore the desiredCount temporarily during a deployment. For example, if your service has a desiredCount of four tasks, a minimum healthy percent of 50% allows the scheduler to stop two existing tasks before starting two new tasks. Deployment Configuration - minimum health
  • 26. ECS - WHAT WE REALLY CARE ABOUT SERVICES If a service has a desiredCount of four tasks, a maximumPercent value of 200% starts four new tasks before stopping the four older tasks (provided that the cluster resources required to do this are available). Deployment Configuration - maximum health
  • 28. ECS - UNDER THE HOOD AWS RESOURCES โ–ธ EC2 โ–ธ Auto Scaling Groups โ–ธ Launch Con๏ฌguration โ–ธ ELB โ–ธ IAM
  • 29. ECS - UNDER THE HOOD COMPUTE CLUSTER = ECS AGENT Amazon Linux x64 ECS AGENT Amazon Linux x64 AUTO SCALING GROUP Desired Count = 2
  • 30. ECS - UNDER THE HOOD LOAD BALANCERS - CLASSIC CLUSTER :80/:443 :80/:443 host port - 8000 host port - 9000 TASK INSTANCE TASK TASK INSTANCE TASK ATTACHED TO HOST PORT ON INSTANCE
  • 31. ECS - UNDER THE HOOD LOAD BALANCERS - APPLICATION CLUSTER :80/:443 :80/:443 TASK INSTANCE TASK TASK INSTANCE TASK MAPPED AT THE APPLICATION LEVEL Dynamic port Dynamic port
  • 33. DEV PIPELINE CREATE 1. Code 2. Docker๏ฌle 3. Git
  • 34. DEV PIPELINE TEAMCITY 1. Linux Agent (w/ docker & aws cli) 2. Pulls code from Github 3. Builds docker image and tags it with version 4. Pushes image to the docker repository (AWS ECR in our case)
  • 35. DEV PIPELINE OCTOPUS DEPLOY 1. Create release 2. Uses semver to determine which image to use:โ€จ e.g. Release 1.0.2 will target image at {repositoryurl}/api:v1.0.2โ€จ Importantly, release 1.0.2.1 will also target {repositoryurl}/api:v1.0.2 3. Create or use a ELB if we need one 4. Create the task de๏ฌnition 5. Create the service