new launch! advanced task scheduling with amazon ecs and blox

46
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Dickson Yue Solutions Architect NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox January 19, 2017

Upload: amazon-web-services

Post on 15-Feb-2017

27 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

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

Dickson YueSolutions Architect

NEW LAUNCH! Advanced Task Scheduling with

Amazon ECS and Blox

January 19, 2017

Page 2: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

What is Amazon ECS?

Scalable Container Management

Flexible ContainerPlacement

AWS Platform Integration Extensible by Design

Page 3: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Amazon ECS: Under the Hood

ALB ALB

AZ 1 AZ 2

user / scheduler

Scheduler

Cluster State Service

Placement Engine

Event Stream

Page 4: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Task Placement Engine

Page 5: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Typical User Workflow

Create Task Definition Amazon ECS

Task Definition- Docker Image(s)- CPU, memory- Port mapping- CMD, ENV

> aws ecs register-task-definition --cli-input-json file://ecs-task.json

Page 6: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Task

{ "family": "kata-demo-task", "containerDefinitions": [ { "name": "ecs-demo", "image": "dicksonyue/aws-voting-app:alpha", "cpu": 10, "memory": 500, "portMappings": [{ "containerPort": 8080 }], "essential": true, "command": [ "npm", "start"], "environment" : [ { "name" : "REDIS_HOST", "value" : "ecs-demo.cw7bo2.0001.usw2.cache.amazonaws.com" }, { "name" : "REDIS_PORT", "value" : "6379" } ] }

]}

Resources

Docker image

CMD, ENV

Page 7: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

New Placement Constraints & Attributes

Name Example

AMI ID attribute:ecs.ami-id == ami-eca289fb

Availability Zone attribute:ecs.availability-zone == us-east-1a

Instance Type attribute:ecs.instance-type == t2.small

Distinct Instances type=“distinctInstance”

Custom attribute:stack == prod

Page 8: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Anatomy of Task Placement

Cluster Constraints

Custom Constraints

Placement Strategies

Apply Filter

Satisfy CPU, memory, and port requirements

Filter for location, instance-type, AMI, or custom attribute constraints

Identify instances that meet spread or binpack placement strategy

Select final container instances for placement

Page 9: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Supported Placement Strategies

Binpacking Spread Affinity Distinct Instance

Page 10: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Placement Strategy Chaining

Spread tasks across Zonesand Binpack within each Zone

Page 11: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

New Cluster Query Language

Page 12: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Filtering: Match on Instance Family or Type

Page 13: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Filtering: Match on Multiple Expressions

Page 14: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Filtering: Match on Custom Attributes

Page 15: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Task Placement Examples

Page 16: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

g2.2xlarge t2.small g2.2xlarge g2.2xlarge

Placement: Targeting Instance Type

Page 17: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

g2.2xlarge t2.small t2.micro t2.medium

t2.medium t2.small g2.2xlarge

t2.small

t2.small t2.medium

us-east-1aus-east-1d

Placement: Targeting Instance Type & Zone

Page 18: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

g2.2xlarge t2.small t2.micro t2.medium

t2.medium t2.small g2.2xlarge t2.small

us-east-1aus-east-1d

g2.2xlarge t2.medium

t2.micro t2.small

us-east-1c

Placement: Availability Zone Spread

Page 19: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

g2.2xlarge t2.small t2.micro t2.medium

t2.medium t2.small g2.2xlarge t2.small

us-east-1aus-east-1d

g2.2xlarge t2.medium

t2.micro t2.small

us-east-1c

Placement: Spread across Zone and Binpack

Page 20: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

g2.2xlarge t2.small t2.micro t2.medium

t2.medium t2.small g2.2xlarge t2.small

us-east-1aus-east-1d

g2.2xlarge t2.medium

t2.micro t2.small

us-east-1c

Placement: Affinity and Anti-Affinity

Page 21: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Running a Service

Page 22: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

t2.medium t2.small t2.small

us-east-1aus-east-1d

t2.medium t2.micro t2.small

us-east-1c

Placement: Multiple Services on a Cluster

Page 23: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

t2.medium g2.2xlarge t2.micro t2.small

t2.small t2.small g2.2xlarge t2.small

t2.small t2.small

g2.2xlarge t2.small

Placement: Services – Distinct Instances

Page 24: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Console: Getting Started with Placement

Page 25: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Console: Placement Templates to Get Started

Page 26: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Console: Customizing Placement Strategies

Page 27: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Live Demo

Page 28: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Event Stream

Page 29: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Consuming Real-time Events

Page 30: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Three Steps to Getting Started with Events

Step 1: Create CWE Rule Step 2: Create SNS Topic Step 3: Put Events to SNS

Page 31: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Consuming Events for Service Discovery

app1-tst 10.1.0.11db1-tst 10.1.0.14app2 10.1.0.16db2 10.1.0.18my-app 10.1.0.20

websrv1 10.1.0.1websrv2 10.1.0.2websrv3 10.1.0.4app-dev1 10.1.0.9app-dev2 10.1.0.5app-dev3 10.1.0.8

db-dev 10.1.0.19

Page 32: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Introducing Blox

Page 33: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

What is Blox?

Choice

Control

Developer Experience

Page 34: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Building with Blox

scheduler cluster state service

Page 35: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Set Up Blox LocallyStep 1: git clone https://github.com/blox/blox.git

Step 3: docker-compose up -d

Step 4: start using Blox locally

Step 2: deploy CloudFormation template to configure ECS event stream and SQS queue

Page 36: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Swagger Spec: Cluster State Service

Page 37: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Swagger Spec: Daemon Scheduler

Page 38: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Daemon Scheduler

Page 39: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

t2.small t2.small t2.small

Blox: Daemon Scheduler

t2.small t2.small t2.small

scheduler cluster state service

t2.small t2.small t2.small

Page 40: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Live Demo

Page 41: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

The Blox Vision

Page 42: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Contributing to Blox

• Blox is licensed under Apache 2.0• Open an issue or pull request• Watch our roadmap on GitHub• Check out our Gitter channel

Page 43: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Summary

Page 44: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Summary

Page 45: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Thank you!

Page 46: NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox

Remember to complete your evaluations!