ec2 container service - distributed applications at scale - pop-up loft tel aviv

70
EC2 Container Service - Distributed Applications at Scale Yaniv Donenfeld, Solutions Architect Amazon Web Services

Upload: amazon-web-services

Post on 22-Jan-2017

689 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

EC2 Container Service -Distributed Applications at Scale

Yaniv Donenfeld, Solutions Architect

Amazon Web Services

Page 2: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv
Page 3: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv
Page 4: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv
Page 5: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv
Page 6: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv
Page 7: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

APIsec2-run-instances

Page 8: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv
Page 9: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv
Page 10: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Order UI User UI Shipping UI

Order Service User Service Shipping

Service

Data Access

Page 11: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv
Page 12: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Microservices:Taming the monolith

Page 13: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Order UI User UI Shipping UI

Order Service User Service Shipping

Service

Page 14: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Order UI User UI UI

Order Service Service Shipping Service

Order UIOrder UI

User UI UIShipping UI

Order ServiceOrder Service

ServiceService

ServiceService

User Service

Shipping Service

Page 15: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Can we take this paradigm to the

next level?

Page 16: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Image: Izabella Reimers

Page 17: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Image: Izabella Reimers

Resource management

Resourceisolation

Speed

Page 18: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Package Ship Run

docker pushdocker pull

docker runDockerfile

Page 19: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

How should we think about building and running distributed

applications?

Page 20: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

A different primitive

Page 21: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv
Page 22: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

• {• "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• },

Page 23: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv
Page 24: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Managing the cluster

Page 25: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Image: NATS Press Office

The Leader

Page 27: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

http://static.googleusercontent.com/media/research.google.com/en//pubs/archive/41684.pdf

Page 28: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Image: highersights

Listening to our customers

Page 29: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv
Page 30: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv
Page 31: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

https://github.com/aws/amazon-ecs-agent

Page 32: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv
Page 33: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv
Page 34: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv
Page 35: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv
Page 36: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

100 Node Cluster (End-to-End) 1000 Node Cluster (End-to-End)

Page 37: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv
Page 38: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv
Page 39: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

https://aws.amazon.com/blogs/compute/how-to-create-a-custom-scheduler-for-amazon-ecs/

# Describe all instances in the ECS cluster containerInstancesArns = getInstanceArns(clusterName) response = ecs.describe_container_instances( cluster=clusterName, containerInstances=containerInstancesArns ) containerInstances = response['containerInstances']

# Sort instances by number of running tasks sortedContainerInstances = sorted( containerInstances, key=lambda containerInstances: containerInstances['runningTasksCount'] )

# Get the instance with the least number of tasks startOn.append(sortedContainerInstances[0]['containerInstanceArn']) logging.info('Starting task on instance %s...', startOn)

# Start a new task response = ecs.start_task( cluster=clusterName, taskDefinition=taskDefinition, containerInstances=startOn, startedBy='LeastTasksScheduler' )

Page 40: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

But you don’t have to

Page 41: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

The ECS Service Scheduler

Page 42: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Create services

Page 43: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Services launch tasks

Page 44: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Desired state

Page 45: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Desired state

Page 46: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv
Page 47: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Update service

Page 48: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Update service

Page 49: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Update service

Page 50: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Events

Page 51: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Using metricsto scale your fleet

Page 52: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Deployments

Page 53: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Deployments

Page 54: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv
Page 55: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv
Page 56: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Service Discovery

Page 58: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

ELB

Page 60: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Weave

http://weave.works/guides/service-discovery-with-weave-aws-ecs.html

Page 62: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

“Moving to Amazon ECS significantly improved our service performance. We reduced service response times in the 99th percentile by 50%”

Jason FischlVP of Engineering

Page 63: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

“I have managed the orchestration service at Heroku, and experimented with configuring and running numerous open-source orchestration systems, and I am relieved that Amazon's world-class engineering is tackling this problem and offers it as a service.”

Noah ZoschkeFounder

Page 64: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

“Out of the box ECS lets us run thousands of containers across multiple availability zones. It's let our development team focus on building the Meteor-specific services needed for our customers to build amazing Connected Client apps. Because ECS pairs well with other technologies like CloudFormation and auto scaling, it dramatically simplified our own devops compared to other options. It's made it possible to run multiple Galaxies and to bring up faithful development environments for each person on the core team in a fraction of the time previously possible.”

Matt DeBergalisCo-founder and VP Product

Page 65: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Image: Robert Couse-Baker

Page 66: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Amazon EC2 Container Registry

• Fully - managed Docker container registry

• Integrated with Amazon ECS• Encrypted in transit and at rest• IAM users and roles• Highly available and scalable• Available in multiple regions• $0.10/GB/Month + AWS data transfer

costs

aws.amazon.com/ecr

Page 67: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

ECS CLI

• First version• Simplify local development• Easily set up ECS clusters• Supports Docker Compose• Open source

github.com/aws/amazon-ecs-cli

$ ecs-cli configure -i$ ecs-cli up$ ecs-cli compose up$ ecs-cli compose ps

Page 68: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

New: Improved Docker Container Configuration Options

• More Docker options supported in ECS task definitions

• Ideal for advanced Docker users• New additions

– Hostname– Docker labels– Working directory– Privileged execution– Log configuration– …and more (see Amazon ECS

docs

Page 69: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

aws.amazon.com/ecr

A system that’s designed to run container-enabled applications in Production

Without worrying about scalability, performance, IAM

Page 70: EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv

Yaniv Donenfeld

EC2 Container Service -Distributed Applications at Scale

[email protected]