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

49
©2015, Amazon Web Services, Inc. or its affiliates. All rights reserved Amazon EC2 Container Service: Manage Docker-Enabled Apps in Amazon EC2 Brandon Chavis Solutions Architect

Upload: amazon-web-services

Post on 14-Aug-2015

840 views

Category:

Technology


0 download

TRANSCRIPT

©2015, Amazon Web Services, Inc. or its affiliates. All rights reserved

Amazon EC2 Container Service: Manage

Docker-Enabled Apps in Amazon EC2Brandon Chavis

Solutions Architect

Agenda

• Containers

• Amazon EC2 Container Service

• Common patterns

• Demo

• Q&A

Containers

What are containers?

• OS virtualization

• Process isolation

• Images

• Automation Server

Guest OS

Bins/Libs Bins/Libs

App2App1

Container advantages

PortableServer

Guest OS

Bins/Libs Bins/Libs

App2App1

Container advantages

FlexibleServer

Guest OS

Bins/Libs Bins/Libs

App2App1

Container advantages

FastServer

Guest OS

Bins/Libs Bins/Libs

App2App1

Container advantages

EfficientServer

Guest OS

Bins/Libs Bins/Libs

App2App1

A container pipeline

Base

image

Patches

IT Operations

Utilities

A container pipeline

Base

image

Patches

IT Operations

Ruby

Redis

Logger

Utilities

A container pipeline

Base

image

Patches

IT Operations Developer

Ruby

Redis

Logger

Utilities

App

A container pipeline

Base

image

Patches

IT Operations Developer

Ruby

Redis

Logger

Utilities

App

Demo

Server

Guest OS

Bins/Libs Bins/Libs

App2App1

Amazon ECS 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 (IAM)

• AWS CloudTrail

Extensible

• Comprehensive APIs

• Open source agent

• Custom schedulers

Common Patterns

Pattern 1: Services and applications

• Simple to model

• Micro services

• Blue/green

deployments

Phong Nguyen, Founder at Gilt

Groupe, said, "As we Dockerize

all our services, it is very

important for us to have a

platform that can help us speed

up deployments, automate our

services, and gain greater

efficiencies. The new service

scheduler and ELB integration

make Amazon ECS an excellent

platform for our services.”

Pattern 2: Batch jobs

• Share resource pools

• Ideal for bursty jobs

• Spot instances

“We required a solution on which

we could securely and efficiently

deploy Docker containers to

encapsulate learner

programming assignment

submissions,” said Brennan

Saeta, Architect at Coursera. “We

are using Amazon EC2 Container

Service to power our new

programming assignments

infrastructure for next-generation

On-Demand course platform.”

Amazon ECS 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 appTime 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

Key components: tasks

Container

Instance

Schedule

Shared data volume

PHP appTime of day

app

Unit of work

Grouping of related containers

Run on container instances

Key Components: tasks

Key Components: Run a task

Good for short-lived

containers, e.g.

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

Elastic Load Balancing

Key components: Update a service

• Scale up

• Scale down

Elastic Load Balancing

Key components: Update a service

• Deploy a new version

• Drain connections

Elastic Load Balancing

Key components: Update a service

• Deploy a new version

• Drain connections

Elastic Load Balancing

Key components: Update a service

• Deploy a new version

• Drain connections

Elastic Load Balancing

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 register

with default cluster.

Typical user workflow

Create Task Definition

Declare resource

requirements for

containers

Typical user workflow

Create Service

Declare resource

requirements for

service

X 5

Elastic Load Balancing

Typical user workflow

Describe Service

Demo

Q&A

Your Feedback is Important to AWSPlease complete the session evaluation. Tell us what you think!

NEW YORK