Top Banner
Amazon EC2 Container Service in Action Channy Yun AWS Technical Evangelist Sangpill Kim – AWS Solutions Architect Docker Seoul Meetup
48

Amazon EC2 Container Service in Action

Jan 21, 2018

Download

Technology

Remotty
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: Amazon EC2 Container Service in Action

Amazon EC2 Container Service in Action

Channy Yun ‒ AWS Technical Evangelist Sangpill Kim – AWS Solutions Architect

Docker Seoul Meetup

Page 2: Amazon EC2 Container Service in Action

Why ContainerServices?

Page 3: Amazon EC2 Container Service in Action

Benefits of ContainersPortable Flexible Fast Efficient

Server

Guest OS

Bins/Libs Bins/Libs

App2 App1

Page 4: Amazon EC2 Container Service in Action

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

But…

Page 5: Amazon EC2 Container Service in Action

+

So…

Page 6: Amazon EC2 Container Service in Action

Cluster management

Configuration management

Scaling

Security Availability Container sprawl

Image: RaSeLaSeD - ll Pinguino

Page 7: Amazon EC2 Container Service in Action

Elastic Load Balancing

ENIs

Auto Scaling

Security Groups

IAM

Image: xmatt

Tagging

Multi-AZ

Amazon EBS

Page 8: Amazon EC2 Container Service in Action

Docker 콘테이너 제작 및 배포

EC2 인스턴스를 클러스터 구성 가능

실행 시 지속적인 볼륨 유지 가능

사설 Docker 레포지터리 운영

Amazon EC2 Container Service “Docker기반 확장성과 고성능 콘테이너 관리 서비스”

Page 9: Amazon EC2 Container Service in Action
Page 10: Amazon EC2 Container Service in Action
Page 11: Amazon EC2 Container Service in Action
Page 12: Amazon EC2 Container Service in Action
Page 13: Amazon EC2 Container Service in Action

EC2 Instance EC2 Instance EC2 Instance

Page 14: Amazon EC2 Container Service in Action

EC2 Instance EC2 Instance EC2 Instance

EC2 Instance EC2 Instance

EC2 Instance EC2 Instance

Page 15: Amazon EC2 Container Service in Action

주요 구성 요소

•  Container Instance•  Cluster •  Task Definitions •  Tasks•  Service

Page 16: Amazon EC2 Container Service in Action

주요 구성 요소

•  Container Instance•  Cluster •  Task Definitions •  Tasks•  Service

Container Instance

Container Instance

Container Instance

Cluster

Task definition

Task

Service

Page 17: Amazon EC2 Container Service in Action

Demo

Page 18: Amazon EC2 Container Service in Action

주요 구성 요소

•  Container Instance•  Cluster •  Task Definitions •  Tasks•  Service

!  Amazon EC2 인스턴스 !  Docker 데몬 !  Amazon ECS 에이전트

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

Page 19: Amazon EC2 Container Service in Action

주요 구성 요소

•  Container Instance•  Cluster •  Task Definitions •  Tasks•  Service

! 리전 단위 (Multi-AZ) ! 자원 풀 !  Container Instances 그룹 ! 최소 시작, 동적 확장

Page 20: Amazon EC2 Container Service in Action

주요 구성 요소

•  Container Instance•  Cluster •  Task Definitions •  Tasks•  Service

Volume definitions

Container definitions

Shared data volume

PHP App Time of day App

Page 21: Amazon EC2 Container Service in Action

Task Definitions

Container Instance

Schedule

Shared data volume

PHP App Time of day App

Page 22: Amazon EC2 Container Service in Action

Task Definition{ “family” : “my-website”,

“version” : “1.0”

“containers” : [

<<CONTAINER DEFINTIONS>>

]

}

Page 23: Amazon EC2 Container Service in Action

Container Definition{ “name” : “webServer”,

“image” : “nginx:latest”

“cpu” : 512,

“memory” : 128,

“portMappings” :

[ { “containerPort” : 9443,

“hostPort” : 443 }],

“links” : [“rails”],

“essential” : true

}

Page 24: Amazon EC2 Container Service in Action

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

[! {! "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 25: Amazon EC2 Container Service in Action

[! {! "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

! !{! "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 26: Amazon EC2 Container Service in Action

주요 구성 요소

•  Container Instance•  Cluster •  Task Definitions •  Tasks•  Service

! 서비스를 위한 단위 ! 연관된 콘테이너들의 그룹 ! 콘테이너 인스턴스에서 실행

Nginx Web Server

Rails Application

MySQL Database

Log Collector

Page 27: Amazon EC2 Container Service in Action

주요 구성 요소

•  Container Instance•  Cluster •  Task Definitions •  Tasks•  Service

! 지속적 애플리케이션 ! 로드 밸런싱 및 상태 관리 ! 스케일-아웃 ! 신규 버전 배포/업데이트

Elastic Load Balancing

Page 28: Amazon EC2 Container Service in Action

CLI를 이용한 관리 가능

$"aws"ecs"list+container+instances"–c"default"arn:aws:ecs:us*west*2:956941867282:container*instance/01be44c0*4d45*4c1f*b2ae*1fce16c35ab6<

arn:aws:ecs:us*west*2:956941867282:container*instance/1c81279b*4b39*4985*b76d*224e0385b219<

$"aws"ecs"create+cluster"default""{<<<"cluster_arn":<"arn:aws:ecs:us*west*2:956941867282:cluster/c1a329a8*ec8a*41dc*82f6*294434861bd1",<<<"cluster_name":<"default",<<<"status":<"ACTIVE"<}<

Page 29: Amazon EC2 Container Service in Action
Page 30: Amazon EC2 Container Service in Action

$"cat"wordpress.json"{<

<"containers"<:<[<< <{<< < <"image"<:<"tutum/wordpress*stackable",<< < <"name"<:<"wordpress",<< < <"cpu"<:<10,<< < <"memory"<:<50,<< < <"links"<:<["db"],<< < <"environment"<:<[{<"name"<:<"DB_USER",<"value"<:<"root"},<{<"name"<:<"DB_PASS",<"value"<:<

"pass"<}],<< < <"portMappings"<:<[{<"containerPort"<:<80,<"hostPort"<:<<80}]<< <},<< <{<< < <"image"<:<"mysql",<< < <"name"<:<"db",<< < <"cpu"<:<10,<< < <"memory"<:<50,<< < <"environment"<:<[{<"name"<:<"MYSQL_ROOT_PASSWORD",<"value"<:<"pass"}],<< <}<<]<

}<

Page 31: Amazon EC2 Container Service in Action

$"aws"register+task+definition"wordpress:1.0"–+file"wordpress.json""{<<<<<<“family”<:<“wordpress”,<

<<<<<“version”<:<“1.0”,<<"containers"<:<[<< <{<< < <"image"<:<"tutum/wordpress*stackable",<< < <"name"<:<"wordpress",<< < <"cpu"<:<100,<

< < <"memory"<:<100,<< < <"links"<:<["db"],<< < <"environment"<:<[{<"name"<:<"DB_USER",<"value"<:<"root"},<{<"name"<:<"DB_PASS",<"value"<:<"pass"<}],<< < <"portMappings"<:<[{<"containerPort"<:<80,<"hostPort"<:<<80}]<< <},<

< <{<< < <"image"<:<"mysql",<< < <"name"<:<"db",<< < <"cpu"<:<100,<< < <"memory"<:<100,<

< < <"environment"<:<[{<"name"<:<"MYSQL_ROOT_PASSWORD",<"value"<:<"pass"}],<< <}<<]<

}<

Page 32: Amazon EC2 Container Service in Action

$"aws"ecs"run+task"wordpress:1.0"{<<<"tasks":<[<<<<<{<<<<<<<"task_arn":<"arn:aws:ecs:us*west*2:956941867282:task/29da33da*1d71*454f*b036*df0da0284266",<<<<<<<"task_definition_arn":<"arn:aws:ecs:us*west*2:956941867282:task*definition/7fc71808*5102*47d3*9f76*0bded26a932b",<<<<<<<"container_instance_arn":<"arn:aws:ecs:us*west*2:956941867282:container*instance/01be44c0*4d45*4c1f*b2ae*1fce16c35ab6",<<<<<<<"overrides":<{},<<<<<<<"last_status":<"PENDING",<<<<<<<"desired_status":<"RUNNING",<<<<<<<"containers":<[<<<<<<<<<{<<<<<<<<<<<"arn":<"arn:aws:ecs:us*west*2:956941867282:container/1b33848e*1933*43b5*b9c7*4581efb70504",<<<<<<<<<<<"task_arn":<"arn:aws:ecs:us*west*2:956941867282:task/29da33da*1d71*454f*b036*df0da0284266",<<<<<<<<<<<"name":<"wordpress",<<<<<<<<<<<"last_status":<"PENDING",<<<<<<<<<<<"exit_code":<0<<<<<<<<<}<<<<<<<<]<<<<<}<<<]<}<

Page 33: Amazon EC2 Container Service in Action

wordpress

Page 34: Amazon EC2 Container Service in Action

http://aws.amazon.com/solutions/case-studies/coursera-ecs/

“ Amazon ECS enabled Coursera to focus on releasing new software rather than spending time managing clusters.” Frank Chen Software Engineer

•  Docker containers on Amazon EC2 Container Service (ECS) enabled Coursera to easily move to a microservices -based architecture.

•  Each job is created as a container and Amazon ECS schedules the container across the Amazon EC2 instance cluster.

•  Amazon ECS handles all the cluster management and container orchestration, and containers provide the necessary resource isolation.

Page 35: Amazon EC2 Container Service in Action

http://engineering.remind.com/introducing-empire/

Page 36: Amazon EC2 Container Service in Action

http://www.slideshare.net/nathariel/microservices-and-elastic-resource-pools-with-amazon-ec2-container-service

Page 37: Amazon EC2 Container Service in Action

Amazon EC2 Amazon EC2 Containers Services

AWS Lambda On-Premises

Weeks Minutes Seconds Milliseconds

Page 38: Amazon EC2 Container Service in Action

AWS 자원의 변경 이벤트 변화 인식

Node.js 및 자바를 지원하는 클라우드 함수

서버 없이도 고 확장성 기반 실행

AWS Lambda“이벤트 기반 확장성 높은 클라우드 코드 실행 서비스”

Page 39: Amazon EC2 Container Service in Action

Photo bucket S3

Metadata DynamoDB

Trending DynamoDB

Extract metadata

Cloud Function

Trending Cloud

Function

NotifyCloud Function

""

SNS Push notification

Page 40: Amazon EC2 Container Service in Action

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 41: Amazon EC2 Container Service in Action

Example: Batch Jobs with ECS and Lambda

.zip

s3://bucket/scene.zip

ECS Cluster

.png

Page 42: Amazon EC2 Container Service in Action

Move to Microservices! Based on AWS Building Blocks

Page 43: Amazon EC2 Container Service in Action

Your Architecture

ECS, Lambda, API Gateway, CodeDeploy, DynamoDB, SQS…

Page 44: Amazon EC2 Container Service in Action

규모에 따른 클러스터 관리

별도 실행 없음

전체 상태 관리

컨트롤 및 모니터링

대규모 확장

Page 45: Amazon EC2 Container Service in Action

유연한 콘테이너 배치

어플리케이션

배치 작업

복수 스케줄러

Page 46: Amazon EC2 Container Service in Action

맞춤형 기능 확장 가능

다양한과 편리한 API 오픈 소스 에이전트 사용자 정의 스케줄러

Page 47: Amazon EC2 Container Service in Action

다양한 AWS 서비스와 빌딩 블럭

Elastic Load Balancing Amazon Elastic Block Store Amazon Virtual Private Cloud AWS Identity and Access Management AWS CloudTrail …. AWS Elastic Beanstalk & Opsworks AWS Lambda

Page 48: Amazon EC2 Container Service in Action

여러분의 피드백을 기다립니다!

•  공식 블로그: http://aws.amazon.com/ko/blogs/korea •  한국어 공식 소셜 미디어

@AWSKorea

AmazonWebServices.ko

AWSKorea

AWSKorea