Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Amazon ec2 container service 소개

seapy
February 14, 2015

Amazon ec2 container service 소개

Amazon 에서 프리뷰 상태로 공개한 ECS(EC2 Container Service)에 대한 간략한 소개와 실행 예시

도커 코리아 3번째 서울밋업에서 발표

seapy

February 14, 2015
Tweet

More Decks by seapy

Other Decks in Programming

Transcript

  1. # ࣗѐ Amazon EC2 Container Service(ECS)ח ஶప੉ց ҙܻ ࢲ࠺झ۽ Docker

    ஶప੉ցܳ ૑ਗ. ECSী ؀ೠ ୶о ࠺ਊ਷ হਵݴ AWS ܻࣗझ(EC2, EBS ١)ী ؀ೠ ࠺ਊ݅ ૑ࠛ
  2. # ECS ਊয ੿ܻ Amazon ECSח ׮਺җ э਷ ஹನք౟ٜ۽ ੉ܖযઉ

    ੓׮. Cluster : ௿۞झఠ ஶప੉ց ੋझఢझٜ੄ ֤ܻ੸ Ӓܛ, Taskܳ ৈӝীࢲ ك׮. Container Instance : ஶప੉ց ੋझఢझ ௿۞झఠী ١۾ػ Amazon ECS ী੉੹౟о प೯غח EC2 ੋझఢझ Task Definition : Task ੿੄ ೠѐ ژח Ӓ ੉࢚੄ ஶప੉ց ੿੄ܳ ನೣೠ য೒ܻா੉࣌ ࢸݺ Task Task ੿੄ܳ ੉ਊ೧ ࢤࢿػ ੋझఢझ, ஶప੉ց ੋझఢझীࢲ प೯઺ Container : ஶప੉ց task੄ ੌࠗ۽ ࢤࢿػ ֿܻझ ஶప੉ց
  3. # ࢎ੹ ੘স AWS ҅੿ IAM ࢎਊ੗ ߂ IAM Role

    ࢤࢿ VPC(Vitual Private Cloud) ࢤࢿ ࠁউ Ӓܛ ࢤࢿ AWS CLI ࢸ஖
  4. # AWS EC2 ੋझఢझ ࢤࢿ AWS ݫפ૑ݢ౟ ௑ࣛ ੽ࣘ "US

    East (N. Virginia) region" ࢶఖ ೐ܻ࠭ীࢲ ࢎਊоמೠ ਬੌೠ region "Community AMIs" ীࢲ "ami-34ddbe5c" Ѩ࢝റ ࢶఖ ࢸ੿ Auto-assign Public IP => Enable IAM role => ecs policy ୶оػ role ࢶఖ EC2 ੋझఢझ ੽ࣘ(ec2-user) $ ssh -i ~/aws-verginia.pem [email protected]
  5. # рױೠ ੘স ١۾ ```json [ { "environment": [], "name":

    "sleep", "image": "busybox", "cpu": 10, "portMappings": [], "entryPoint": [ "/bin/sh" ], "memory": 10, "command": [ "sleep", "360" ], "essential": true } ] ```
  6. $ aws ecs list-clusters $ aws ecs list-container-instances $ aws

    ecs register-task-definition --family sleep360 --container-definitions file://sleep360.json $ aws ecs list-task-definitions $ aws ecs run-task --task-definition sleep360:3 --count 1 $ aws ecs list-tasks $ aws ecs describe-tasks --task xxx $ aws ecs stop-task --task xxxx
  7. # Wordpress ࠶۽Ӓ प೯ೞӝ ``` [ { "image": "wordpress", "name":

    "wordpress", "cpu": 10, "memory": 500, "essential": true, "links": [ "mysql" ], "portMappings": [ { "containerPort": 80, "hostPort": 80 } ] }, { "image": "mysql", "name": "mysql", "cpu": 10, "memory": 500, "essential": true, "environment": [ { "name": "MYSQL_ROOT_PASSWORD", "value": "password" } ] } ] ```
  8. $ aws ecs register-task-definition --family wordpress --container-definitions file://wordpress.json $ aws

    ecs run-task --task-definition wordpress:1 --count 1 $ aws ecs describe-container-instances --container-instances xxx $ aws ecs register-task-definition --family wordpress --container-definitions file://wordpress.json $ aws ecs run-task --task-definition wordpress:2 --count 1
  9. # ୶о ৘੿੉ۄҊ ߋ൦ ӝמ Elastic Load Balancing ా೤ CloudWatch

    ా೤ CloudWatch ۽Ӓ ా೤ CloudFormation ૑ਗ కӦ ૑ਗ AWS ݫ૑פݢ౟ ௑ࣛ ౵౟ց AMI(CoreOS ನೣ)
  10. # ECS ઁডࢎ೦ ECS ࢲ࠺झח അ੤ ೐ܻ࠭ ࢚క۽ ઁҕغݴ ೐ܻ࠭

    ӝрزউ ݻо૑ ઁডࢎ೦੉ ੓׮ ҅੿׼ ௿۞झఠ ࣻ : 2ѐ, default ௿۞झఠ ઁ৻ ௿۞झఠ׼ ஶప੉ց ੋझఢझ ࣻ : 100ѐ run-task, start-task ׼ ஶప੉ց ੋझఢझ ࣻ : 10ѐ run-task ୡ׼ ஶప੉ց ੋझఢझ ࣻ : ௿۞झఠ׼ 5ѐ ஶప੉ց ੋझఢझ ١۾ rate : ୡ׼ 1ѐ, ࠙׼ 60ѐ Task ੿੄ ౵ੌ ௼ӝ : 32 KiB Task ੿੄ ୭؀ ஶప੉ց ࣻ : 10ѐ Task ੿੄ ١۾ rate : ୡ׼ 1ѐ, ࠙׼ 60ѐ
  11. # ଵҊ੗ܐ Amazon EC2 Container Service ࣗѐ ECS Developer Guide

    AWS re:Invent 2014 | (APP313) NEW LAUNCH: Amazon EC2 Container Service in Action AWS CLI ECS Reference