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

F8f7692cb46c0f7feda5210a46b47bcf?s=128

shogomuranushi

July 31, 2019
Tweet

Transcript

  1. Infrastructure as CodeʹർΕͨͷͰ ๻͕ͨͪຊདྷ΍Γ͔ͨͬͨ͜ͱΛ੔ཧ͢Δ +α X-Tech JAWS & JAWS-UGΞʔΩςΫνϟઐ໳ࢧ෦ ίϥϘษڧձ#02

    Shogo Muranushi
  2. Shogo Muranushi ABEJA, Inc. - ABEJA Platform Product Owner -

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

    • ·ͱΊ
  8. JAWS DaysͰ࿩ͨ͠಺༰ͷ͓͞Β͍ ʢ5෼όʔδϣϯʣ

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

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

  11. • Chef: 1೥ • Ansible: 2೥ • CloudFormation: 2೥ •

    Terraform: 3೥ ๻ͷวྺ
  12. None
  13. • σΟϨΫτϦઃܭ • Environment Λ෼͚Δ • tfstate ͸ s3 backend

    ʹ • Workspace ͷ׆༻ • Map ؔ਺ϑϧ׆༻ ৄղʂTerraform Best Practices in 2017
  14. • σΟϨΫτϦઃܭ ӨڹൣғΛݶఆ͢ΔͨΊ not_immutableͱimmutableΛ෼͚Δ ࠶ར༻ੑΛߴΊΔͨΊɺϦιʔε͸moduleԽ͢Δ

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

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

  17. • tfstate ͸ s3 backend ʹ

  18. None
  19. ৄղʂTerraform Best Practices in 2017

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

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

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

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

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

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

  26. 1. ·ͣSampleΛͦͷ··࣮ߦ͢Δ 2. σΟϨΫτϦઃܭ 3. EnvironmentΛ෼͚Δ 1. s3 backend 4.

    Workspaceͷ׆༻ 1. Mapؔ਺ϑϧ׆༻ ΍Δ͜ͱ
  27. 1. ·ͣSampleΛͦͷ··࣮ߦ͢Δ

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

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

  30. 4. tfstate ͸ s3 backend ʹ

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

  32. None
  33. None
  34. • 1೥ͿΓʹTerraformΛௐ΂Δ • forจ͸Ͱ͖ͳ͍ʁʂͯ͜ͱ͸ɾɾ • Μʁ0.12Ͱ͸forจ͕࢖͑Δͱͳ • 0.12ΛϏϧυ͢Δ͔ʁ͍΍ɺ·ͱ΋ʹಈ͔ͳ͍ͷ΋໘౗ͩͳ • ΜʁTerraform

    Module Registryͱ͍͏΋ͷ͕͋ΔͧɻGithubʹ ίʔυ্͕͕ͬͯΔ • moduleͷࢀߟʹͤͯ͞΋Β͓͏ ΋ͬͱΩϨΠʹॻ͚ͳ͍΋ͷ͔
  35. Terraform Module Registry

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

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

  38. • ʮͦΕ࡞ͬͯফͯ͠࡞ͬͯফͯ͠ɺຬ଍ߦ͘ίʔυ͸ͲΕ͘Β͍ ͷ࣌ؒͰ࡞ΕΔʁʯ • ʮ୭͕໘౗ݟΕΔʁʯ • ʮͦ΋ͦ΋DynamoDBͬͯͦΜͳԿճ΋࡞Δʁʯ • ʮDynamoDBͷมߋ࡞ۀ΋গͳ͘Ͷʁʯ •

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

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

    ʮdevɺstgɺprod࡞ͬͯ΋࡞ۀ࣌ؒ͸10෼ఔ౓΍Μʯ • ʮࠩ෼ؾʹ͠ͳ͕ΒɺίʔυͷϦϑΝΫλߟ͑ͳ͕Β࢖͏ϝϦο τ͋Δʁʯ ͦͷ࣌ͷ৺ͷ੠ू ͦͷ̎ ʮ͍΍ɺແཧʯ
  41. FacebookͰᄁ͖ɺࠓʹࢸΔ

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

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

    ϑϩʔͷϝϦοτ ͦ΋ͦ΋ Infrastrucure as CodeͰ࣮ݱ͔ͨͬͨ͜͠ͱ
  44. • ϙνϙνΛ਺෼ͰऴΘΔ͸͕ͣ • ίʔυԽʹ͕͔͔࣌ؒΔ • ϦϑΝΫλ͍ͨ͠ප͕ൃප͢Δ • ࠩ෼ͷ੔߹ΛऔΔͷʹ࣌ؒͱؾΛ࢖͏ • ίʔυͷ֦ுੑΛ্͛ΔͱɺՄಡੑ͕Լ͕ΓෳࡶʹͳΔɻෑډ্͕͕Δ

    • ίʔυͷγϯϓϧʹ͢ΔͱɺՄಡੑ͸্͕Δ͕֦ுੑʹ͚ܽΔ • moduleͷ࠶ར༻ੑͷ೉͠͞ ͨͩ͠ɺਏ͍͜ͱ͕ͨ͘͞Μ͋Δ
  45. ߟ͑Δ΂͖ϙΠϯτ

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

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

  48. • Φϖϛε͕͋Δ • ه࿥͕࢒Βͳ͍ • ࠶ݱੑ͕ͳ͍ • ࢖͍ճͤͳ͍ • ϨϏϡʔ͕Ͱ͖ͳ͍

    ख࡞ۀͰ͸μϝͳͷ͔ɻԿ͕μϝͳͷ͔
  49. • Φϖϛε͕͋Δ • Φϖϛεͯ͠΋OKͳͱ͜ΖɺNGͳͱ͜Ζ෼͚ͯΔʁ • ه࿥͕࢒Βͳ͍ • ࡞ۀ಺༰ɺཤྺ͸ʢExcelʣGithubͰ؅ཧ • ٯʹࠓͷঢ়ଶΛExport͍ͨ͠

    • ࠶ݱੑ͕ͳ͍ • ຊ౰ʹ࠶ݱ͢Δඞཁ͋Δʁ ୅Ҋ͸ʁ
  50. • ࢖͍ճͤͳ͍ • ຊ౰ʹ࢖͍ճ͢ʁʁ • ٯʹࠓͷঢ়ଶΛExport => Import͍ͨ͠ • ϨϏϡʔ͕Ͱ͖ͳ͍

    • ࡞ۀ಺༰ɺมߋ͢ΔύϥϝʔλΛࣄલʹϨϏϡʔ͢Δ ୅Ҋ͸ʁ
  51. • CLIͷίϚϯυΛه࿥ʹ࢒ͯ͠ɺ࣮ߦ͢Δ • Φϖϛεগͳ͍ • ه࿥͸࢒Δ • ࠶ݱੑ͸͋Δ • ࢖͍ճͤΔ

    • ϨϏϡʔͰ͖Δ • ႈ౳Ͱ͸ͳ͍ɻએݴతͰ͸ͳ͍ ୅Ҋ͸ʁ
  52. ͭ·Γ

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

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

    ίετɺεϐʔυɺϦεΫͷ؍఺ͰίʔυԽͷํ͕ROI͕ߴ͍ͳ ΒɺίʔυԽͰOK ʢࣗ෼ʹରͯ͠ʣྫྷ੩ʹͳΓ·͠ΐ͏
  55. ROIΛߟ͑Δ

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

  57. • ίʔυԽ͢Δ • ALB + EC2 + RDBͷηοτ͸όϯόϯ࡞ΔΜͩΑͶʔʢίετޮ཰ྑ͍ʣ • DR༻ʹ͙͢ʹ্ཱͪ͛Δඞཁ͕͋Δʢεϐʔυ͋Δʣ

    • ଟϦʔδϣϯʹαʔϏεల։͢Δ໺๬͕͋Δʢεϐʔυ͋Δʣ • ϦιʔεؒΛܨ͍Ͱ͍Δܥʢίετޮ཰ߴ͍ʣ • ΦϖϛεΛՄೳͳݶΓഉআ͍ͨ͠ʢࣗಈԽʹΑΔϦεΫϔοδ͸Մೳʣ • ͕͔ͩ͠͠ ίετɺεϐʔυɺϦεΫͷධՁྫ
  58. • ա౓ʹΩϨΠʹ͠ա͗ͳ͍ • ଍Γͳ͍ػೳΛิ͏ͨΊʹத਎͕ෳࡶͳίʔυʹϋʔυϧ্͕Δ • ඞཁ͋Β͹ຊՈʹPRग़ͦ͏ • ׂΓ੾ͬͯखͰ΋ྑ͍΍Μ ίʔυԽ͢Δ࣌ͷ஫ҙ఺

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

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

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

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

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

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

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

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

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

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

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

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

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

    ٞ࿦͢Δͱ͖͸ ͜ͷลΓͷೝࣝΛ߹ΘͤΔ
  72. ͱ͸͍͑ศརͳ͜ͱ͸͋Δ ͳͷͰɺશͯΛͦͷٕज़Ͱղܾ͢Δඞཁ͸ͳ͍

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

    ͡Ό͋ʮదࡐదॴʯΛݟ෼͚Δʹ͸ʁ
  74. ٕज़౤ࢿɻ௒େࣄɻઈର΍Δ΂͖

  75. ݸਓͷ੒௕͕ձࣾͷ੒௕ • ྫ͑͹ɺτϨϯυͷٕज़ͷ༻్ΛݟۃΊͯదࡐదॴͰ৭ʑͳαʔϏεɾπʔϧΛ૊ Έ߹ΘͤΕ͹ແବ͕ݮΓࣄۀ੒௕͕Ճ଎͢Δ • AWSΛֶͿ͜ͱͰʮނোͷͨΊͷઃܭʢdesign for faillerʣʯΛֶ΂Δ • KubernetesΛֶͿ͜ͱͰʮએݴతΞʔΩςΫνϟ͸͜͏͍͏͜ͱ͔ʯͱ͍͏ઃ

    ܭΛֶ΂ΔɺͳͲ • ͦΕͳΒ͹ɺࣄۀΛ੒௕ͤ͞Δ্Ͱ৽͍ٕ͠ज़΍֓೦ͷशಘʢ౤ࢿʣ͸ඞਢ • ୭͔͚ͩ৽͍͜͠ͱΛֶͿͷ͸ଞ͕෇͍ͯ͜ͳ͍͔΋͠Εͳ͍ͷͰɺνʔϜ಺Ͱͦ ΕͧΕٕज़Λֶͼ߹͍ɺ͓ޓ͍Ͱڞ༗͋͠͏ͷ΋͋Γ
  76. ݸਓత౤ࢿײ֮͸10-20%ఔ౓ɻͦͷఔ౓͸৽͠ ͍νϟϨϯδʹճ͢ • KubernetesͰ΋ྑ͍͠ɺTerraformͰ΋ྑ͍ɻͱΓ͋͑ͣ࢖ͬͯΈΔͬͯ΋ͷ༗Γͩ͠ɺ ͩ͜ΘͬͯϕετϓϥΫςΟεΛݟ͚ͭʹߦ͘ͷ΋͋Γ • ͪΐͬͱͰ΋ྑ͍͔Βຊ൪ʹऔΓೖΕͯΈΔɻେࣄɻݕূͱຊ൪Ͱ͸ֶ΂Δྔ͕਺ഒҧ͏ • ʮ๩͍͔͠Β10-20%΋औΕͳ͍ʯ͸ݴ͍༁ɻ୭͕ѱ͍ͬͯ૊৫ͷ੹೚ऀ͕ѱ͍ɻ૊৫Λ ੒௕ͤ͞Δؾ͸͋Δͷ͔ɻͦ͜ʹίϛοτ͢Δؾ͕͋ΔͷʹͰ͖ͳ͍ͳΒଵຫɻਓͷΞα

    Πϯ΋ؚΊͯମ੍ͮ͘ΓΛ͢΂͖ • ࣦഊ΋੒௕ͷҰͭʢԿ͕μϝͩͬͨͷ͔΋ཧղͰ͖Δʣ
  77. ͡Ό͋ɺԿ͔Β࢝ΊΔʁͦͷޙͷIaCͷτϨϯυ

  78. 2019೥ͷτϨϯυ • AWS CDK —> ॕGAʂʂ • Terraform —> v0.12

    ϦϦʔεʂʂ • Terraformer ??
  79. AWS CDK • ͨͿΜ୭͔͕঺հͯ͘͠ΕΔͱࢥ͏ͷͰɺҰൠతͳ͜ͱ͸ॻ͔ͳ͍ • No YAML, Yes Programing Language.

    • গͳ͍ίʔυྔͰଟ͘ͷ͜ͱ͕࣮ݱͰ͖Δ • Ͱ΋ɺCFnͳͷͰద༻࣌ͷڍಈͷཧղ͸ඞཁɻ࡞Δ͚ͩͷ෼͸ָ • ͨͿΜҰੈΛ෩ᴆ͢ΔΜ͡Όͳ͍͔ͳ • ࣾ಺Ͱ͸SDKͰ΋ྑ͍Μ͡ΌͶʁͱ͍͏੠͕
 ʢಈ͖෼͔Δͱ͍͏ҙຯͰʣ
  80. Terraform v0.12 • for, for_eachจ͕ॻ͚ΔΑ͏ʹͳͬͨ • NullΛׂΓ౰ͯՄೳʹʢʹఆٛͯ͠ͳ͍͜ͱͱಉ͡ʣ • Split΋ѻ͍΍͘͢ •

    ͦͷଞ৭ʑ • ͑ɺɺ͜͜·ͰདྷͨΒϓϩάϥϛϯάݴޠͰॻ͘CDKͷํ͕…? • ͋·ΓτϦοΩʔͳػೳΛ࢖͍͗͢Δͱ୭΋෇͍ͯ͜Εͳ͍ͷͰ
 ༻๏༻ྔ͸஫ҙ͠·͠ΐ͏
  81. Terraformer

  82. ݸਓతײ૝ • ਺೥ޙʹ͸ ൚༻ݴޠ vs DSL ໰୊͕ຄൃ͢Δ • Ͱ΋ɺঃʑʹऩଋָͯ͠ʹͳΔ͸ͣͳͷͰWelcome •

    CDKͩͱॻ͘͜ͱ͸ָʹͳΔ • ͚Ͳɺӡ༻ɾҡ࣋͢Δ͜ͱ͸ผɻCFnΛϥοϓ͍ͯ͠Δ͚ͩͳ ͷͰίʔυͷద༻࣌ͷڍಈ͸มΘΒͣཧղ͕ඞཁ
  83. ݸਓతײ૝ • ʮ࡞Δʯͬͯͷ͸IaCͰ՝୊ղܾͯ͠ɺʮӡ༻ʯ͸IaCͰղܾ͠ͳ ͍ͷ͸͋Γɻ • IaC͸࢖͍ࣺͯɻ͋͘·ͰɺαʔϏεؒͷܨ͗ͱ͔Λදݱ͢Δ΋ ͷɻߏஙखॱͱͯ͠දݱ͢Δ΋ͷɻͱ͔ɻ࣮ࡍͷύϥϝʔλ͸ AWSίϯιʔϧݟͯͶͱ͔༗Γͩͱࢥ͏ɻ

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

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

  86. ·͞ʹ޲͍͍ͯΔɻ͙͢ʹͰ΋΍ͬͨํ͕͍͍΍ͭ • ඵͰ൓ө͞ΕΔ • ফͯ͠΋ɺ͙͢ʹద༻͢Ε͹໰୊ͳ͍ • Կճ΋࡞Δ • ྫ •

    Datadog: Monitor • AWS: CloudTrail, SNS, SQS, Route53, etc… • ͜ͷล͔Β࢝ΊΔͱɺॻ͖ํ΍࢖͍উख͕෼͔Δ
  87. ·͞ʹ޲͍͍ͯͳ͍ • ࡞੒ʹ͕͔͔࣌ؒΔ΍ͭʢDBܥʣ • Կճ΋࡞Βͳ͍΍ͭʢRedShift΍CloudFrontʣ • ফ͢ͱϚζΠ΍ͭ • Α͘มߋ͢Δ΍ͭ •

    ͜ͷล͔Β࢝ΊΔͱɺ1ճ1ճͷ࡞ۀ͕ා͍ɻࠩ෼͕ग़ͨͱ͖ʹຖ ճٵऩ͢Δͷ͕ਏ͍ɻ͔͔࣌ؒΔͷͰςετ͔ͳΓ͠ΜͲ͍
  88. ·ͱΊ • ֓೦ʹπʔϧ͕௥͍͔ͭͳ͍͜ͱ͸Α͋͘Δɻਏ͍ɻROIߟ͑Δɻ • Ͱ΋֓೦ʢίϯηϓτʣ΍πʔϧ͔Βֶ΂Δ͜ͱ͸ଟ͍ɻ • 10 - 20%ఔ౓ʢ਺஋͸ࣗ༝ʣͷٕज़౤ࢿ͸ߦֶ͍ͼଓ͚Δɻ •

    ֶͦͯ͠Μͩ͜ͱΛࣄۀͷ੒௕଎౓ʹ׆͔͢ɻࣦഊ΋ؚΊͯɻ
  89. ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠