aws august webinar series - running batch jobs on ecs

40
© 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Chris Barclay Principal Product Manager Running Batch Jobs on Amazon EC2 Container Service

Upload: amazon-web-services

Post on 16-Apr-2017

2.336 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: AWS August Webinar Series - Running Batch Jobs on ECS

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

Chris BarclayPrincipal Product Manager

Running Batch Jobs on Amazon EC2 Container Service

Page 2: AWS August Webinar Series - Running Batch Jobs on ECS

Agenda

Containers

EC2 Container Service

Common patterns

Demo

Q&A

Page 3: AWS August Webinar Series - Running Batch Jobs on ECS

Containers

Page 4: AWS August Webinar Series - Running Batch Jobs on ECS

What are Containers?

OS virtualization

Process isolation

Images

Automation Server

Guest OS

Bins/Libs Bins/Libs

App2App1

Page 5: AWS August Webinar Series - Running Batch Jobs on ECS

Container Advantages

PortableServer

Guest OS

Bins/Libs Bins/Libs

App2App1

Page 6: AWS August Webinar Series - Running Batch Jobs on ECS

Container Advantages

FlexibleServer

Guest OS

Bins/Libs Bins/Libs

App2App1

Page 7: AWS August Webinar Series - Running Batch Jobs on ECS

Container Advantages

FastServer

Guest OS

Bins/Libs Bins/Libs

App2App1

Page 8: AWS August Webinar Series - Running Batch Jobs on ECS

Container Advantages

EfficientServer

Guest OS

Bins/Libs Bins/Libs

App2App1

Page 9: AWS August Webinar Series - Running Batch Jobs on ECS

Server

Guest OS

Bins/Libs Bins/Libs

App2App1

Page 10: AWS August Webinar Series - Running Batch Jobs on ECS

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 11: AWS August Webinar Series - Running Batch Jobs on ECS

EC2 Container Service Benefits

Page 12: AWS August Webinar Series - Running Batch Jobs on ECS

Easily Manage Clusters for Any Scale

Nothing to run

Complete state

Control and monitoring

Scale

Page 13: AWS August Webinar Series - Running Batch Jobs on ECS

Flexible Container Placement

Applications

Batch jobs

Multiple schedulers

Page 14: AWS August Webinar Series - Running Batch Jobs on ECS

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 15: AWS August Webinar Series - Running Batch Jobs on ECS

Extensible

Comprehensive APIs

Open source agent

Custom schedulers

Page 16: AWS August Webinar Series - Running Batch Jobs on ECS

EC2 Container Service Terminology

Page 17: AWS August Webinar Series - Running Batch Jobs on ECS

Amazon EC2 instances

Docker daemon

Amazon ECS agent

Key Components: Container Instances

Page 18: AWS August Webinar Series - Running Batch Jobs on ECS

Regional

Resource pool

Grouping of Container Instances

Start empty, dynamically scalable

Key Components: Clusters

Page 19: AWS August Webinar Series - Running Batch Jobs on ECS

Key Components: Task Definitions

Volume Definitions

Container Definitions

Page 20: AWS August Webinar Series - Running Batch Jobs on ECS

Key Components: Task Definitions

Shared Data Volume

PHP App Time of day App

Page 21: AWS August Webinar Series - Running Batch Jobs on ECS

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 22: AWS August Webinar Series - Running Batch Jobs on ECS

{ "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 containerto port 80 on host

10 CPU Units (1024 is full CPU),500 Megabytes of Memory

Page 23: AWS August Webinar Series - Running Batch Jobs on ECS

{ "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 24: AWS August Webinar Series - Running Batch Jobs on ECS

Key Components: Tasks

Container Instance

Schedule

Shared Data Volume

PHP App Time of day App

Shared Data Volume

PHP App Time of day App

Page 25: AWS August Webinar Series - Running Batch Jobs on ECS

Unit of work

Grouping of related Containers

Run on Container Instances

Key Components: Tasks

Page 26: AWS August Webinar Series - Running Batch Jobs on ECS

Key Components: Run a Task

Good for short-lived containers, e.g.

batch jobs

Page 27: AWS August Webinar Series - Running Batch Jobs on ECS

Key Components: Create a Service

Good for long-running applications

and services

Page 28: AWS August Webinar Series - Running Batch Jobs on ECS

Key Components: Create Service

Load Balance traffic across containersAutomatically recover unhealthy containersDiscover 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 29: AWS August Webinar Series - Running Batch Jobs on ECS

Key Components: Update Service

Scale upScale 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 30: AWS August Webinar Series - Running Batch Jobs on ECS

Key Components: Update Service

Deploy new versionDrain 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 31: AWS August Webinar Series - Running Batch Jobs on ECS

Key Components: Update Service

Deploy new versionDrain 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 32: AWS August Webinar Series - Running Batch Jobs on ECS

Key Components: Update Service

Deploy new versionDrain 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 33: AWS August Webinar Series - Running Batch Jobs on ECS

Batch jobs

Page 34: AWS August Webinar Series - Running Batch Jobs on ECS

Containers and Batch Jobs

Easy to update

Any app, any language

Includes all dependencies

Image is the version

Test & deploy same artifact

Page 35: AWS August Webinar Series - Running Batch Jobs on ECS

When to Use ECS and Lambda

ECSLong-running jobs

Manage your event triggering

Any language, any dependency

Resources are your own - use

Spot, RIs

LambdaShort-lived jobs

Triggered on specific events

Supports specific environments

No infrastructure to manage

Page 36: AWS August Webinar Series - Running Batch Jobs on ECS

Demo: Batch Jobs with ECS

.zip

s3://bucket/scene.zip

ecs:RunTask

ECS Cluster

.png

Page 37: AWS August Webinar Series - Running Batch Jobs on ECS

Demo

Page 38: AWS August Webinar Series - Running Batch Jobs on ECS

Q&A

Page 39: AWS August Webinar Series - Running Batch Jobs on ECS

AWS re:Invent 2015 – October 6-9AWS re:Invent is the largest annual gathering of the global cloud community. Whether you are an existing customer or new to the cloud, AWS re:Invent will provide you with the knowledge and skills to refine your cloud strategy, improve developer productivity, increase application performance and security, and reduce infrastructure costs.

Though AWS re:Invent tickets are sold out, you can still register to view the Live Stream Broadcasts of the keynote addresses and select technical sessions on October 7 and October 8. Register now.

Details:Wednesday, October 79:00am - 10:30am PT: Andrew Jassy, Sr. Vice President, AWS11:00am - 5:15pm PT: 5 of the most popular breakout sessions (to be announced)

Thursday, October 89:00am - 10:30am PT: Dr. Werner Vogels, CTO, Amazon11:00am - 6:15pm PT: 6 of the most popular breakout sessions (to be announced)

Register now for the Live Stream Broadcast by submitting your email where prompted on the AWS re:Invent home page.

Stay Connected: Follow event activities on Twitter @awsreinvent (#reinvent), or like us on Facebook.

Page 40: AWS August Webinar Series - Running Batch Jobs on ECS

Thank you!