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

AWS CDKにおける「再利用性」を考える / aws-cdk-reusability

k.goto
July 05, 2024

AWS CDKにおける「再利用性」を考える / aws-cdk-reusability

2024/07/06開催AWS CDK Conference Japan 2024での登壇資料です。

k.goto

July 05, 2024
Tweet

More Decks by k.goto

Other Decks in Programming

Transcript

  1. ࣗݾ঺հ LHPUP "84)&30 "84$%,ίϯτϦϏϡʔτ $PNNVOJUZ%SJWFO $%,$POTUSVDU-JCSBSZ "84πʔϧ DMT EFMTUBDL MBNWFS

    "84%FW5PPMT)FSP .BJOUBJOFS 5PQ$POUSJCVUPS 5SVTUFE3FWJFXFS ࣗ࡞044 $%,$POTUSVDUϥΠϒϥϦ 9!@TUFQ@UFDI (JU)VC!HPUPL
  2. ͲͷΑ͏ʹʮ࠶ར༻ੑʯΛ࣮ݱ͢Δͷ͔ʁ w ηΦϦʔ͕ੈʹग़͍ͯͳ͍ ‣ ൿ఻ͷλϨ ‣ ଐਓԽ w $%,ʹ͸$POTUSVDU͕͋Δ ‣

    ࠶ར༻ੑͷॏཁͳΩʔ $POTUSVDUΛͲͷΑ͏ʹ࡞Δ͜ͱͰ ࠶ར༻ੑΛ୲อͰ͖Δͷ͔ʁ
  3. ࠶ར༻ੑͷͨΊͷ$POTUSVDU࣮૷ϙΠϯτ ᶃ ελοΫͷQSPQTΛ$POTUSVDUʹͦͷ··౉͞ͳ͍ ᶄ QSPQTͷϓϩύςΟ͸SFBEPOMZʹ ᶅ QSPQTͷόϦσʔγϣϯ͸5PLFOʹ஫ҙ ᶆ QSPQT΍$POTUSVDUͰެ։͢ΔϦιʔεͷϓϩύςΟ͸*9YYܕʹ ᶇ

    QSPQT΍$POTUSVDUͰެ։͢ΔϓϩύςΟʹϓϦϛςΟϒܕ͸ආ͚Δ ᶈ QVCMJDϝιουΛ༻ҙ ᶉ όϨϧ JOEFYUT ʹΑΔϞδϡʔϧੑ޲্ ᶊ $POTUSVDU୯ҐͷϢχοτςετ
  4. ࠶ར༻ੑͷͨΊͷ$POTUSVDU࣮૷ϙΠϯτ ᶃ ελοΫͷQSPQTΛ$POTUSVDUʹͦͷ··౉͞ͳ͍ ᶄ QSPQTͷϓϩύςΟ͸SFBEPOMZʹ ᶅ QSPQTͷόϦσʔγϣϯ͸5PLFOʹ஫ҙ ᶆ QSPQT΍$POTUSVDUͰެ։͢ΔϦιʔεͷϓϩύςΟ͸*9YYܕʹ ᶇ

    QSPQT΍$POTUSVDUͰެ։͢ΔϓϩύςΟʹϓϦϛςΟϒܕ͸ආ͚Δ ᶈ QVCMJDϝιουΛ༻ҙ ᶉ όϨϧ JOEFYUT ʹΑΔϞδϡʔϧੑ޲্ ᶊ $POTUSVDU୯ҐͷϢχοτςετ
  5. ࠶ར༻ੑͷͨΊͷ$POTUSVDU࣮૷ϙΠϯτ ᶃ ελοΫͷQSPQTΛ$POTUSVDUʹͦͷ··౉͞ͳ͍ ᶄ QSPQTͷϓϩύςΟ͸SFBEPOMZʹ ᶅ QSPQTͷόϦσʔγϣϯ͸5PLFOʹ஫ҙ ᶆ QSPQT΍$POTUSVDUͰެ։͢ΔϦιʔεͷϓϩύςΟ͸*9YYܕʹ ᶇ

    QSPQT΍$POTUSVDUͰެ։͢ΔϓϩύςΟʹϓϦϛςΟϒܕ͸ආ͚Δ ᶈ QVCMJDϝιουΛ༻ҙ ᶉ όϨϧ JOEFYUT ʹΑΔϞδϡʔϧੑ޲্ ᶊ $POTUSVDU୯ҐͷϢχοτςετ
  6. ࠶ར༻ੑͷͨΊͷ$POTUSVDU࣮૷ϙΠϯτ ᶃ ελοΫͷQSPQTΛ$POTUSVDUʹͦͷ··౉͞ͳ͍ ᶄ QSPQTͷϓϩύςΟ͸SFBEPOMZʹ ᶅ QSPQTͷόϦσʔγϣϯ͸5PLFOʹ஫ҙ ᶆ QSPQT΍$POTUSVDUͰެ։͢ΔϦιʔεͷϓϩύςΟ͸*9YYܕʹ ᶇ

    QSPQT΍$POTUSVDUͰެ։͢ΔϓϩύςΟʹϓϦϛςΟϒܕ͸ආ͚Δ ᶈ QVCMJDϝιουΛ༻ҙ ᶉ όϨϧ JOEFYUT ʹΑΔϞδϡʔϧੑ޲্ ᶊ $POTUSVDU୯ҐͷϢχοτςετ
  7. ᶅQSPQTͷόϦσʔγϣϯ͸5PLFOʹ஫ҙ w 5PLFOͱ͸ ‣ ޙͰղܾ͞ΕΔ ൑໌͢Δ ஋ΛԾͷ஋Ͱ֨ೲ͓ͯ͘͠࢓૊Έ  ओʹOVNCFSܕ΍TUSJOHܕͷ΋ͷ͕ର৅ ഑ྻܕ΋Ұ෦͋Γ

      FY $MPVE'PSNBUJPOͷ3FG஋ EFQMPZ࣌ʹղܾ ͳͲ͸$%,্Ͱ͸5PLFOʹͳΔ ˢ 
 ίίͰղܾ CVDLFU/BNFͳͲ ˢ 
 ίίͰ͸ෆ໌ͳͷͰ 5PLFOͱͯ͠Ծͷ஋Ͱѻ͏
  8. ࠶ར༻ੑͷͨΊͷ$POTUSVDU࣮૷ϙΠϯτ ᶃ ελοΫͷQSPQTΛ$POTUSVDUʹͦͷ··౉͞ͳ͍ ᶄ QSPQTͷϓϩύςΟ͸SFBEPOMZʹ ᶅ QSPQTͷόϦσʔγϣϯ͸5PLFOʹ஫ҙ ᶆ QSPQT΍$POTUSVDUͰެ։͢ΔϦιʔεͷϓϩύςΟ͸*9YYܕʹ ᶇ

    QSPQT΍$POTUSVDUͰެ։͢ΔϓϩύςΟʹϓϦϛςΟϒܕ͸ආ͚Δ ᶈ QVCMJDϝιουΛ༻ҙ ᶉ όϨϧ JOEFYUT ʹΑΔϞδϡʔϧੑ޲্ ᶊ $POTUSVDU୯ҐͷϢχοτςετ
  9. ᶆQSPQT΍$POTUSVDUͰެ։͢ΔϦιʔεͷϓϩύςΟ͸*9YYܕʹ w QSPQT ೖྗ Ͱ*9YYܕʹ͢Δͱɾɾɾ ‣ ಡΈࠐΈઐ༻Ϧιʔε΋ѻ͑ΔΑ͏ʹ  ελοΫ֎͔ΒऔΓࠐΜͩ#VDLFU΋ͦͷ$POTUSVDUʹ౉ͤΔ ‣

    ಉ͡JOUFSGBDFΛ࣮૷͢Δଟछͷ$POTUSVDUΛ౉ͤΔΑ͏ʹͳΔ  *'VODUJPO 㾎'VODUJPO 㾎/PEFKT'VODUJPO 㾎4JOHMFUPO'VODUJPO 㾎FUDʜ
  10. ࠶ར༻ੑͷͨΊͷ$POTUSVDU࣮૷ϙΠϯτ ᶃ ελοΫͷQSPQTΛ$POTUSVDUʹͦͷ··౉͞ͳ͍ ᶄ QSPQTͷϓϩύςΟ͸SFBEPOMZʹ ᶅ QSPQTͷόϦσʔγϣϯ͸5PLFOʹ஫ҙ ᶆ QSPQT΍$POTUSVDUͰެ։͢ΔϦιʔεͷϓϩύςΟ͸*9YYܕʹ ᶇ

    QSPQT΍$POTUSVDUͰެ։͢ΔϓϩύςΟʹϓϦϛςΟϒܕ͸ආ͚Δ ᶈ QVCMJDϝιουΛ༻ҙ ᶉ όϨϧ JOEFYUT ʹΑΔϞδϡʔϧੑ޲্ ᶊ $POTUSVDU୯ҐͷϢχοτςετ
  11. ࠶ར༻ੑͷͨΊͷ$POTUSVDU࣮૷ϙΠϯτ ᶃ ελοΫͷQSPQTΛ$POTUSVDUʹͦͷ··౉͞ͳ͍ ᶄ QSPQTͷϓϩύςΟ͸SFBEPOMZʹ ᶅ QSPQTͷόϦσʔγϣϯ͸5PLFOʹ஫ҙ ᶆ QSPQT΍$POTUSVDUͰެ։͢ΔϦιʔεͷϓϩύςΟ͸*9YYܕʹ ᶇ

    QSPQT΍$POTUSVDUͰެ։͢ΔϓϩύςΟʹϓϦϛςΟϒܕ͸ආ͚Δ ᶈ QVCMJDϝιουΛ༻ҙ ᶉ όϨϧ JOEFYUT ʹΑΔϞδϡʔϧੑ޲্ ᶊ $POTUSVDU୯ҐͷϢχοτςετ
  12. ࠶ར༻ੑͷͨΊͷ$POTUSVDU࣮૷ϙΠϯτ ᶃ ελοΫͷQSPQTΛ$POTUSVDUʹͦͷ··౉͞ͳ͍ ᶄ QSPQTͷϓϩύςΟ͸SFBEPOMZʹ ᶅ QSPQTͷόϦσʔγϣϯ͸5PLFOʹ஫ҙ ᶆ QSPQT΍$POTUSVDUͰެ։͢ΔϦιʔεͷϓϩύςΟ͸*9YYܕʹ ᶇ

    QSPQT΍$POTUSVDUͰެ։͢ΔϓϩύςΟʹϓϦϛςΟϒܕ͸ආ͚Δ ᶈ QVCMJDϝιουΛ༻ҙ ᶉ όϨϧ JOEFYUT ʹΑΔϞδϡʔϧੑ޲্ ᶊ $POTUSVDU୯ҐͷϢχοτςετ
  13. ᶉόϨϧ JOEFYUT ʹΑΔϞδϡʔϧੑ޲্ w σΟϨΫτϦ$POTUSVDUͷ֊૚ߏ଄ ωετ ʹ͓͚Δ$POTUSVDUͷެ։੍ޚ ‣ ࢠ$POTUSVDU͸ͦͷϞδϡʔϧͷϝΠϯͷ$POTUSVDU͔Β͔͠ݺ͹Εͳ͍૝ఆ 

    MPHBOBMZTJTUT͸TUBUJDUT͔Β͔͠ݺ͹Εͳ͍ ‣ ϝΠϯͷ$POTUSVDU͚ͩΛ4UBDLͳͲ$POTUSVDU֎͔Βݺ΂ΔΑ͏ʹ͍ͨ͠  TUBUJDUT͚ͩϞδϡʔϧ֎ 4UBDLͳͲ ͔Βݺͼ͍ͨ
  14. ᶉόϨϧ JOEFYUT ʹΑΔϞδϡʔϧੑ޲্ w Ұॹʹѻ͍͍ͨ ؔ࿈ ϦιʔεΛͭͷϞδϡʔϧʹ·ͱΊΔࢫΈ͕૿͢ ‣ ؙ͝ͱ؆୯ʹଞ1+ʹෳ੡Ͱ͖Δ ‣

    ϞδϡʔϧͷϙʔλϏϦςΟΞοϓˠ࠶ར༻ੑΞοϓ $MPVE'SPOU ·ΘΓͷ $POTUSVDUϞδϡʔϧ ඇެ։$POTUSVDU ϩά༻4όέοτ "UIFOBܥ (MVFܥ ϩά੔ܗ༻-BNCEB ผʑͷ$POTUSVDUʹ෼͚࣮ͯ૷Ͱ͖ ެ։$POTUSVDU ΦϦδϯ༻4όέοτ %JTUSJCVUJPO ݺ ͼ ग़ ͠ ͭͷϞδϡʔϧʹ·ͱΊΒΕΔ ެ։ඇެ։ʹ෼͚ΒΕ ֎͔Β ݺ΂Δ
  15. ࠶ར༻ੑͷͨΊͷ$POTUSVDU࣮૷ϙΠϯτ ᶃ ελοΫͷQSPQTΛ$POTUSVDUʹͦͷ··౉͞ͳ͍ ᶄ QSPQTͷϓϩύςΟ͸SFBEPOMZʹ ᶅ QSPQTͷόϦσʔγϣϯ͸5PLFOʹ஫ҙ ᶆ QSPQT΍$POTUSVDUͰެ։͢ΔϦιʔεͷϓϩύςΟ͸*9YYܕʹ ᶇ

    QSPQT΍$POTUSVDUͰެ։͢ΔϓϩύςΟʹϓϦϛςΟϒܕ͸ආ͚Δ ᶈ QVCMJDϝιουΛ༻ҙ ᶉ όϨϧ JOEFYUT ʹΑΔϞδϡʔϧੑ޲্ ᶊ $POTUSVDU୯ҐͷϢχοτςετ
  16. ᶊ$POTUSVDU୯ҐͷϢχοτςετ w ͨͩ͠શͯͷ$POTUSVDU͝ͱʹॻ͘ͱɾɾɾ ‣ ςετ͕େྔʹͳΔ͜ͱ΋ ‣ ςετ TZOUI ͕஗͘ͳΔ͜ͱ΋ 

    ಛʹ%PDLFSͷϏϧυɺιʔείʔυͷόϯυϧॲཧ͕͋Δ৔߹  ˞ςετͰ͸͜ͷ෦෼͚ͩKFTUͰϞοΫ͢Δͱ͍͏ख΋͋Δ w جຊ͸ελοΫͰͷςετͰ0, ‣ ಛʹ࠶ར༻ੑΛ୲อ͍ͨ͠΋ͷ͚ͩ΍Δख΋ ‣ $POTUSVDUϥΠϒϥϦͱͯ͠࡞ΔϦϙδτϦͰ͸ಛʹ༗ޮ  "84$%,ຊՈͷϢχοτςετͰ͸جຊతʹ͸$POTUSVDU୯Ґ
  17. ࠶ར༻ੑͷͨΊͷ$POTUSVDU࣮૷ϙΠϯτ ᶃ ελοΫͷQSPQTΛ$POTUSVDUʹͦͷ··౉͞ͳ͍ ᶄ QSPQTͷϓϩύςΟ͸SFBEPOMZʹ ᶅ QSPQTͷόϦσʔγϣϯ͸5PLFOʹ஫ҙ ᶆ QSPQT΍$POTUSVDUͰެ։͢ΔϦιʔεͷϓϩύςΟ͸*9YYܕʹ ᶇ

    QSPQT΍$POTUSVDUͰެ։͢ΔϓϩύςΟʹϓϦϛςΟϒܕ͸ආ͚Δ ᶈ QVCMJDϝιουΛ༻ҙ ᶉ όϨϧ JOEFYUT ʹΑΔϞδϡʔϧੑ޲্ ᶊ $POTUSVDU୯ҐͷϢχοτςετ
  18. ·ͱΊ w "84$%,ʹ͓͚Δʮ࠶ར༻ੑʯͱ͸ʁ ‣ ࢖͍ճ͠ ‣ $POTUSVDU͕ॏཁͳΩʔ w ʮ࠶ར༻ੑʯΛ୲อ͢Δ$POTUSVDU࣮૷ϙΠϯτ ‣

    ʮ࠶ར༻ੑʯΛߟ͑ͳ͍৔߹ɺ͜ΕΒͷϙΠϯτʹԊ͏ඞཁ͸ͳ͍ ‣ ͨͩ͠ʮ࠶ར༻ੑʯʹؔ܎ͳ͘ɺ$POTUSVDU࣮૷ͱͯ͠ྑ͍఺΋ w ࠶ར༻ੑͷ୲อʹ͸σϝϦοτ΋͍ͭͯ͘Δ ‣ τϨʔυΦϑ