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

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

cohalz
January 30, 2019

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

Hatena Engineer Seminar #11

cohalz

January 30, 2019
Tweet

More Decks by cohalz

Other Decks in Programming

Transcript

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

    View full-size slide

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

    View full-size slide

  3. γεςϜج൫ͱ͸

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  6. γεςϜج൫ʹ࢖͏AWSαʔϏε

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  11. Lambda + CloudFormation
    ͷ։ൃεϐʔυΛ্͛ΔͨΊʹ

    View full-size slide

  12. Serverless Application Model
    • ௨শSAM
    • AWSެࣜʹΑΔαʔόϨε؀ڥϑϨʔϜϫʔΫ
    • CloudFormationͷ֦ு
    • هड़ྔͷ࡟ݮ
    • ։ൃʹศརͳCLIπʔϧ܈
    • ϩʔΧϧ࣮ߦɾσϓϩΠ

    View full-size slide

  13. AWSΛ׆༻͍ͯ͠Δج൫ͷྫ

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  23. خ͔ͬͨ͜͠ͱ
    • ख࡞ۀ͸࠷ॳ͚ͩ
    • CloudWatch EventsʹΑΔఆظ࣮ߦ
    • ৴པੑ΋޲্
    • Lambdaࣗମͷ৴པੑʹدͤΒΕΔ
    • ূ໌ॻΛ҆શʹѻ͑ΔΑ͏ʹ
    • S3 + KMSʹΑΔՄ༻ੑͱػີੑ

    View full-size slide

  24. OSSԽ
    • ࣾ಺Ϧιʔεʹґଘͯ͠ͳ͍ͷͰOSSԽ
    • https://github.com/cohalz/CertUpdater

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide