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

システム基盤としてのAWS活用 / System foundation by AWS

5e1d0f7877241ad4447c6611d9a51fd7?s=47 cohalz
January 30, 2019

システム基盤としてのAWS活用 / System foundation by AWS

Hatena Engineer Seminar #11

5e1d0f7877241ad4447c6611d9a51fd7?s=128

cohalz

January 30, 2019
Tweet

Transcript

  1. γεςϜج൫ͱͯ͠ͷ AWS׆༻ Hatena Engineer Seminar #11 id:cohalz

  2. ࣗݾ঺հ • id:cohalz / @cohalz • 2018೥৽ଔೖࣾ • γεςϜϓϥοτϑΥʔϜ෦ॴଐSRE

  3. γεςϜج൫ͱ͸

  4. γεςϜج൫ͱ͸ • αʔϏε։ൃͷ଎౓Λ޲্ͤ͞ΔΑ͏ͳɼ ଞͷSRE΍ΞϓϦέʔγϣϯΤϯδχΞ΋࢖͏πʔϧ • αʔϏεͷ਺ʹεέʔϧ͢ΔΑ͏ͳ΋ͷ • σϓϩΠπʔϧ΍ӡ༻ΦϖϨʔγϣϯπʔϧͳͲछྨ͸༷ʑ

  5. طଘͷγεςϜج൫ͷ՝୊఺ • खݩͰ࣮ߦ • ؀ڥͷ੔උ͔Βඞཁ • ΦϖϨʔγϣϯ༻αʔόͰ࣮ߦ • ΦϖϨʔγϣϯαʔόͷอक͕ඞཁ •

    ͦ΋ͦ΋ख࡞ۀͩͱ͍͏໰୊
  6. γεςϜج൫ʹ࢖͏AWSαʔϏε

  7. AWS Lambda • AWSͷαʔόϨείϯϐϡʔςΟϯά؀ڥ • ଞAWSαʔϏεͷ࿈ܞ

  8. AWS LambdaͷϝϦοτ • AWSαʔϏεͱͷ࿈ܞ • APIܦ༝Ͱෳ਺αʔϏεͷΞΫγϣϯΛࣗಈԽ • ݖݶ؅ཧ΋LambdaʹدͤΒΕΔ

  9. αʔόϨεͷϝϦοτ αʔό͕ͳ͍͜ͱʹΑΔϝϦοτ͸େ͖͍ • Մ༻ੑ • SLA͸99.95% • อकੑ • ΦϖϨʔγϣϯ༻αʔόɾόοναʔό͔Βͷղ์

  10. AWS CloudFormation • YAMLϑΝΠϧͰهड़ͯ͠ɼAWSϦιʔεΛσϓϩΠͰ͖Δ • ݕূ؀ڥΛ͙͢࡞ΕΔ • มߋͷࣄલϨϏϡʔ • υΩϡϝϯτԽ

    • ෆ۩߹࣌ͷ੾Γ໭͠ • Infrastructure as Codeͷ࣮ફ
  11. Lambda + CloudFormation ͷ։ൃεϐʔυΛ্͛ΔͨΊʹ

  12. Serverless Application Model • ௨শSAM • AWSެࣜʹΑΔαʔόϨε؀ڥϑϨʔϜϫʔΫ • CloudFormationͷ֦ு •

    هड़ྔͷ࡟ݮ • ։ൃʹศརͳCLIπʔϧ܈ • ϩʔΧϧ࣮ߦɾσϓϩΠ
  13. AWSΛ׆༻͍ͯ͠Δج൫ͷྫ

  14. ʮεέδϡʔϧ͞ΕͨΠϕϯτʯ ΁ͷରԠ

  15. Ϟνϕʔγϣϯ • EC2ͷΠϯελϯε࠶ىಈ΍ϦλΠΞ༧ࠂ͕དྷΔ • ࣄલʹରԠ͠ͳ͍ͱো֐ʹͳΔ͜ͱ΋ • Πϕϯτ͕͋ͬͨΒSlackʹ௨஌͢Δόον͕ಈ͍͍ͯͨ • Slack௨஌ΛݟͯissueʹखಈͰ௥Ճ͍ͯͨ͠ •

    όοναʔόͷ໘౗΋ݟ͍ͯͨ
  16. ొ࿥ͷࣗಈԽ • ʮεέδϡʔϧ͞ΕͨΠϕϯτʯ͸CloudWatch EventsͰΠ ϕϯτΛड͚औΔࣄ͕Ͱ͖Δ • LambdaΛ࣮ߦ͠ɼAPIܦ༝ͰGitHubͱGoogleΧϨϯμʔʹ ࣗಈͰ௥Ճ͢Δ

  17. issue͕ࣗಈͰొ࿥͞ΕΔ

  18. خ͔ͬͨ͜͠ͱ • ຊདྷͷΠϕϯτରԠҎ֎ʹඞཁͳख࡞ۀ͸ͳ͘ͳͬͨ • ຊདྷ΍Δ΂͖ରԠ͚ͩʹूதͰ͖ͨ • όοναʔόΛࢭΊΔ͜ͱ͕Ͱ͖ͨ

  19. Let's Encryptূ໌ॻͷ ߋ৽ɾ؅ཧͷࣗಈԽ

  20. Ϟνϕʔγϣϯ • ख࡞ۀͳ্ʹෳࡶ • ΦϖϨʔγϣϯαʔόͰ࣮ߦ • ূ໌ॻͷసૹͳͲؾΛ͚ͭͳ͍ͱ͍͚ͳ͍෦෼΋͋Δ • ఆظతʹൃੜ͢ΔׂΓࠐΈ •

    ূ໌ॻͷ༗ޮظݶ͸ࡾϲ݄
  21. ΞʔΩςΫνϟ 1. ར༻ऀ͸औಘ͍ͨ͠ূ໌ॻ༻ͷ CloudWatch EventsΛ௥Ճ 2. ఆظ࣮ߦ͞ΕɼLambda͕ূ໌ॻΛ औಘɾS3΁อଘ 3. S3όέοτ͔Βূ໌ॻΛऔಘͯ͠

    Ϧϩʔυ
  22. ࣮ࡍͷಈ࡞ ϒϩά: http://developer.hatenastaff.com/entry/2018/12/11/133000

  23. خ͔ͬͨ͜͠ͱ • ख࡞ۀ͸࠷ॳ͚ͩ • CloudWatch EventsʹΑΔఆظ࣮ߦ • ৴པੑ΋޲্ • Lambdaࣗମͷ৴པੑʹدͤΒΕΔ

    • ূ໌ॻΛ҆શʹѻ͑ΔΑ͏ʹ • S3 + KMSʹΑΔՄ༻ੑͱػີੑ
  24. OSSԽ • ࣾ಺Ϧιʔεʹґଘͯ͠ͳ͍ͷͰOSSԽ • https://github.com/cohalz/CertUpdater

  25. AWSͷγεςϜج൫Ͱେࣄͳ͜ͱ

  26. ଞͷਓ͕ϝϯςͰ͖ΔΑ͏ʹ͢Δ • ࠓ·Ͱͷج൫ʹൺ΂ͯن໛͕େ͖͘ͳΓ͕ͪ • υΩϡϝϯτΛ͔ͬ͠Γ༻ҙ͢Δ • ͳΔ΂͘ެࣜͷπʔϧΛ࢖͏ • Θ͔Βͳ͔ͬͨΒαϙʔτʹฉ͘

  27. είʔϓɾ੹೚ڥք • ج൫͕Ͳ͜·Ͱ΍Δͷ͔͸͖ͬΓͤ͞Δ • ࿈ܞ͕͠΍͍͔͢Βܾͦ͜ΊΔ • ར༻ऀͷ͜ͱΛߟ͑Δ • ஌Βͳ͍͍ͯ͘͜ͱΛҙࣝ

  28. ͜Ε͔ΒͷγεςϜج൫ • ΨΠυϥΠϯΛ࡞Δ • AWS͸୭Ͱ΋؆୯ʹѻ͑ͯ͠·͏ • ϚϧνΞΧ΢ϯτରԠ • ڞ௨ج൫ΛͲ͏ల։͍͔ͯ͘͠ʁ

  29. ·ͱΊ • ৴པੑͷͨΊʹLambdaΛج൫ͱͯ͠ར༻͍ͯ͠Δ • CloudFormation͸ڞ௨ݴޠͱͯ͠ར༻ • SAMͷొ৔ʹΑΓɼαʔόϨεج൫ͷ։ൃ଎౓΋޲্ͨ͠ • AWS͔ͩΒͦ͜ߟ͑ͳ͍ͱ͍͚ͳ͍෦෼΋͋Δ