amazon ec2 container service: manage docker-enabled apps in ec2

48
©2015, Amazon Web Services, Inc. or its affiliates. All rights reserved Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2 Chris Barclay Amazon EC2 Principal Product Manager, AWS

Upload: amazon-web-services

Post on 18-Jul-2015

1.226 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

©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

Page 2: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Agenda

Containers

EC2 Container Service

Common patterns

Demo

Q&A

Page 3: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Containers

Page 4: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

What are containers?

OS virtualization

Process isolation

Automation

ImagesServer

Guest OS

Bins/Libs Bins/Libs

App2App1

Page 5: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Container advantages

Portable

Server

Guest OS

Bins/Libs Bins/Libs

App2App1

Page 6: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Container advantages

Flexible

Server

Guest OS

Bins/Libs Bins/Libs

App2App1

Page 7: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Container advantages

Fast

Server

Guest OS

Bins/Libs Bins/Libs

App2App1

Page 8: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Container advantages

Efficient

Server

Guest OS

Bins/Libs Bins/Libs

App2App1

Page 9: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

A container pipeline

IT Operations

Base

Image

PatchesUtilities

Page 10: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

A container pipeline

IT Operations

Base

Image

PatchesUtilities

Ruby

Redis

Logger

Page 11: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

A container pipeline

IT Operations Developer

Base

Image

PatchesUtilities

Ruby

Redis

Logger

App

Page 12: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

A container pipeline

Base

Image

PatchesUtilities

Ruby

Redis

Logger

App

IT Operations Developer

Page 13: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Demo

Page 14: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Server

Guest OS

Bins/Libs Bins/Libs

App2App1

Page 15: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2
Page 16: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

EC2 Container Service Benefits

Page 17: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Easily manage clusters for any scale

Nothing to run

Complete state

Control and monitoring

Scale

Page 18: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Flexible container placement

Applications

Batch jobs

Multiple schedulers

Page 19: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

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

Page 20: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Extensible

Comprehensive APIs

Open source agent

Custom schedulers

Page 21: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Common Patterns

Page 22: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Pattern 1: services and applications

Simple to model

Decompose to smaller (micro) services

Blue/green deployments

Page 23: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Pattern 2: batch jobs

Share pools of resources

APIs provide cluster state

Auto Scaling, Spot, Reserved Instances

Page 24: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

EC2 Container Service Terminology

Page 25: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Amazon EC2 instances

Docker daemon

Amazon ECS agent

Key components: container instances

Page 26: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Regional

Resource pool

Grouping of container instances

Start empty, dynamically scalable

Key components: clusters

Page 27: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Key components: task definitions

Volume Definitions

Container Definitions

Page 28: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Key components: task definitions

Shared Data Volume

PHP App Time of day App

Page 29: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

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

Page 30: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

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

}

Page 31: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

{

"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

Page 32: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

{

"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

Page 33: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Unit of work

Grouping of related containers

Run on container instances

Key components: tasks

Page 34: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Key components: run a task

Good for short-lived

containers, for

example batch jobs

Page 35: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Key components: create a service

Good for long-

running applications

and services

Page 36: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

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

Page 37: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

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

Page 38: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

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

Page 39: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

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

Page 40: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

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

Page 41: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Demo

Page 42: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Typical user workflow

I want to run a service

Page 43: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Typical user workflow

Run Instances Amazon

EC2

Use custom AMI with

Docker support and

ECS Agent. Instances

will register with

default cluster.

Page 44: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Typical user workflow

Create Task Definition

Declare resource

requirements for

containers

Shared Data Volume

PHP AppTime of day

App

Page 45: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Typical user workflow

Create Service

Declare resource

requirements for

service

Shared Data Volume

PHP AppTime of day

App

Elastic

Load

Balancing

X 5

Page 46: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Typical user workflow

Describe Service

Page 47: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

Q&A

Page 48: Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2

SAN FRANCISCO