Top Banner
©2015, Amazon Web Services, Inc. or its affiliates. All rights reserved Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2 Chris Barclay Principal Product Manager
47
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

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

Amazon EC2 Container Service:

Manage Docker-Enabled Apps in EC2Chris Barclay

Principal Product Manager

Page 2: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Agenda

Containers

EC2 Container Service

Common patterns

Demo

Q&A

Page 3: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Containers

Page 4: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

What are containers?

OS virtualization

Process isolation

Images

Automation Server

Guest OS

Bins/Libs Bins/Libs

App2App1

Page 5: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Container advantages

Portable

Server

Guest OS

Bins/Libs Bins/Libs

App2App1

Page 6: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Container advantages

Flexible

Server

Guest OS

Bins/Libs Bins/Libs

App2App1

Page 7: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Container advantages

Fast

Server

Guest OS

Bins/Libs Bins/Libs

App2App1

Page 8: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Container advantages

Efficient

Server

Guest OS

Bins/Libs Bins/Libs

App2App1

Page 9: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

A container pipeline

IT Operations

Base

Image

PatchesUtilities

Page 10: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

A container pipeline

IT Operations

Base

Image

PatchesUtilities

Ruby

Redis

Logger

Page 11: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

A container pipeline

IT Operations Developer

Base

Image

PatchesUtilities

Ruby

Redis

Logger

App

Page 12: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

A container pipeline

IT Operations Developer

Base

Image

PatchesUtilities

Ruby

Redis

Logger

App

Page 13: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Demo

Page 14: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Server

Guest OS

Bins/Libs Bins/Libs

App2App1

Page 15: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Page 16: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

EC2 Container Service Benefits

Page 17: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Easily Manage Clusters for Any Scale

Nothing to run

Complete state

Control and monitoring

Scale

Page 18: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Flexible Container Placement

Applications

Batch jobs

Multiple schedulers

Page 19: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

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: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Extensible

Comprehensive APIs

Open source agent

Custom schedulers

Page 21: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Common Patterns

Page 22: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

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.”

Page 23: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

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.”

Page 24: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

EC2 Container Service Terminology

Page 25: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Amazon EC2 instances

Docker daemon

Amazon ECS agent

Key Components: Container Instances

Page 26: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Regional

Resource pool

Grouping of Container Instances

Start empty, dynamically scalable

Key Components: Clusters

Page 27: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Key Components: Task Definitions

Volume Definitions

Container Definitions

Page 28: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Key Components: Task Definitions

Shared Data Volume

PHP App Time of day App

Page 29: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

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 30: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

{

"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

},

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 31: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

{

"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 32: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Key Components: Tasks

Container

Instance

Schedule

Shared Data Volume

PHP App Time of day App

Shared Data Volume

PHP AppTime of

day App

Page 33: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Unit of work

Grouping of related Containers

Run on Container Instances

Key Components: Tasks

Page 34: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Key Components: Run a task

Good for short-lived

containers, e.g.

batch jobs

Page 35: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Key Components: Create a Service

Good for long-

running applications

and services

Page 36: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Key Components: Create 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: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Key Components: Update Service

Scale up

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: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Key Components: Update Service

Deploy new version

Drain connections

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: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Key Components: Update Service

Deploy new version

Drain connections

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: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Key Components: Update Service

Deploy new version

Drain connections

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: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Demo

Page 42: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Typical user workflow

I want to run a service

Page 43: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Typical user workflow

Run Instances Amazon

EC2

Use custom AMI with

Docker support and

ECS Agent. Instances

will register with

default cluster.

Page 44: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Typical user workflow

Create Task Definition

Declare resource

requirements for

containers

Shared Data Volume

PHP AppTime of day

App

Page 45: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

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: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

Typical user workflow

Describe Service

Page 47: AWS April Webinar Series - Getting Started with Amazon EC2 Container Service

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

Q&A