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

BitValleyInside_auポータルでの取り組み.pdf

Efd8bfe50b2af29f18d1af1ab26c316c?s=47 masayosu
April 17, 2019

 BitValleyInside_auポータルでの取り組み.pdf

Efd8bfe50b2af29f18d1af1ab26c316c?s=128

masayosu

April 17, 2019
Tweet

Transcript

  1. au WebϙʔλϧαΠτϦχϡʔΞϧ ΠϯϑϥͷऔΓ૊Έ

  2. ࣗݾ঺հ લᖒਖ਼ٓʢ·͑͟Θ·͞Α͠ʣ • גࣜձࣾmediba • ΠϯϑϥετϥΫνϟʔ෦ / ΋ͷͮ͘Γਪਐ෦ • PerlΤϯδχΞ

    7೥ • ࣾ಺SE 2೥ • Πϯϑϥྺ 3೥ • AWSೝఆ • ιϦϡʔγϣϯΞʔΩςΫτ ΞιγΤΠτ • ιϦϡʔγϣϯΞʔΩςΫτ ϓϩϑΣογϣφϧ
  3. Agenda • au WebϙʔλϧͷϦχϡʔΞϧ • Fargateʹ͍ͭͯ • ͳͥFargateΛར༻͢Δͷ͔ • Fargateͷར༻ύλʔϯ

    • ࣮ࡍʹ͔ͭͬͯΈͯͲ͏ͩͬͨͷ͔ • ·ͱΊ
  4. ΠϯϑϥΤϯδχΞͷਓʁ

  5. AWS࢖͍ͬͯΔਓʁ

  6. ίϯςφ࢖͍ͬͯΔਓʁ

  7. ϓϩμΫγϣϯͰίϯςφӡ༻͍ͯ͠Δਓʁ

  8. au WebϙʔλϧͷϦχϡʔΞϧ

  9. ΦϯϓϨˠAWS

  10. VM→ίϯςφ

  11. au WebϙʔλϧϦχϡʔΞϧͷΠϯϑϥߏ੒ਤʢҰ෦ൈਮʣ

  12. Fargateʹ͍ͭͯ

  13. ͷલʹ

  14. AWSͷίϯςφؔ࿈αʔϏε • ίϯτϩʔϧϓϨʔϯ ίϯςφͷΦʔέετϨʔγϣϯΛ୲౰ • ECS • EKS • σʔλϓϨʔϯ

    ίϯςφ͕࣮ࡍʹಈ࡞͢Δ؀ڥ • EC2 • Fargate
  15. ECS for Fargateʹ͍ͭͯ • ίϯςφ͕ىಈ͢ΔϗετͱΫϥελ؅ཧΛAWS͕໘ ౗ݟͯ͘ΕΔϚωʔδυαʔϏε

  16. &$4$MVTUFS &$*OTUBODF ECS for EC2 5"4, /HJOY /PEF 5"4, /HJOY

    /PEF &$*OTUBODF 5"4, /HJOY /PEF 5"4, /HJOY /PEF
  17. &$4$MVTUFS ECS for Fargate 5"4, /HJOY /PEF 5"4, /HJOY /PEF

    5"4, /HJOY /PEF 5"4, /HJOY /PEF
  18. ίϯτʔϧϓϨʔϯ΋ σʔλϓϨʔϯ΋ ϑϧϚωʔδυ

  19. ͳͥECS for FargateΛར༻͢Δͷ͔ • ϑϧϚωʔδυαʔϏε • ίϯτϩʔϧϓϨʔϯ͚ͩͰͳ͘σʔλϓϨʔϯͷϗετ؅ཧ͕ෆཁ • ଞͷAWSαʔϏεΛར༻͠΍͍͢ •

    λεΫʹରͯ͠IAM RoleΛ෇༩Ͱ͖Δ • λεΫຖʹENI͕Ξλον͞ΕΔͨΊSecurityGroup͕ઃఆͰ͖Δ • CloudWatchLogsͰϚωʔδυͳϩά؅ཧ • CodePipelineͰϚωʔδυͳܧଓతͳσϓϩΠ
  20. Fargateͷར༻ύλʔϯ

  21. ϥΠϑαΠΫϧͷ௕͍λεΫ

  22. ϥΠϑαΠΫϧͷ௕͍λεΫ • Webαʔό΍ΞϓϦέʔγϣϯαʔόͷϓϩηε • ALB഑Լʹෳ਺ͷίϯςφλεΫΛىಈ • σϓϩΠ࣌ʹ৽͍͠λεΫͷىಈͱALB΁ͷ෇͚ସ͑

  23. ϥΠϑαΠΫϧͷ୹͍λεΫ

  24. ϥΠϑαΠΫϧͷ୹͍λεΫ • όονॲཧͳͲඞཁͳ࣌ʹλεΫΛ࣮ߦͯ͠ऴྃ • εέδϡʔϦϯάͰͷఆظత࣮ߦ • όοναʔό͕ෆཁʹͳΔͷͰׂ҆

  25. Ͱ࣮ࡍ࢖ͬͯͲ͏ͩͬͨͷʁ

  26. σϓϩΠ͕ίϯςφʹͯ͠͸஗͍

  27. σϓϩΠ͕ίϯςφʹͯ͠͸஗͍ • λεΫ͕Runningঢ়ଶʹͳΔͷʹ໿̍෼΄Ͳ͔͔Δ • ENIͷΞλον࣌ؒ΋໿10ඵ΄Ͳ͔͔Δ • ίϯςφΠϝʔδͷPullʹ͕͔͔࣌ؒΔ • Fargate͸ΠϝʔδͷΩϟογϡΛอ࣋Ͱ͖ͳ͍ ʢࠓ͸ʣ

    5"4, /HJOY /PEF 5"4, /HJOY /PEF
  28. NATGWͷ༧ظͤ͵࢖༻ྔ

  29. NATGWͷ༧ظͤ͵࢖༻ྔ • ECR΁ͷ઀ଓ͸Πϯλʔωοτܦ༝ʢσϑΥϧτʣ • Fargate͸ΠϝʔδͷΩϟογϡΛอ࣋Ͱ͖ͳ͍ʢࠓ͸ʣ • DockerHub΁͸౰વΠϯλʔωοτܦ༝ • ΠϝʔδΛPull͗͢͠ΔͱBAN͞ΕΔ͜ͱ΋(͞Εͨ)

  30. ECR΁ͷ઀ଓ͸σϑΥϧτΠϯλʔωοτܦ༝ *OUFSOFU

  31. ରࡦ

  32. PrivateLinkΤϯυϙΠϯτܦ༝ʹϧʔτมߋ *OUFSOFU

  33. NATGWʹฏԺ͕͓ͱͣΕΔ PrivateLinkಋೖલ PrivateLinkಋೖޙ

  34. Fargateͷ؂ࢹ

  35. CloudWatch MetricsͰͷ؂ࢹ • ϝτϦΫε • CPU Utilization • Memory Utilization

    • σΟϝϯγϣϯ • Ϋϥελʔ୯Ґ • αʔϏε୯Ґ
  36. Ϋϥελʔ &$4$MVTUFS 5"4, 5"4, 5"4, 5"4,

  37. λεΫ୯ҐͷϝτϦΫεݟ͍ͨ

  38. λεΫ୯ҐͰϝτϦΫεΛऔಘ͍ͨ͠ &$4$MVTUFS 5"4, %BUB EPH /PEF 5"4, %BUB EPH /PEF

    5"4, %BUB EPH /PEF 5"4, %BUB EPH /PEF Datadog AgentͷαΠυΧʔίϯςφΛ্ཱͪ͛Δ
  39. λεΫ୯ҐͰϝτϦΫεΛऔಘ͍ͨ͠ Agentܦ༝ͰϝτϦΫε৘ใΛٵ্͍͛Δ ʢ౰વAgent෼ͷFargateඅ༻͔͔Γ·͢ʣ

  40. Datadog AgentΛར༻ͨ͠؂ࢹ • DatadogAgentͷΠϝʔδͷஔ͖৔ॴ͸ECR • DatadogAgentͷόʔδϣϯͷ௥ै͕ඞཁ • ϥΠϑαΠΫϧͷ୹͍λεΫ͸ϝτϦΫεͷऔಘ͕೉͍͠ • Logू໿ͱ؂ࢹ͕ॏཁ

  41. ίϯςφͷ؂ࢹͱӡ༻ • Cattle,not petsʢϖοτͰ͸ͳ͘ɺՈசʣ • VMͷ؅ཧͱҧ͍Ϛγϯͷӡ༻ΑΓ΋αʔϏεͷՄ༻ੑͱੑೳΛॏࢹ͢Δ • ໰୊͕ൃੜͨ͠λεΫ͸༰ࣻͳ͘ఀࢭ • ΦʔτώʔϦϯάͰએݴͨ͠λεΫͷ୆਺ʹ໭Δ

  42. ·ͱΊ

  43. ·ͱΊ • Fargate͸ίϯςφΛར༻͢Δ৔߹ʹ࠷ॳʹݕ౼͢΂͖બ୒ࢶ • FargateͷίϯςφΠϝʔδ͸ΩϟογϡͰ͖ͳ͍ • PrivateSubnetͰίϯςφΛىಈ͢Δ৔߹PrivateLinkΛར༻͢Δ • ίϯςφͷಛੑʹΑͬͯ؂ࢹํ๏ͱ؂ࢹର৅Λߟ͑Δඞཁ͕͋Δ