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

after of Infrastructure-as-Code-is-very-tired

after of Infrastructure-as-Code-is-very-tired

shogomuranushi

July 31, 2019
Tweet

More Decks by shogomuranushi

Other Decks in Programming

Transcript

  1. Infrastructure as CodeʹർΕͨͷͰ
    ๻͕ͨͪຊདྷ΍Γ͔ͨͬͨ͜ͱΛ੔ཧ͢Δ

    X-Tech JAWS & JAWS-UGΞʔΩςΫνϟઐ໳ࢧ෦ ίϥϘษڧձ#02
    Shogo Muranushi

    View full-size slide

  2. Shogo Muranushi
    ABEJA, Inc.
    - ABEJA Platform Product Owner
    - Site Reliability Engineer Tech Lead

    View full-size slide

  3. ΞδΣϯμ
    • JAWS DaysͰ࿩ͨ͠಺༰ͷ͓͞Β͍
    • ͦͷޙʹ৭ʑͳਓͱ࿩ͨ݁͠࿦
    • ͡Ό͋ɺԿ͔Β࢝ΊΔʁͦͷޙͷIaCͷτϨϯυ
    • αΫοͱ΍ͬͯϋϚΓͦ͏ͳ৚݅Λ·ͱΊΔ
    • ·ͱΊ

    View full-size slide

  4. JAWS DaysͰ࿩ͨ͠಺༰ͷ͓͞Β͍
    ʢ5෼όʔδϣϯʣ

    View full-size slide

  5. ࠓͷ๻ͷঢ়ଶ
    ύτϥογϡͷֆΛ
    ૝૾͍ͯͩ͘͠͞

    View full-size slide

  6. ຊηογϣϯͰͷ Infrastructure as Code ͸ओʹAWSΛߏ੒
    ͢ΔͨΊͷπʔϧ܈Λࢦ͠·͢ɻ
    ղΛ͍࣋ͬͯΔΘ͚Ͱ͸͋Γ·ͤΜɻ
    ϕετͳҊ΋͍࣋ͬͯͳ͍ͷͰΈΜͳͰ౴͑Λग़͠·͠ΐ
    ͏ɻ
    ஫ҙࣄ߲

    View full-size slide

  7. • Chef: 1೥
    • Ansible: 2೥
    • CloudFormation: 2೥
    • Terraform: 3೥
    ๻ͷวྺ

    View full-size slide

  8. • σΟϨΫτϦઃܭ
    • Environment Λ෼͚Δ
    • tfstate ͸ s3 backend ʹ
    • Workspace ͷ׆༻
    • Map ؔ਺ϑϧ׆༻
    ৄղʂTerraform Best Practices in 2017

    View full-size slide

  9. • σΟϨΫτϦઃܭ
    ӨڹൣғΛݶఆ͢ΔͨΊ
    not_immutableͱimmutableΛ෼͚Δ
    ࠶ར༻ੑΛߴΊΔͨΊɺϦιʔε͸moduleԽ͢Δ

    View full-size slide

  10. • EnvironmentΛ෼͚Δ
    WorkspaceΛ׆༻͠ɺ؀ڥΛ෼͚Δ
    ݺͼग़࣌͢͸
    ${terraform.workspace}

    View full-size slide

  11. • Map ؔ਺ϑϧ׆༻
    ؀ڥຖʹϦʔδϣϯΛม͑Δྫ
    υοτ۠੾ΓͰvariableΛఆٛ

    View full-size slide

  12. • tfstate ͸ s3 backend ʹ

    View full-size slide

  13. ৄղʂTerraform Best Practices in 2017

    View full-size slide

  14. • ࣾһͷΦϯϘʔσΟϯάʹ͕͔͔࣌ؒΔ
    • ਺ϲ݄ޙʹࣗ෼Ͱ࡞Δ࣌ʹࢥ͍ग़͢ͷʹ͕͔͔࣌ؒΔ
    • ҰఆͷεΩϧΛ͍࣋ͬͯΔਓ͕͍Δ
    ϕετϓϥΫςΟε͔΋͠Εͳ͍͚Ͳෳࡶ໰୊

    View full-size slide

  15. • ApplyʹؾΛ࢖͏
    • Destroy/Create͠ͳ͍͔৻ॏʹͳΔ
    • ಈ࡞Λཧղ͍ͯ͠ͳ͍ਓʹ҆қʹ࡞ۀΛ೚ͤΒΕͳ͍
    • ͭ·ΓɺҰఆͷεΩϧΛ͍࣋ͬͯΔਓ͕͍Δ
    มߋͷࠩ෼Λҡ࣋͢Δͷʹख͕͔͔ؒΔ

    View full-size slide

  16. • TerraformɺCFnͷରԠΛ଴ͯͳ͍৔߹͸खͰ΍Δʁ
    • ͱ͍͏͜ͱ͸શ෦ΛίʔυԽग़དྷͳ͍
    • ରԠޙʹࠩ෼൓өΛ͠ͳ͖Όɻ݁ߏؾΛ࢖͏ΑͶ
    • ͭ·ΓɺҰఆͷεΩϧΛ͍࣋ͬͯΔਓ͕͍Δ
    ৽͍͠αʔϏεɾػೳʹରԠͯ͠ͳ͍͕࣌͋Δ

    View full-size slide

  17. • ελʔτΞοϓ͸ͦΜͳʹਓ͕͍ͳ͔ͬͨ
    • ډͨͱͯ͠΋Value͋Δ։ൃΛͯ͠΄͍͠
    ͭ·ΓɺҰఆͷεΩϧΛ͍࣋ͬͯΔਓ͕͍Δ

    View full-size slide

  18. ΠΩϦظ
    ਃ͠༁͍͟͝·ͤΜɻෳࡶͰͨ͠

    View full-size slide

  19. • ϩγΞਓʮDynamoDBͷTerraformͷίʔυΛ࡞ͬͯཉ
    ͍͠ʯ
    • ଜओʮΦοέʔʯ
    ͱ͋Δ೔

    View full-size slide

  20. 1. ·ͣSampleΛͦͷ··࣮ߦ͢Δ
    2. σΟϨΫτϦઃܭ
    3. EnvironmentΛ෼͚Δ
    1. s3 backend
    4. Workspaceͷ׆༻
    1. Mapؔ਺ϑϧ׆༻
    ΍Δ͜ͱ

    View full-size slide

  21. 1. ·ͣSampleΛͦͷ··࣮ߦ͢Δ

    View full-size slide

  22. 2. σΟϨΫτϦઃܭ
    ӨڹൣғΛݶఆ͢ΔͨΊ
    not_immutableͱimmutableΛ෼͚Δ
    ࠶ར༻ੑΛߴΊΔͨΊɺϦιʔε͸moduleԽ͢Δ

    View full-size slide

  23. 3. EnvironmentΛ෼͚Δ
    WorkspaceΛ׆༻͠ɺ؀ڥΛ෼͚Δ
    ݺͼग़࣌͢͸
    ${terraform.workspace}

    View full-size slide

  24. 4. tfstate ͸ s3 backend ʹ

    View full-size slide

  25. 5. tfstate ͸ s3 backend ʹ
    ؀ڥຖʹϦʔδϣϯΛม͑Δྫ
    υοτ۠੾ΓͰvariableΛఆٛ

    View full-size slide

  26. • 1೥ͿΓʹTerraformΛௐ΂Δ
    • forจ͸Ͱ͖ͳ͍ʁʂͯ͜ͱ͸ɾɾ
    • Μʁ0.12Ͱ͸forจ͕࢖͑Δͱͳ
    • 0.12ΛϏϧυ͢Δ͔ʁ͍΍ɺ·ͱ΋ʹಈ͔ͳ͍ͷ΋໘౗ͩͳ
    • ΜʁTerraform Module Registryͱ͍͏΋ͷ͕͋ΔͧɻGithubʹ
    ίʔυ্͕͕ͬͯΔ
    • moduleͷࢀߟʹͤͯ͞΋Β͓͏
    ΋ͬͱΩϨΠʹॻ͚ͳ͍΋ͷ͔

    View full-size slide

  27. Terraform Module Registry

    View full-size slide

  28. Terraform Module Registry
    ৺ͷ੠
    ʮ͍΍ɺԶ͜Μͳࣄͯ͠Δ৔߹͡Όͳ͍ʯ

    View full-size slide

  29. ๻ͷ໾ׂ
    Πϯϑϥ
    ୲౰ऀ
    Πϯϑϥ
    ੹೚ऀ
    ϓϩμΫτ
    Φʔφʔ
    Time
    ੹೚

    View full-size slide

  30. • ʮͦΕ࡞ͬͯফͯ͠࡞ͬͯফͯ͠ɺຬ଍ߦ͘ίʔυ͸ͲΕ͘Β͍
    ͷ࣌ؒͰ࡞ΕΔʁʯ
    • ʮ୭͕໘౗ݟΕΔʁʯ
    • ʮͦ΋ͦ΋DynamoDBͬͯͦΜͳԿճ΋࡞Δʁʯ
    • ʮDynamoDBͷมߋ࡞ۀ΋গͳ͘Ͷʁʯ
    • ʮࠩ෼ؾʹ͠ͳ͕ΒɺίʔυͷϦϑΝΫλߟ͑ͳ͕Β࢖͏ϝ
    Ϧοτ͋Δʁʯ
    ͦͷ࣌ͷ৺ͷ੠ू

    View full-size slide

  31. • ʮͦ͏͍͑͹ɺRedshiftͷ࣌΋ࢥͬͨʯ
    • ʮSampleࢼͯ͠ɺmoduleԽͯ͠ɺΩϨΠͳίʔυʹͯ͠…ʯ
    • ʮͰɺRedshiftͷσϓϩΠ͕Ұճ20-30෼͔͔Δ͔ΒɺԿճ͔΍Γ
    ௚ͯ͠…ʯ
    • ʮͦΕԿ͔͔࣌ؒΔͶΜɻϘλϯϙνϙνͰ਺෼Ͱग़དྷΔ΍Μʯ
    • ʮdevɺstgɺprod࡞ͬͯ΋࡞ۀ࣌ؒ͸10෼ఔ౓΍Μʯ
    • ʮࠩ෼ؾʹ͠ͳ͕ΒɺίʔυͷϦϑΝΫλߟ͑ͳ͕Β࢖͏ϝϦο
    τ͋Δʁʯ
    ͦͷ࣌ͷ৺ͷ੠ू ͦͷ̎

    View full-size slide

  32. • ʮͦ͏͍͑͹ɺRedshiftͷ࣌΋ࢥͬͨʯ
    • ʮSampleࢼͯ͠ɺmoduleԽͯ͠ɺΩϨΠͳίʔυʹͯ͠…ʯ
    • ʮͰɺRedshiftͷσϓϩΠ͕Ұճ20-30෼͔͔Δ͔ΒɺԿճ͔΍Γ
    ௚ͯ͠…ʯ
    • ʮͦΕԿ͔͔࣌ؒΔͶΜɻϘλϯϙνϙνͰ਺෼Ͱग़དྷΔ΍Μʯ
    • ʮdevɺstgɺprod࡞ͬͯ΋࡞ۀ࣌ؒ͸10෼ఔ౓΍Μʯ
    • ʮࠩ෼ؾʹ͠ͳ͕ΒɺίʔυͷϦϑΝΫλߟ͑ͳ͕Β࢖͏ϝϦο
    τ͋Δʁʯ
    ͦͷ࣌ͷ৺ͷ੠ू ͦͷ̎
    ʮ͍΍ɺແཧʯ

    View full-size slide

  33. FacebookͰᄁ͖ɺࠓʹࢸΔ

    View full-size slide

  34. Infrastructure as CodeʹർΕͨͷͰɺ
    ๻͕ͨͪຊདྷ΍Γ͔ͨͬͨ͜ͱΛ੔ཧ͢Δ
    Shogo MuranushiɹABEJA, Inc. Product Owner & Lead Infrastructure Engineer

    View full-size slide

  35. • Infrastructure as Codeͱ͸
    • ࣗಈԽɺόʔδϣϯ؅ཧɺςετɺܧଓతΠϯςάϨʔγϣ
    ϯɺܧଓతσϓϩΠͱ͍ͬͨɺιϑτ΢ΣΞ։ൃͷϓϥΫςΟ
    εΛγεςϜ؅ཧʹԠ༻͢ΔͨΊͷํ๏࿦
    • ޻਺࡟ݮɺ࡞ۀཤྺɺςετࣗಈԽɺΦϖϛε࡟ݮɺϨϏϡʔɾ
    ϑϩʔͷϝϦοτ
    ͦ΋ͦ΋ Infrastrucure as CodeͰ࣮ݱ͔ͨͬͨ͜͠ͱ

    View full-size slide

  36. • ϙνϙνΛ਺෼ͰऴΘΔ͸͕ͣ
    • ίʔυԽʹ͕͔͔࣌ؒΔ
    • ϦϑΝΫλ͍ͨ͠ප͕ൃප͢Δ
    • ࠩ෼ͷ੔߹ΛऔΔͷʹ࣌ؒͱؾΛ࢖͏
    • ίʔυͷ֦ுੑΛ্͛ΔͱɺՄಡੑ͕Լ͕ΓෳࡶʹͳΔɻෑډ্͕͕Δ
    • ίʔυͷγϯϓϧʹ͢ΔͱɺՄಡੑ͸্͕Δ͕֦ுੑʹ͚ܽΔ
    • moduleͷ࠶ར༻ੑͷ೉͠͞
    ͨͩ͠ɺਏ͍͜ͱ͕ͨ͘͞Μ͋Δ

    View full-size slide

  37. ߟ͑Δ΂͖ϙΠϯτ

    View full-size slide

  38. • ମ੍
    • ૊৫
    • ࣄۀϑΣʔζ
    ࣗ෼͕ஔ͔Ε͍ͯΔ؀ڥʹΑͬͯద༻༗ແΛߟ͑Δ
    େࣄ

    View full-size slide

  39. • ʮίʔυԽ͸ਖ਼ٛʯഇࢭ͢Δ
    • ROIΛߟ͑ͯख࡞ۀ΋ࢹ໺ʹ
    ͳΜͰ΋͔ΜͰ΋ίʔυԽ͢Δͷ͸ࣙΊΔ
    • ref:

    View full-size slide

  40. • Φϖϛε͕͋Δ
    • ه࿥͕࢒Βͳ͍
    • ࠶ݱੑ͕ͳ͍
    • ࢖͍ճͤͳ͍
    • ϨϏϡʔ͕Ͱ͖ͳ͍
    ख࡞ۀͰ͸μϝͳͷ͔ɻԿ͕μϝͳͷ͔

    View full-size slide

  41. • Φϖϛε͕͋Δ
    • Φϖϛεͯ͠΋OKͳͱ͜ΖɺNGͳͱ͜Ζ෼͚ͯΔʁ
    • ه࿥͕࢒Βͳ͍
    • ࡞ۀ಺༰ɺཤྺ͸ʢExcelʣGithubͰ؅ཧ
    • ٯʹࠓͷঢ়ଶΛExport͍ͨ͠
    • ࠶ݱੑ͕ͳ͍
    • ຊ౰ʹ࠶ݱ͢Δඞཁ͋Δʁ
    ୅Ҋ͸ʁ

    View full-size slide

  42. • ࢖͍ճͤͳ͍
    • ຊ౰ʹ࢖͍ճ͢ʁʁ
    • ٯʹࠓͷঢ়ଶΛExport => Import͍ͨ͠
    • ϨϏϡʔ͕Ͱ͖ͳ͍
    • ࡞ۀ಺༰ɺมߋ͢ΔύϥϝʔλΛࣄલʹϨϏϡʔ͢Δ
    ୅Ҋ͸ʁ

    View full-size slide

  43. • CLIͷίϚϯυΛه࿥ʹ࢒ͯ͠ɺ࣮ߦ͢Δ
    • Φϖϛεগͳ͍
    • ه࿥͸࢒Δ
    • ࠶ݱੑ͸͋Δ
    • ࢖͍ճͤΔ
    • ϨϏϡʔͰ͖Δ
    • ႈ౳Ͱ͸ͳ͍ɻએݴతͰ͸ͳ͍
    ୅Ҋ͸ʁ

    View full-size slide

  44. εϥϜμϯΫઋಓ͞Μ
    ʮ·ͩ͋ΘͯΔΑ͏ͳ࣌ؒ͡Όͳ͍ʯ

    View full-size slide

  45. • ख࡞ۀͰ͸Կ͕μϝͳͷ͔ɺμϝͳཧ༝Λ΋͏Ұ౓ચ͍ग़͢
    • CLI΍ଞͷ୅Ҋ͕ग़ͯ͘Δ
    • ঢ়گΛؑΈͯཁ݅Λຬͨͭͭ͠ɺίετɺεϐʔυɺϦεΫΛධ
    Ձ͠ɺ୅Ҋͷํ͕ίʔυԽΑΓROI͕ߴ͍ͳΒɺ୅ҊͰOK
    • ྫʣDBͱ͔CDNͬͯԿճ΋࡞Βͳ͍ΑͶɾɾʁ
    • ίετɺεϐʔυɺϦεΫͷ؍఺ͰίʔυԽͷํ͕ROI͕ߴ͍ͳ
    ΒɺίʔυԽͰOK
    ʢࣗ෼ʹରͯ͠ʣྫྷ੩ʹͳΓ·͠ΐ͏

    View full-size slide

  46. • ίʔυԽ͠ͳ͍
    • DBͱ͔CDNͷΑ͏ͳԿճ΋࡞Βͳ͍Α͏ͳ΍ͭʢίετޮ཰ѱ͍ʣ
    • ҙਤ͠ͳ͍ಈ࡞Λڐ༰Ͱ͖ͳ͍εςʔτ࣋ͭܥʢϦεΫΛڐ༰Ͱ͖ͳ͍ʣ
    • Πϯϑϥͷਓ਺͕গͳ͍ʢֶशίετ͕͔͔ΓɺεϐʔυམͪΔʣ
    ίετɺεϐʔυɺϦεΫͷධՁྫ

    View full-size slide

  47. • ίʔυԽ͢Δ
    • ALB + EC2 + RDBͷηοτ͸όϯόϯ࡞ΔΜͩΑͶʔʢίετޮ཰ྑ͍ʣ
    • DR༻ʹ͙͢ʹ্ཱͪ͛Δඞཁ͕͋Δʢεϐʔυ͋Δʣ
    • ଟϦʔδϣϯʹαʔϏεల։͢Δ໺๬͕͋Δʢεϐʔυ͋Δʣ
    • ϦιʔεؒΛܨ͍Ͱ͍Δܥʢίετޮ཰ߴ͍ʣ
    • ΦϖϛεΛՄೳͳݶΓഉআ͍ͨ͠ʢࣗಈԽʹΑΔϦεΫϔοδ͸Մೳʣ
    • ͕͔ͩ͠͠
    ίετɺεϐʔυɺϦεΫͷධՁྫ

    View full-size slide

  48. • ա౓ʹΩϨΠʹ͠ա͗ͳ͍
    • ଍Γͳ͍ػೳΛิ͏ͨΊʹத਎͕ෳࡶͳίʔυʹϋʔυϧ্͕Δ
    • ඞཁ͋Β͹ຊՈʹPRग़ͦ͏
    • ׂΓ੾ͬͯखͰ΋ྑ͍΍Μ
    ίʔυԽ͢Δ࣌ͷ஫ҙ఺

    View full-size slide

  49. ࠓͷ๻ͷঢ়ଶ
    ͜͏ͳΒͳ͍Α͏ʹ
    ROIߟ͑·͠ΐ͏

    View full-size slide

  50. ͦͷޙʹ৭ʑͳਓͱ࿩ͨ݁͠࿦

    View full-size slide

  51. IaCͷ֓೦͸ྑ͍͕ʮπʔϧ͕௥͍͍͍ͭͯͳ͍ʯ

    View full-size slide

  52. Infrastructure as Code
    IaCͷ֓೦͸ྑ͍͕ʮπʔϧ͕௥͍͍͍ͭͯͳ͍ʯ
    ֓೦

    View full-size slide

  53. IaCͷ֓೦͸ྑ͍͕ʮπʔϧ͕௥͍͍͍ͭͯͳ͍ʯ
    Infrastructure as Code
    Tool
    ֓೦
    πʔϧ

    View full-size slide

  54. Infrastructure as Code
    Tool
    IaCͷ֓೦͸ྑ͍͕ʮπʔϧ͕௥͍͍͍ͭͯͳ͍ʯ
    ֓೦
    πʔϧ
    ར఺
    ՝୊

    View full-size slide

  55. Infrastructure as Code
    Tool
    IaCͷ֓೦͸ྑ͍͕ʮπʔϧ͕௥͍͍͍ͭͯͳ͍ʯ
    ֓೦
    πʔϧ
    ར఺
    ՝୊

    View full-size slide

  56. πʔϧ
    ֓೦
    IaCͷ֓೦͸ྑ͍͕ʮπʔϧ͕௥͍͍͍ͭͯͳ͍ʯ
    Infrastructure as Code
    Tool
    ͦΕٻΊ͗ͪ͢Ό͏ʁ

    View full-size slide

  57. ଞͷ֓೦΋ಉ͡
    • ϚΠΫϩαʔϏεͳͲ΋ಉ͡
    • ֓೦͸ྑ͍͚Ͳπʔϧ͕௥͍͍͍ͭͯͳ͍͜ͱ͕ଟ͍
    • ͭ·Γʮۜͷ஄ؙͰ͸ͳ͍ʯঢ়ଶ

    View full-size slide

  58. Կ͕͠ΜͲ͔͔ͬͨ
    • πʔϧ͕ղܾͯ͘͠ΕΔ՝୊ͱɺπʔϧ͕௥͍͍͍ͭͯͳ͍෦෼
    ΛΧόʔ͢Δγϯυ͞
    • ͜ͷఱṝͷόϥϯεΛؑΈͯɺࣄۀϑΣʔζɺ๻ͷཱ৔ɺνʔϜ
    ମ੍ͩͱIaC͸γϯυ͔ͬͨ

    View full-size slide

  59. ࠾༻ɾෆ࠾༻ج४ʹ͍ͭͯ
    • ֓೦͕ղܾ͢Δ՝୊͸͘͢͝ଟ͍͕ɺਓͦΕͧΕ૊৫΍ஔ͔Ε͍ͯΔཱ৔ɺ
    ࣄۀϑΣʔζ͕ҧ͏ͨΊɺ՝୊ʹରͯ͠ͷॏΈ͕ҧ͏
    • Agile΍DevOpsͷ֓೦΋ࣅͨΑ͏ͳ΋ͷ
    • ͦΕΒ͕ղܾ͢Δ՝୊ͱ͸ʁࠓͷࣄۀϑΣʔζɺνʔϜͷεΩϧɾମ੍ɾҾ
    ͖ܧ͗ͳͲɺͲ͏͍͏νʔϜʹ͍͔ͨ͠ʁͰมΘͬͯ͘Δ

    View full-size slide

  60. ৽͍ٕ͠ज़΍֓೦͸ɺࣄۀϑΣʔζɺνʔϜͷମ
    ੍ɺࠓޙɺͳͲΛ౿·͑ͯݕ౼͠·͠ΐ͏
    νʔϜن໛
    ੒௕༏ઌ
    ҆ఆ༏ઌ
    ଐਓԽഉআ
    ଐਓԽͪ͠Ό͏
    ಉ͡εΩϧͷਓগͳ͍
    ಉ͡εΩϧͷਓଟ͍
    ച্

    View full-size slide

  61. ৽͍ٕ͠ज़΍֓೦͸ɺࣄۀϑΣʔζɺνʔϜͷମ
    ੍ɺࠓޙɺͳͲΛ౿·͑ͯݕ౼͠·͠ΐ͏
    νʔϜن໛
    ੒௕༏ઌ
    ҆ఆ༏ઌ
    ଐਓԽഉআ
    ଐਓԽͪ͠Ό͏
    ಉ͡εΩϧͷਓগͳ͍
    ಉ͡εΩϧͷਓଟ͍
    ച্ ٞ࿦͢Δͱ͖͸
    ͜ͷลΓͷೝࣝΛ߹ΘͤΔ

    View full-size slide

  62. ͱ͸͍͑ศརͳ͜ͱ͸͋Δ
    ͳͷͰɺશͯΛͦͷٕज़Ͱղܾ͢Δඞཁ͸ͳ͍

    View full-size slide

  63. ʮશͯΛIaCͰ΍Δඞཁ͸ͳ͍ʯ
    • ొஃޙ͸͜ͷҙݟ͕ଟ͔ͬͨ
    • શ෦IaCͰద༻͢Δͷ͸ʮRDBΛࣺͯͯશͯKVSʂʯ΍ʮશ෦αʔ
    όϨε΍Ͱ͐ʯͱಉ͡ɻదࡐదॴ͕Ұ൪ύϑΥʔϚϯε͕ྑ͍
    • freee͞ΜͷࢿྉͰʮશͯͷཁ݅ΛkubernetesͰ࣮૷ʯ͡Όͳ͘
    ͯɺஔ͖׵͑Մೳͳ෦඼ʹ͓ͯ͘͜͠ͱɻͱ͔͸௨ͣΔ
    • ͡Ό͋ʮదࡐదॴʯΛݟ෼͚Δʹ͸ʁ

    View full-size slide

  64. ٕज़౤ࢿɻ௒େࣄɻઈର΍Δ΂͖

    View full-size slide

  65. ݸਓͷ੒௕͕ձࣾͷ੒௕
    • ྫ͑͹ɺτϨϯυͷٕज़ͷ༻్ΛݟۃΊͯదࡐదॴͰ৭ʑͳαʔϏεɾπʔϧΛ૊
    Έ߹ΘͤΕ͹ແବ͕ݮΓࣄۀ੒௕͕Ճ଎͢Δ
    • AWSΛֶͿ͜ͱͰʮނোͷͨΊͷઃܭʢdesign for faillerʣʯΛֶ΂Δ
    • KubernetesΛֶͿ͜ͱͰʮએݴతΞʔΩςΫνϟ͸͜͏͍͏͜ͱ͔ʯͱ͍͏ઃ
    ܭΛֶ΂ΔɺͳͲ
    • ͦΕͳΒ͹ɺࣄۀΛ੒௕ͤ͞Δ্Ͱ৽͍ٕ͠ज़΍֓೦ͷशಘʢ౤ࢿʣ͸ඞਢ
    • ୭͔͚ͩ৽͍͜͠ͱΛֶͿͷ͸ଞ͕෇͍ͯ͜ͳ͍͔΋͠Εͳ͍ͷͰɺνʔϜ಺Ͱͦ
    ΕͧΕٕज़Λֶͼ߹͍ɺ͓ޓ͍Ͱڞ༗͋͠͏ͷ΋͋Γ

    View full-size slide

  66. ݸਓత౤ࢿײ֮͸10-20%ఔ౓ɻͦͷఔ౓͸৽͠
    ͍νϟϨϯδʹճ͢
    • KubernetesͰ΋ྑ͍͠ɺTerraformͰ΋ྑ͍ɻͱΓ͋͑ͣ࢖ͬͯΈΔͬͯ΋ͷ༗Γͩ͠ɺ
    ͩ͜ΘͬͯϕετϓϥΫςΟεΛݟ͚ͭʹߦ͘ͷ΋͋Γ
    • ͪΐͬͱͰ΋ྑ͍͔Βຊ൪ʹऔΓೖΕͯΈΔɻେࣄɻݕূͱຊ൪Ͱ͸ֶ΂Δྔ͕਺ഒҧ͏
    • ʮ๩͍͔͠Β10-20%΋औΕͳ͍ʯ͸ݴ͍༁ɻ୭͕ѱ͍ͬͯ૊৫ͷ੹೚ऀ͕ѱ͍ɻ૊৫Λ
    ੒௕ͤ͞Δؾ͸͋Δͷ͔ɻͦ͜ʹίϛοτ͢Δؾ͕͋ΔͷʹͰ͖ͳ͍ͳΒଵຫɻਓͷΞα
    Πϯ΋ؚΊͯମ੍ͮ͘ΓΛ͢΂͖
    • ࣦഊ΋੒௕ͷҰͭʢԿ͕μϝͩͬͨͷ͔΋ཧղͰ͖Δʣ

    View full-size slide

  67. ͡Ό͋ɺԿ͔Β࢝ΊΔʁͦͷޙͷIaCͷτϨϯυ

    View full-size slide

  68. 2019೥ͷτϨϯυ
    • AWS CDK —> ॕGAʂʂ
    • Terraform —> v0.12 ϦϦʔεʂʂ
    • Terraformer ??

    View full-size slide

  69. AWS CDK
    • ͨͿΜ୭͔͕঺հͯ͘͠ΕΔͱࢥ͏ͷͰɺҰൠతͳ͜ͱ͸ॻ͔ͳ͍
    • No YAML, Yes Programing Language.
    • গͳ͍ίʔυྔͰଟ͘ͷ͜ͱ͕࣮ݱͰ͖Δ
    • Ͱ΋ɺCFnͳͷͰద༻࣌ͷڍಈͷཧղ͸ඞཁɻ࡞Δ͚ͩͷ෼͸ָ
    • ͨͿΜҰੈΛ෩ᴆ͢ΔΜ͡Όͳ͍͔ͳ
    • ࣾ಺Ͱ͸SDKͰ΋ྑ͍Μ͡ΌͶʁͱ͍͏੠͕

    ʢಈ͖෼͔Δͱ͍͏ҙຯͰʣ

    View full-size slide

  70. Terraform v0.12
    • for, for_eachจ͕ॻ͚ΔΑ͏ʹͳͬͨ
    • NullΛׂΓ౰ͯՄೳʹʢʹఆٛͯ͠ͳ͍͜ͱͱಉ͡ʣ
    • Split΋ѻ͍΍͘͢
    • ͦͷଞ৭ʑ
    • ͑ɺɺ͜͜·ͰདྷͨΒϓϩάϥϛϯάݴޠͰॻ͘CDKͷํ͕…?
    • ͋·ΓτϦοΩʔͳػೳΛ࢖͍͗͢Δͱ୭΋෇͍ͯ͜Εͳ͍ͷͰ

    ༻๏༻ྔ͸஫ҙ͠·͠ΐ͏

    View full-size slide

  71. ݸਓతײ૝
    • ਺೥ޙʹ͸ ൚༻ݴޠ vs DSL ໰୊͕ຄൃ͢Δ
    • Ͱ΋ɺঃʑʹऩଋָͯ͠ʹͳΔ͸ͣͳͷͰWelcome
    • CDKͩͱॻ͘͜ͱ͸ָʹͳΔ
    • ͚Ͳɺӡ༻ɾҡ࣋͢Δ͜ͱ͸ผɻCFnΛϥοϓ͍ͯ͠Δ͚ͩͳ
    ͷͰίʔυͷద༻࣌ͷڍಈ͸มΘΒͣཧղ͕ඞཁ

    View full-size slide

  72. ݸਓతײ૝
    • ʮ࡞Δʯͬͯͷ͸IaCͰ՝୊ղܾͯ͠ɺʮӡ༻ʯ͸IaCͰղܾ͠ͳ
    ͍ͷ͸͋Γɻ
    • IaC͸࢖͍ࣺͯɻ͋͘·ͰɺαʔϏεؒͷܨ͗ͱ͔Λදݱ͢Δ΋
    ͷɻߏஙखॱͱͯ͠දݱ͢Δ΋ͷɻͱ͔ɻ࣮ࡍͷύϥϝʔλ͸
    AWSίϯιʔϧݟͯͶͱ͔༗Γͩͱࢥ͏ɻ

    View full-size slide

  73. Infrastructure as Code
    Tool
    ࢖͍ࣺͯIaCͷ৔߹ͷ Pro/Con

    View full-size slide

  74. αΫοͱ΍ͬͯϋϚΓͦ͏ͳ৚݅Λ·ͱΊΔ

    View full-size slide

  75. ·͞ʹ޲͍͍ͯΔɻ͙͢ʹͰ΋΍ͬͨํ͕͍͍΍ͭ
    • ඵͰ൓ө͞ΕΔ
    • ফͯ͠΋ɺ͙͢ʹద༻͢Ε͹໰୊ͳ͍
    • Կճ΋࡞Δ
    • ྫ
    • Datadog: Monitor
    • AWS: CloudTrail, SNS, SQS, Route53, etc…
    • ͜ͷล͔Β࢝ΊΔͱɺॻ͖ํ΍࢖͍উख͕෼͔Δ

    View full-size slide

  76. ·͞ʹ޲͍͍ͯͳ͍
    • ࡞੒ʹ͕͔͔࣌ؒΔ΍ͭʢDBܥʣ
    • Կճ΋࡞Βͳ͍΍ͭʢRedShift΍CloudFrontʣ
    • ফ͢ͱϚζΠ΍ͭ
    • Α͘มߋ͢Δ΍ͭ
    • ͜ͷล͔Β࢝ΊΔͱɺ1ճ1ճͷ࡞ۀ͕ා͍ɻࠩ෼͕ग़ͨͱ͖ʹຖ
    ճٵऩ͢Δͷ͕ਏ͍ɻ͔͔࣌ؒΔͷͰςετ͔ͳΓ͠ΜͲ͍

    View full-size slide

  77. ·ͱΊ
    • ֓೦ʹπʔϧ͕௥͍͔ͭͳ͍͜ͱ͸Α͋͘Δɻਏ͍ɻROIߟ͑Δɻ
    • Ͱ΋֓೦ʢίϯηϓτʣ΍πʔϧ͔Βֶ΂Δ͜ͱ͸ଟ͍ɻ
    • 10 - 20%ఔ౓ʢ਺஋͸ࣗ༝ʣͷٕज़౤ࢿ͸ߦֶ͍ͼଓ͚Δɻ
    • ֶͦͯ͠Μͩ͜ͱΛࣄۀͷ੒௕଎౓ʹ׆͔͢ɻࣦഊ΋ؚΊͯɻ

    View full-size slide

  78. ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠

    View full-size slide