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

AWS CDKコントリビュートTIPS / aws-cdk-contribution-tips

k.goto
April 23, 2024

AWS CDKコントリビュートTIPS / aws-cdk-contribution-tips

2024/04/24開催 JAWS-UG CDK支部 #13 での登壇資料です。

k.goto

April 23, 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 5XJUUFS !@TUFQ@UFDI
  2. લఏ w ຊ5*14͸$%,ͷେ෦෼Λ઎ΊΔ- -$POTUSVDUͷ࣮૷Λର৅ʹͨ͠΋ͷ ‣ $%,$-* $%,5PPMLJU ଆͷ࣮૷Ͱ͸Ұ෦౰ͯ͸·Βͳ͍ͷͰ஫ҙ w αϯϓϧίʔυʹ.Z$POTUSVDU

    .Z$POTUSVDU1SPQTͳͲ͕ग़͖ͯ·͕͢ɺ $%,಺෦ͷίʔυͱ͍͏૝ఆͰ͢ ‣ $%,ίϯτϦϏϡʔτ͍ͯ͠ΔγνϡΤʔγϣϯͱͯ͠ݟͯ΋Β͑ͨΒ ‣ ͦͷ.Z$POTUSVDUΛݺͼग़͢ίʔυ͸Ϣʔβʔଆͷ࣮૷ͷ૝ఆͰ͢ w $%,͸5ZQF4DSJQU੡ͳͷͰɺຊࢿྉͷίʔυྫ΋5ZQF4DSJQUͰॻ͍͍ͯ·͢
  3. ᶃόϦσʔγϣϯͷ࢖͍෼͚ ʲBEE7BMJEBUJPOʳ ‣ /PEFΫϥεͷ࣋ͭBEE7BMJEBUJPOϝιουͰόϦσʔγϣϯ  $POTUSVDUʹ7BMJEBUPSΛΞλον  7BMJEBUFϑΣʔζͰൃՐ ‣ ίϯετϥΫλͰͷॳظԽ࣌఺

    OFX Ͱͳ͘ɺϝιου౳͕ݺ͹Ε͔ͯΒ஋͕มΘ ΔέʔεΛόϦσʔτ͢Δʢ஗ԆධՁʣ  ྫɿQSPQTͱϝιουͲͪΒͰ΋ηοτՄೳͳ഑ྻͷݸ਺ΛνΣοΫ 㾎QSPQTͰ͸Կ΋౉ͣ͞ɺޙ͔ΒϝιουͰ഑ྻʹཁૉΛ௥Ճ͢Δ࢖͍ํ΋Ͱ͖Δέʔε 㾎DPOTUSVDUPS಺ͰͷJGจͰଈ࣌εϩʔͩͱ෼ذΛ͢Γൈ͚ͯ͠·͏ͷͰBEE7BMJEBUJPO͕࠷ద
  4. ᶃόϦσʔγϣϯͷ࢖͍෼͚ ʲBEE7BMJEBUJPOʳ ‣ -B[Z  $POTUSVDUͷࢀরॱংͷٯసɾ॥؀ґଘͷ࣮ݱ΋Մೳ $MPVE'PSNBUJPO্Ͱͷ॥؀ґଘ͸ղܾෆՄ ґଘ ґଘ 'VODUJPO͕"1*ʹґଘ͠

    "1*͕'VODUJPOʹґଘ͢Δ ී௨͸ґଘઌ͕ઌʹఆٛ ͞Ε͍ͯͳ͍ͱ͍͚ͳ͍͕ ॥؀ґଘͳͷͰ೉͍͠ ˞BEE7BMJEBUJPOͱ௚઀ؔ܎ͳ͍͕ ஗Ԇ࣮ߦͱ͍͏఺Ͱࣅ͍ͯΔͷͰ঺հ
  5. ᶃόϦσʔγϣϯͷ࢖͍෼͚ ʲ"OOPUBUJPOTʳ ‣ Τϥʔͷڍಈ͕ಛ௃తͰɺ4ZOUIFTJ[FͰΤϥʔʹͳΔ͕ɺ߹੒ࣗମ͸੒ޭ͢Δ  Ϋϥ΢υΞηϯϒϦ DELPVU಺ͷςϯϓϨʔτͳͲ Λੜ੒͢Δ  ˞ଈ࣌εϩʔ΍BEE7BMJEBUJPOͰ͸ɺΤϥʔ࣌ʹΫϥ΢υΞηϯϒϦ͸ੜ੒͠ͳ͍

    ‣ ෳ਺ελοΫߏ੒BQQͰɺελοΫ͕"OOPUBUJPOTͰΤϥʔΛΞλον͞Εͯ΋ ਖ਼ৗͳελοΫͷTZOUI΍EFQMPZ͸੒ޭ͢Δ  ྫɿ4UBDL"͸"OOPUBUJPOTͷΤϥʔ͕Ξλον 4UBDL#͸ਖ਼ৗ 㾎DEL<TZOUIcEFQPZ>4UBDL"z͸ΤϥʔʹͳΔ͕ɺDEL<TZOUIcEFQPZ>4UBDL#͸੒ޭ 㾎 ˞ଈ࣌εϩʔ΍BEE7BMJEBUJPOͰ͸ελοΫʹΤϥʔ͕͋ΔͱଞελοΫ΋શ෦ࣦഊ͢Δ
  6. ᶃόϦσʔγϣϯͷ࢖͍෼͚ ʲ"OOPUBUJPOTʳ ‣ ࢖͍෼͚ํ๏ Ұྫ   Ϧιʔεͷఆٛͱ͓͔͍ͯ͠͠৔߹ 㾎ˠଈ࣌εϩʔ΍BEE7BMJEBUJPO 

    $POUFYUͷMPPLVQ஋ 71$ TVCOFU "; FUDʜ ͳͲͷ؀ڥతͳཁҼ͕ݪҼͷ৔߹ 㾎ˠ"OOPUBUJPOT  Τϥʔʹ͢Δ·ͰͰ΋ͳ͍͚ͲܯࠂΛ͍ͨ͠ͱ͖ 㾎ˠ"OOPUBUJPOT
  7. ᶃόϦσʔγϣϯͷ࢖͍෼͚ ʲ"TQFDUTʳ ‣ ಛఆͷείʔϓ πϦʔ ಺ͷશͯͷߏ੒ʹૢ࡞Λద༻  1SFQBSFϑΣʔζͰൃՐ 㾎˞όϦσʔγϣϯ༻ͷػೳͱ͍͏Θ͚Ͱ͸ͳ͍ 

    ಛఆͷछྨͷϦιʔεʹରͯ͠ҰݩతʹόϦσʔγϣϯ͍ͨ͠ͱ͖ʹศར 㾎ྫɿ͢΂ͯͷ4ʹόʔδϣχϯάઃఆ͕ద༻͞Ε͍ͯΔ͔ ˞͜ͷྫͰ͸"OOPUBUJPOTͱ૊Έ߹Θ͍ͤͯΔͷͰ Τϥʔࣗମ͸4ZOUIFTJ[FϑΣʔζͰൃՐ͢Δ
  8. ᶃόϦσʔγϣϯͷ࢖͍෼͚ w ิ଍ɿBEE1SPQFSUZ0WFSSJEF౳ͰͷςϯϓϨʔτॻ͖׵͑λΠϛϯά ‣ ςϯϓϨʔτॻ͖׵͑ॲཧࣗମ͸4ZOUIFTJ[FϑΣʔζͰ࣮ߦ͞ΕΔͨΊɺઌड़ͷ ֤όϦσʔγϣϯ࣌ʹ͸ςϯϓϨʔτʹະ൓өͳͷͰ஫ҙ  ҎԼέʔεͰ͸ ڪΒ͘૝ఆ֎Ͱ͋Ζ͏ Τϥʔ͕ൃՐ͠·͢

    㾎ྫ w $POTUSVDU಺ $POTUSVDUϑΣʔζ ͰBEE1SPQFSUZ0WFSSJEF 4ͷόʔδϣχϯάΛFOBCMFEʹ  w "TQFDUT 1SFQBSFϑΣʔζ ͰόϦσʔγϣϯ όʔδϣχϯά͕FOBCMFE͡Όͳ͍ͳΒΤϥʔ  㾎ྫ w "TQFDUT 1SFQBSFϑΣʔζ ͰBEE1SPQFSUZ0WFSSJEF 4ͷόʔδϣχϯάΛFOBCMFEʹ  w BEE7BMJEBUJPO 7BMJEBUFϑΣʔζ ͰόϦσʔγϣϯ όʔδϣχϯά͕FOBCMFE͡Όͳ͍ͳΒΤϥʔ
  9. ᶃόϦσʔγϣϯͷ࢖͍෼͚ w ิ଍ɿ$%,ʹ͓͚ΔΤϥʔपΓͷ஫ҙ఺ ‣ ͳΔ΂͘ෆཁͳΤϥʔ͸ग़͞ͳ͍ํ͕ϢʔβʔϑϨϯυϦʔ ͳ͜ͱ΋͋Δ   ແޮͳύϥϝʔλ ྫ͋Δઃఆͷ࣌ʹ͸࢖ΘΕͳ͍஋

    ͕ࢦఆ͞ΕͨέʔεͰ͸ҎԼ΋ݕ౼ 㾎ͨͩύϥϝʔλΛແࢹ 㾎ࣗಈͰ஋Λॻ͖׵͑Δ 㾎 "OOPUBUJPOTͰܯࠂ ˡܯࠂ͢Β͠ͳͯ͘ྑ͍͜ͱͷํ͕ଟ͍ ܯࠂ͸ϢʔβʹετϨεΛ༩͑Δ  ‣ USZ DBUDI͸͠ͳ͍  $%,͸ϦΧόϦՄೳͳΤϥʔΛฦ͞ͳ͍ͨΊ  ΤϥʔͷΧελϜΫϥε΋࡞Δඞཁͳ͍
  10. ᶄ$%,ͳΒͰ͸ͷ࣮૷ύλʔϯ w QSPQT΍$POTUSVDUͰެ։͢ΔϦιʔε͸ந৅ JOUFSGBDFܕ ʹ ‣ ελοΫ֎͔ΒJNQPSU͞Εͨ ಡΈࠐΈઐ༻ Ϧιʔε΋ѻ͑ΔΑ͏ʹ 

    JOUFSGBDFܕʹ͸جຊతʹͦͷϦιʔεΛߋ৽͢Δϝιου͕ೖ͍ͬͯͳ͍  ϦιʔεΛ࡞ͬͨ$POTUSVDUҎ֎͔Βߋ৽Ͱ͖ͳ͘͢ΔϝϦοτ΋ ܕΩϟετ͠ͳ͍ݶΓ
  11. ᶆޙํޓ׵ੑͷอূ w ഁյతมߋ͸μϝʂθολΠʂ ЋϞδϡʔϧΛআ͘  ‣ $%,ͷόʔδϣϯΛ্͛ͨΒɾɾɾ  ٸʹΤϥʔʹͳͬͨ 

    Ϧιʔε࡟আɾஔ׵͕ى͖ͯ%#ͳͲͷσʔλଛࣦ΍αʔϏεதஅ͕ൃੜͨ͠ 㾎࿦ཧ*%͕มߋ͞Εͯ͠·ͬͨ 㾎ஔ׵͕ඞཁͳϓϩύςΟ͕มߋ͞Εͯ͠·ͬͨ
  12. ᶆޙํޓ׵ੑͷอূ w ഁյతมߋ͸μϝʂθολΠʂ ЋϞδϡʔϧΛআ͘  ‣ ྫ ඞਢ㱻Φϓγϣφϧͷมߋ  QSPQT΍ϝιουͷϓϩύςΟɹɹΦϓγϣφϧˠඞਢ

     ΫϥεͰެ։͍ͯ͠ΔϓϩύςΟɹඞਢˠΦϓγϣφϧ ඞਢʹͨ͠Βɾɾɾ ࠓ·Ͱಈ͍͍ͯͨίʔυ͕Τϥʔʹʂ
  13. ᶆޙํޓ׵ੑͷอূ w ΤϥʔʹͳΒͣσʔλଛࣦ΍αʔϏεதஅ͕ൃੜ͠ͳ͚Ε͹͍͍ͷʁ ‣ ഁյతมߋͰ͸ͳ͍ ‣ ͔͠͠ɺεφοϓγϣοτςετͷࣦഊΛҾ͖ىͯ͜͠͠·͏ͷͰͳΔ΂͘ආ͚Δ  Ϣʔβʔ͕ࠞཚ͢Δ ‣

    ͨͩ͠ɺόάͷ৔߹͸΋ͪΖΜมߋ͠ͳ͍ͱόά͕௚Βͳ͍ͷͰมߋ͸ڐ༰  ͕ɺͦΕʹΑΓϦιʔεஔ׵͕ى͖Δ৔߹͸ɺόάͩͱͯ͠΋ഁյతมߋʹͳΔͷͰ/(
  14. ᶆޙํޓ׵ੑͷอূ w ΋͠ഁյతมߋ ʹͳΓͦ͏ͳ͜ͱ ͕͍ͨ͠ͱ͖ ৽نϓϩύςΟ΍ϝιουΛ௥Ճͯ͠ɺݹ͍ํʹ͸!EFQSFDBUFEϥϕϧΛ෇༩  ඇਪ঑ύϥϝʔλ͕Ϣʔβʹࢦఆ͞Εͨ৔߹͸"OOPUBUJPOTͷBEE8BSOJOH7Ͱܯࠂ ػೳϑϥάͰϢʔβʔͷΦϓτΠϯ DELKTPO

    ʹΑΔಈ࡞มߋ $%,ຊମ ͱ͋Δ-$POTUSVDU಺ ͷ࣮૷ DELJOJU࣌ʹɺϦϦʔε͞Ε͍ͯΔػೳϑϥά͕શͯUSVFͰDELKTPOʹ֨ೲ͞Ε ͦΕҎ߱ʹϦϦʔε͞Εͨ΋ͷ͸Ϣʔβʔ͕໌ࣔతʹ௥هɾUSVFࢦఆ͕ඞཁ
  15. ᶆޙํޓ׵ੑͷอূ w ΋͠ഁյతมߋ ʹͳΓͦ͏ͳ͜ͱ ͕͍ͨ͠ͱ͖ ‣ ՄೳͰ͋Ε͹ͷํ๏͕๬·͍͠  ʮ৽نϓϩύςΟ΍ϝιουΛ௥Ճͯ͠ɺݹ͍ํʹ͸!EFQSFDBUFϥϕϧΛ෇༩ʯ ‣

    ͷػೳϑϥά͸ඇہॴతͳޮՌ͕͋Γҙਤ͠ͳ͍ӨڹΛҾ͖ى͜͢Մೳੑ͕͋Δ  ͦͷ$POTUSVDUΛ࢖༻͍ͯ͠Δผͷ$POTUSVDUͷڍಈ·Ͱมߋͯ͠͠·ͬͨΓ  ΧελϜϦιʔεɾDPSFϞδϡʔϧͳͲͷӨڹൣғͷ޿͍΋ͷ͸ಛʹ஫ҙ
  16. ᶇ1VMM3FRVFTUϧʔϧͱ஫ҙ w 1VMM3FRVFTU 13 ͷϧʔϧ ‣ 13ͷछྨ͝ͱʹมߋ͕ඞཁͳ 13ʹࠩ෼ΛؚΊͳ͍ͱ͍͚ͳ͍ ϑΝΠϧ͕͋Δ 

    ࠩ෼ʹ͍Εͳ͍ͱ13্Ͱ$*͕ΤϥʔʹͳΔ VOJUUFTU JOUFHUFTU TOBQTIPU 3&"%.& GFBU ඞཁ ඞཁ ඞཁ fi Y ඞཁ ඞཁ  DIPSF    EPDT    UFTU    SFGBDUPS   
  17. ᶇ1VMM3FRVFTUϧʔϧͱ஫ҙ w 1VMM3FRVFTU 13 ͷϧʔϧ ‣ 13ͷछྨ͝ͱʹมߋ͕ඞཁͳ 13ʹࠩ෼ΛؚΊͳ͍ͱ͍͚ͳ͍ ϑΝΠϧ͕͋Δ 

    ඞཁͳͦ͞͏ͩͱࢥͬͨΒʮ&YFNQUJPO3FRVFTU ཧ༝ʯͱίϝϯτ  ϝϯςφ͕ଥ౰ͩͱ൑அͨ͠Βෆཁʹͯ͘͠ΕΔ
  18. ᶇ1VMM3FRVFTUϧʔϧͱ஫ҙ w 1VMM3FRVFTU 13 ͷϧʔϧ ‣ 13λΠτϧͷܗࣜˠʰ13छྨ Ϟδϡʔϧ આ໌ʱ 

    13छྨɿ$POWFOUJPOBM$PNNJUT࢓༷ 㾎GFBU  fi Y DIPSF EPDT UFTU SFGBDUPS  ϞδϡʔϧJNQPSUจʹॻ͘΍ͭ େମ"84αʔϏε͝ͱ  㾎ʮBXTʯ͸লུ 㾎ЋϞδϡʔϧͷʮBMQIBʯ΋লུ GFBU DPEFQJQFMJOF QJQFMJOFUZQF7 fi Y FD JOTUBODFGBJMTXIFOYYYJTTQFDJ fi FE DIPSF BQJHBUFXBZ  fi YUZQPGPSZZZ EPDT BQQSVOOFS BEEEFTDSJQUJPOGPS[[[
  19. ᶇ1VMM3FRVFTUϧʔϧͱ஫ҙ w 1VMM3FRVFTU 13 ͷ஫ҙ ‣ 13λΠτϧ͸جຊతʹ͸খจࣈʹ ಄จࣈ΋ʂ ݻ༗໊ࢺ͸0, 

    ɹɹ'FBU T HSBOUNFUIPE ɹɹGFBU 4 HSBOUNFUIPE ɹɹGFBU T (SBOUNFUIPE ɹɹGFBU T HSBOUNFUIPE ɹɹGFBU T ABVUP%FMFUF0CKFDUTAQSPQFSUZ ɹɹGFBU FMC 5-4QPMJDZ ɹɹGFBU TUFQGVODUJPOTUBTLT BEEWBMJEBUJPOTGPSA&NS$SFBUF$MVTUFSA
  20. ᶇ1VMM3FRVFTUϧʔϧͱ஫ҙ w 1VMM3FRVFTU 13 ͷ஫ҙ ‣ 'JYܥͷ13λΠτϧ ɹɹͲ͏௚͔ͨ͠ ɹɹɹ fi

    Y BVUPTDBMJOH VTFBEKVTUNFOUUZQFGPSTUFQTDBMJOH ɹɹͲΜͳόά͕ى͖͔ͨ ɹɹɹ fi Y BVUPTDBMJOH TUFQTDBMJOHXJUIPVUBEKVTUNFOUUZQFGBJMT ͦͷ௚͠ํ͕ద੾͔Ͳ͏͔Θ͔Βͳ͍͠ 13ΛݟΔଆ͸όάͷ಺༰͕஌Γ͍ͨͷͰ
  21. ຊ౰͸ೖΕ͔͚ͨͬͨͲ͕࣌ؒͳͯ͘আ֎ͨ͠΋ͷ w 3&"%.&Ͱͷίʔυεχϖοτ ίʔυϒϩοΫ  ‣ SPTFUUB  EFGBVMUUT fi

    YUVSF  YYYUT fi YUVSF IUUQTHJUIVCDPNBXTBXTDELCMPCNBJO$0/53*#65*/(NESPTFUUB ͱΓ͋͑ͣ͜ΕΛ಄ͷย۱ʹೖΕ͓ͯ͘ͱ ͍͔ͭίϯτϦϏϡʔτ࣌ʹ໾ʹཱ͔ͭ΋ʜ