amazon ec2 container service: manage docker-enabled apps in ec2
TRANSCRIPT
©2015, Amazon Web Services, Inc. or its affiliates. All rights reserved
Amazon EC2 Container Service:
Manage Docker-Enabled Apps in EC2Chris Barclay
Amazon EC2 Principal Product Manager, AWS
Agenda
Containers
EC2 Container Service
Common patterns
Demo
Q&A
Containers
What are containers?
OS virtualization
Process isolation
Automation
ImagesServer
Guest OS
Bins/Libs Bins/Libs
App2App1
Container advantages
Portable
Server
Guest OS
Bins/Libs Bins/Libs
App2App1
Container advantages
Flexible
Server
Guest OS
Bins/Libs Bins/Libs
App2App1
Container advantages
Fast
Server
Guest OS
Bins/Libs Bins/Libs
App2App1
Container advantages
Efficient
Server
Guest OS
Bins/Libs Bins/Libs
App2App1
A container pipeline
IT Operations
Base
Image
PatchesUtilities
A container pipeline
IT Operations
Base
Image
PatchesUtilities
Ruby
Redis
Logger
A container pipeline
IT Operations Developer
Base
Image
PatchesUtilities
Ruby
Redis
Logger
App
A container pipeline
Base
Image
PatchesUtilities
Ruby
Redis
Logger
App
IT Operations Developer
Demo
Server
Guest OS
Bins/Libs Bins/Libs
App2App1
EC2 Container Service Benefits
Easily manage clusters for any scale
Nothing to run
Complete state
Control and monitoring
Scale
Flexible container placement
Applications
Batch jobs
Multiple schedulers
Designed for use with other AWS services
Elastic Load Balancing
Amazon Elastic Block Store
Amazon Virtual Private Cloud
AWS Identity and Access Management
AWS CloudTrail
Extensible
Comprehensive APIs
Open source agent
Custom schedulers
Common Patterns
Pattern 1: services and applications
Simple to model
Decompose to smaller (micro) services
Blue/green deployments
Pattern 2: batch jobs
Share pools of resources
APIs provide cluster state
Auto Scaling, Spot, Reserved Instances
EC2 Container Service Terminology
Amazon EC2 instances
Docker daemon
Amazon ECS agent
Key components: container instances
Regional
Resource pool
Grouping of container instances
Start empty, dynamically scalable
Key components: clusters
Key components: task definitions
Volume Definitions
Container Definitions
Key components: task definitions
Shared Data Volume
PHP App Time of day App
Key components: task definitions
Container
Instance
Schedule
Shared Data Volume
PHP App Time of day App
Shared Data Volume
PHP
App
Time of
day
App
Key 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
}
{
"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[
{
"image": "mysql",
"name": "db",
"cpu": 10,
"memory": 500,
"essential": true,
"entryPoint": [
"/entrypoint.sh"
],
"environment": [
{
"name": "MYSQL_ROOT_PASSWORD",
"value": "pass"
}
],
"portMappings": []
}
]
Essential to our task
Create and mount volumes
Expose port 80 in container
to port 80 on host
10 CPU units (1024 is full CPU),
500 megabytes of memory
{
"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 other container
Command to exec
Unit of work
Grouping of related containers
Run on container instances
Key components: tasks
Key components: run a task
Good for short-lived
containers, for
example batch jobs
Key components: create a service
Good for long-
running applications
and services
Key components: create a service
Load balance traffic across containers
Automatically recover unhealthy containers
Discover services
Shared Data Volume
PHP
App
Time of
day
App
Shared Data Volume
PHP
App
Time of
day
App
Shared Data Volume
PHP
App
Time of
day
App
Elastic Load Balancing
Key components: create a service
Scale up or scale down
Elastic Load Balancing
Shared Data Volume
PHP
App
Time of
day
App
Shared Data Volume
PHP
App
Time of
day
App
Shared Data Volume
PHP
App
Time of
day
App
Shared Data Volume
PHP
App
Time of
day
App
Key components: create a service
Deploy new version
Elastic Load Balancing
Shared Data Volume
PHP
App
Time of
day
App
Shared Data Volume
PHP
App
Time of
day
App
Shared Data Volume
PHP
App
Time of
day
App
Key components: create a service
Deploy new version
Shared Data Volume
PHP
App
Time of
day
App
Shared Data Volume
PHP
App
Time of
day
App
Shared Data Volume
PHP
App
Time of
day
App
Elastic Load Balancing
Key components: create a service
Deploy new version
Shared Data Volume
PHP
App
Time of
day
App
Shared Data Volume
PHP
App
Time of
day
App
Elastic Load Balancing
Shared Data Volume
PHP
App
Time of
day
App
Demo
Typical user workflow
I want to run a service
Typical user workflow
Run Instances Amazon
EC2
Use custom AMI with
Docker support and
ECS Agent. Instances
will register with
default cluster.
Typical user workflow
Create Task Definition
Declare resource
requirements for
containers
Shared Data Volume
PHP AppTime of day
App
Typical user workflow
Create Service
Declare resource
requirements for
service
Shared Data Volume
PHP AppTime of day
App
Elastic
Load
Balancing
X 5
Typical user workflow
Describe Service
Q&A
SAN FRANCISCO