making sense out of amazon ec2 container service
Post on 22-Jan-2018
427 Views
Preview:
TRANSCRIPT
MAKING SENSE OUT OF AMAZON ECS
Swapnil DahiphaleDevOps Engineer
13 Feb 2016, DevOps Meetup Banglore
WhiteHedge
2
INTRODUCTION - HELLO
Hello! Welcome to WhiteHedge
WhiteHedge is an Agile Software Product Development company. But what reallydescribes us is what we think about Our Work , Our Clients.
We have deep experience in some of the most sought-after technology domains in theindustry today: Mobile Development, Big Data Analytics, Cloud Computing, andDevOps. Having deep knowledge in these domains make us stand out as the best andthe coolest provider of services. Our DevOps will bring you a single team that workstogether with continuous development, continuous testing, continuous deployments,logging, monitoring and security.
WhiteHedge
3
WHITEHEDGE - AN OVERVIEW
Global Presence
Agile + Flexible
Thorough + Quick Learner
Competitive + Comprehensive
Honest + Transparent
Young + Mature
Innovative + Creative
More about us …What defines us ?
California
New Jersey Rotterdam
Pune
Envision Products |
Convert into businesses
100+ employees | 50+ live
products world-wide
The best of the Talent and
InfrastructureStarted 2003 | Focused Agile
Product Development
Self funded | Well funded |
Profitable
WhiteHedge
4
TABLE OF CONTENTS - OUR AGENDA
Containers
1
Use case
2
Orchestration
3
Introduction to ECS
4
Key Components
6
Architecture
7
Overview of Build Process
8
Why ECS?
5
CONTAINERS
WhiteHedgeWHAT ARE CONTAINERS?
OS virtualization
Process isolation
Images
Automation
Bins/Libs
Docker Engine
Bins/Libs
App2App1
Host OS
Server
Guest OS
Hypervisor
Guest OS
Bins/LibsBin/Libs
Host OS
Server
App1 App2 Container 1 Container 2
VM 1 VM 2
WhiteHedge
“auto mat es the deployment of anyapplicat ion as a lightweight, portable,self-sufficient container that will runvirtually anywhere”
CONTAINERS
USE CASE
WhiteHedgeUSE CASE
A highly available RESTful API server which fetchesdata from third-party services and serves its clients.
WhiteHedgeARCHITECTURE
WhiteHedgeCONTINUOUS DELIVERY WITH JENKINS
Build Image
Push Image
CodeDeploy
WhiteHedgeTHE PROBLEM
• A large monolithic application that was difficult to run, deploy, and scale.
• We were deploying a single docker container to run multiple processes.
• Docker was monitored and we were redeploying docker instance if the docker instance runs into problems.
• We used to evaluate capacity of EC2 instance manually and are running one container per instance
WhiteHedgeTHE CHALLENGE
• Use microservices architecture using docker
• Orchestration of dockers
• Replicate infrastructure to many regions
ORCHESTRATION
WhiteHedgeORCHESTRATION
Bins/Libs
Docker Engine
App1
Host OS
Server
Bins/Libs
App2
WhiteHedgeORCHESTRATION
Docker Engine
Host OS
Server
Docker Engine
Host OS
Server
Docker Engine
Host OS
Server
Docker Engine
Host OS
Server
Docker Engine
Host OS
Server
Docker Engine
Host OS
Server
Docker Engine
Host OS
Server
Docker Engine
Host OS
Server
Docker Engine
Host OS
Server
Docker Engine
Host OS
Server
Docker Engine
Host OS
Server
Docker Engine
Host OS
Server
Docker Engine
Host OS
Server
Docker Engine
Host OS
Server
Docker Engine
Host OS
Server
Docker Engine
Host OS
Server
Docker Engine
Host OS
Server
Docker Engine
Host OS
Server
Docker Engine
Host OS
Server
Docker Engine
Host OS
Server
Docker Engine
Host OS
Server
Docker Engine
Host OS
Server
Docker Engine
Host OS
Server
Docker Engine
Host OS
Server
Why EC2 Container Service?
WhiteHedgeWHY ECS?
• It is a managed service!
•Easy to integrate with other AWS services
• It is great for storing and enforcing task state
•Designed with custom schedulers in mind
•The agent code is available on a public GitHub repo and … it is in GO!
WhiteHedgeWHAT ELSE DID WE LOOK AT?
Home-grown Tech
Tried, but proved to be unreliable
Difficult to handle coordination and synchronization
Powerful but hard to productionize
Needs developers with Experience
Not a managed service, higher Opsload
“Amazon ECS enabled us to focus on releasing new software rather than spending time managing clusters”
Introduction to ECS
WhiteHedge
“a highly scalable, high performance containermanagement service that supports docker containersand allows you to easily run and manage Docker-enabled applications across cluster of EC2 instances”
WHAT IS ECS?
WhiteHedgeWHAT IS ECS?
• Building Block Service
• Easily Manage Clusters for Any ScaleNothing to runComplete stateControl and monitoringScale
• Flexible Container Placement• Designed for use with other AWS services• Secure• Extensible - Comprehensive APIs
WhiteHedgeKEY COMPONENTS
Container Instances
Clusters
Tasks
Run a task
Create a service
WhiteHedgeKEY COMPONENTS
• Amazon EC2 Instances
• Docker daemon
• Amazon ECS agent
Container Instances
Clusters
Tasks
Run a task
Create a service
WhiteHedgeKEY COMPONENTS
• Grouping of Container
Instances
• Resource pool
• Regional
• Start empty, dynamically
scalable
Container Instances
Clusters
Tasks
Run a task
Create a service
WhiteHedgeKEY COMPONENTS
• Unit of work
• Grouping of related
Containers
• Run on Container Instances
Container Instances
Clusters
Tasks
Run a task
Create a service
WhiteHedgeKEY COMPONENTS: TASK DEFINITIONS
{"environment": [],"name": "simple-demo","image": "my-demo", "cpu": 10,"memory": 500, "portMappings": [
{"containerPort": 80,"hostPort": 80
}],"mountPoints": [
{"sourceVolume": "my-vol", "containerPath":"/var/www/my-
vol"}
],"entryPoint": [
"/usr/sbin/apache2", "-D","FOREGROUND"
],"essential": true
},
{"name": "busybox","image":"busybox", "cpu": 10,"memory": 500, "volumesFrom": [{"sourceContainer": "simple-demo"}],"entryPoint"
: [ "sh","-c"
],"command": [
"/bin/sh -c \"while true; do/bin/date > /var/www/my-vol/date; sleep 1;done\""
],"essential": false
}
WhiteHedge
{"environment": [],"name": "simple-demo","image": "amazon/amazon-ecs-sample", "cpu": 10,"memory": 500, "portMappings":[
{"containerPort": 80,"hostPort": 80
}],"mountPoints": [
{"sourceVolume": "my-vol", "containerPath":"/var/www/my-
vol"}
],"entryPoint": [
"/usr/sbin/apache2", "-D","FOREGROUND"
],"essential": true
},
KEY COMPONENTS: TASK DEFINITIONS
Essential to ourtask
10 CPU units (1024 is full CPU), 500 megabytes ofmemory
Expose port 80 in containerto port 80 on host
Create and mount volumes
WhiteHedge
{"name": "busybox","image":"busybox", "cpu": 10,"memory": 500, "volumesFrom": [{"sourceContainer": "simple-demo"}],"entryPoint"
: [ "sh","-c"
],"command": [
"/bin/sh -c \"while true; do/bin/date > /var/www/my-vol/date; sleep 1;done\""
],"essential": false
}
KEY COMPONENTS: TASK DEFINITIONS
[{
"image": "tutum/wordpress-stackable", "name": "wordpress","cpu": 10,"memory": 500,"essential": true, "links": [
"db"],"entryPoint": [
"/bin/sh","-c"
],"environment": [
…],"portMappings": [
{"containerPort": 80,"hostPort": 80
}]
},]
From Docker Hub
Mount volume from othercontainer
Command toexec
WhiteHedgeKEY COMPONENTS
Good for short-lived containers,
e.g. batch jobs
Container Instances
Clusters
Tasks
Run a task
Create a service
WhiteHedgeKEY COMPONENTS
Good for long-running
applications and services
Container Instances
Clusters
Tasks
Run a task
Create a service
Typical user workflow
WhiteHedgeTYPICAL USER WORKFLOW
I want to run aservice
WhiteHedgeTYPICAL USER WORKFLOW
Run Instances AmazonEC2
Use custom AMI with Docker support and ECS Agent. Instances will register with default cluster.
WhiteHedgeTYPICAL USER WORKFLOW
Create Task Definition
Declare resourcerequirements forcontainers
Shared DataVolume
Node.jsApp Time of day App
WhiteHedgeTYPICAL USER WORKFLOW
Create Service
Declare resourcerequirements forservice
Shared DataVolume
Node.jsApp Time of day App
Elastic Load
Balancing
X 3
WhiteHedgeTYPICAL USER WORKFLOW
Describe Service
Architecture with ECS
WhiteHedgeARCHITECTURE
WhiteHedgeCONTINUOUS DELIVERY WITH JENKINS
Build Image
Push Image
Update ECS service
WhiteHedge
Features Without ECS Using ECS
High availability If any of the container dies, we
have to redeploy on all servers.
Restarts that container itself.
(Its a cluster management
system so it will always be in
desired state)
Managing number of
containers on a given EC2
instance
It will be complicated to run
and manage multiple
containers effectively.
Can manage multiple
containers.
Deployment method Handle deployments using
various methods.
(CodeDeploy, chef etc.)
ECS manages deployment of
new revision.
COMPARISON OF ARCHITECTURES
WhiteHedge
42
FOLLOW US
Questions?
http://www.whitehedge.com/devops.html
Swapnil Dahiphaledevops@whitehedge.com
- SOCIAL NETWORKS / PHONE
THANK YOU!Have a Nice Day!
Swapnil Dahiphale
@Swapnil2233
sdahiphale@whitehedge.com
top related