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

AWS ECS の説明 /aws-ecs-introduction

9a71d9081335ef7d5ecfa86155c949af?s=47 yutachaos
October 01, 2018

AWS ECS の説明 /aws-ecs-introduction

サポーターズ下記勉強会用資料
https://supporterzcolab.com/event/522/

9a71d9081335ef7d5ecfa86155c949af?s=128

yutachaos

October 01, 2018
Tweet

Transcript

  1. AWS ECS

  2. ࣗݾ঺հ • ໦ଜ༐ଠ • SREΤϯδχΞ • ϓϩάϥϛϯάݴޠ • Java, node,

    PHP, Ruby, Go • ීஈ͸AWSΛར༻ͨ͠γεςϜͷӡ༻ɺӡ༻վળͱ͔΍ͬͯ·͢ɻ • ࠷ۙ͸EnvoyΛ͍ͬͯ͡·ͨ͠ɻ • AWS Certificated Solutions Architect • AWS Certificated DepOps Engineer
  3. Agenda • Containerٕज़ʹ͍ͭͯͷ͓͞Β͍ • ECSʹ͍ͭͯ • ECSͷ֓೦ʹ͍ͭͯ

  4. ContainerͬͯԿʁ

  5. • ߓʹ͋ΔΞϨ • Container ʹ DockerͰ͸ͳ͍ɻ • Docker͸ίϯςφܕԾ૝Խͷ࣮૷ͷҰͭ • Docker͸ΧʔωϧͱcgroupsͳͲͷٕज़Λ૊

    Έ߹ΘͤͯɺΞϓϦέʔγϣϯͱϥϯλΠϜ ࣮ߦ؀ڥΛ·ͱΊͯ෼཭͢Δٕज़ • ίϯςφ͸ϓϩηε ͬ͘͟Γͱͨ͠ղઆ
  6. • ΞϓϦέʔγϣϯͱ࣮ߦ؀ڥΛҰͭʹ·ͱΊ Δ͜ͱͰ։ൃͱӡ༻νʔϜ͕εϜʔζʹӡ༻ ग़དྷΔ • e.g. ϩʔΧϧͱຊ൪Ͱಉ͡Dockerfile࢖͑ Δ!ɺΠϯϑϥνʔϜ͕Dockerfile࡞ͬͯɺ ։ൃνʔϜʹ౉ͤΔʂٯ΋·ͨવΓ Կ͕ྑ͍ͷʁ

  7. • Elastic Container Serviceͷུ • AWS͕ఏڙ͢ΔίϯςφΦʔέετϨʔ γϣϯπʔϧ • e.g. kubernates,

    docker swarmͱ͔ • Docker͚ͩͰ͸ग़དྷͳ͍ίϯςφͷ Scaling, ഑ஔ, ؅ཧΛߦ͏αʔϏε ECSʹ͍ͭͯ
  8. ECS overview EC2 Launch type

  9. • ECR • Elastic Container RegistryͷུɺAWS্ͰϚωʔδυʹ ӡ༻͞ΕΔɺDocker imageΛอଘ͢ΔRegistry • Cluster

    • Container͕࣮ࡍʹ࣮ߦ͞ΕΔEC2Πϯελϯεͷू߹ ମ • Service • Task definitionΛ΋ͱʹͯ͠࡞੒͞ΕͨTaskΛ͍ͭ͘ى ಈ͢Δ͔ɺͲͷΑ͏ʹ഑ஔ͢Δͷ͔ɺͲͷϩʔυόϥϯ αʔܦ༝Ͱ௨৴͢Δ͔ͷઃఆɻTask definitionͱ1:1Ͱ ઃఆ͢Δ ༻ޠ1
  10. • Task definition • Containerͷ࣮ߦ͢Δ਽ܗ • Task • Task definitionΛ΋ͱʹͯ͠࡞੒͞Εͨ

    Containerͷ࣮ଶ ༻ޠ2
  11. Task Definitionʹ͍ͭͯ • ECS্Ͱ࣮ߦ͢ΔContainerͷઃఆ • EC2ͱFargateλΠϓ͕͋Δ • ࣮ߦͤ͞Δcontainerͷimage,ར༻͢Δ؀ ڥม਺ɺportͷઃఆͳͲΛߦ͏

  12. Serviceʹ͍ͭͯ • ECS্Ͱ࣮ߦ͢ΔTaskʹ͍ͭͯͷ·ͱΊΔઃఆ • Containerͷಈ͔͢਺ɺInstance΁ͷTask഑ஔ ઓུ • Load balancer΁ͷport mappingͳͲΛ୲͏ɻ

  13. ECS agent • EC2্Ͱಈ͘ɺECSͷcontainerͷ਺΍ঢ়ଶΛ೺Ѳ͢Δ agent • ͜ͷagentࣗମ΋dockerͰEC2ͷதͰಈ͍͍ͯΔ • EC2 typeͷ৔߹ɺ͜ͷECS

    agentΛEC2ىಈ࣌ʹಈ͘ Α͏ʹͯ͠Clusterʹొ࿥͢Δ
  14. Ϣʔεέʔε Rails appΛECSͰಈ͔͢৔߹ • Rails appͷimageΛઃఆͨ͠Task definitionΛ࡞੒ • Load balancerΛ͚ͭͨServiceΛ࡞੒͢Δ

  15. Sample

  16. ղઆ • Route53Λར༻ͯ͠domainΛઃఆ • ௨৴͸ALBܦ༝ͰContainerʹૹΔ • Application͸ContainerͰ࡞੒ɺECSͰε έʔϦϯάͷ؅ཧ

  17. Fargate launch typeʹ͍ͭͯ • ECSʹ͸̎ͭͷlaunch type EC2 launch typeͱ Fargate

    launch type͕͋Δɻ • EC2 launch type͸ContainerΛಈ͔ͨ͢ΊͷEC2Λ؅ ཧ͢Δඞཁ͕͋Δ͕ɺFargate launch type͸ಈ͔ͨ͢ ΊͷEC2ͷresourceΛAWSଆͰ؅ཧͯ͘͠ΕΔɻ • ؅ཧίετ͕ݮΔ • ݸਓతʹ͸·ͩಋೖͨ͜͠ͱͳ͍ɻ
  18. ECS overview Fargate Launch type

  19. ͓ΘΓʹ • ECS͸cluster্ͰserviceͰ؅ཧ͞Εͨ container͔Β੒ΔtaskΛtask definitionΛ΋ͱ ʹ࡞੒͠ɺӡ༻͢Δػೳ • ContainerΛຊ൪ӡ༻͢Δ͜ͱ͸։ൃɺӡ༻త ͳϦϨʔγϣϯʹ΋໾ʹཱͭ

  20. ༨ஊ

  21. Modern Web appΛߟ͑Δͱ ͖ʹศརͳϖʔδ

  22. Twelve-factor-app • https://12factor.net/ • ݩherokuͷ Adam Wiggins͕2011೥ʹॻ͍ ͨmodernͳSaaSΛ࡞ΔͨΊͷํ๏࿦ • ࣮࣭ContainerΛར༻͢ΔappΛ࡞੒͢Δͱ

    ͖ͷํ๏࿦ͷstandardͷҰͭ
  23. Cloud Native landscape • https://landscape.cncf.io/ • CNCF(Cloud Native Computing Foundation)

    ͕ఏ͍ࣔͯ͠ΔɺCloud NativeͳΞϓϦέʔ γϣϯΛનΊ্͍ͯ͘ͰͷϩʔυϚοϓ
  24. AWS ެࣜͷࢿྉ • ެࣜͷdoc • re:Invent΍AWS Summit, Black beltͷεϥΠ υ͸slideshareɺಈը͸youtubeʹଟ্͘

    ͕͍ͬͯ·͢ɻ • ࠔͬͨΒެ͕ࣜҰ൪!
  25. ྑ͍ Container lifeΛ!