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

AWS CDKとTerraformをn個の観点で徹底比較/compare-aws-cdk-and-terraform-from-n-perspectives

380bcd2ab751f5838abd8219df53e5fe?s=47 tomoki10
July 18, 2021

AWS CDKとTerraformをn個の観点で徹底比較/compare-aws-cdk-and-terraform-from-n-perspectives

JTF2021 の発表資料です

380bcd2ab751f5838abd8219df53e5fe?s=128

tomoki10

July 18, 2021
Tweet

Transcript

  1. "84$%,ͱ5FSSBGPSNΛOݸͷ؍఺Ͱపఈൺֱ  ࠤ౻ஐथ $9ࣄۀຊ෦*P5ࣄۀ෦

  2.  nݸͬͯԿݸͩΑ

  3.  n = 14 ͙Β͍Ͱ͓࿩͠͠·͢

  4. "84$%,ͱ5FSSBGPSNΛݸͷ؍఺Ͱపఈൺֱ  ࠤ౻ஐथ $9ࣄۀຊ෦*P5ࣄۀ෦

  5. 5 ࣗݾ঺հ @tmk2154 @tomoki10 • ࠤ౻ஐथ • Ϋϥεϝιουגࣜձࣾ • CXࣄۀຊ෦

    IoTࣄۀ෦ new! • લ৬ɿSIerͷSEΛ4೥ऑ • ݱࡏɿΠϯϑϥ݉αʔόʔαΠυΤϯδχΞ݉ etc • ޷͖ͳAWSαʔϏεɿLambdaɺCDK
  6. ൃ୺  ࠓճͷ July Tech Festa ͷςʔϚ ʮ#ࠓ͞Βฉ͚ͳ͍ITٕज़ ʯ ݁ہ

    Terraform ͱ CDK Ͳͬͪબ΂͹͍͍ΜͰ͢ʁʁ
  7. ૝ఆ͢Δର৅ͷ੔ཧ  ର৅ऀͷΠϝʔδ w Ϋϥ΢υ༻ͷ*B$ͷπʔϧ܈ʹ"84$%,΍5FSSBGPSNͳͲ͕͋Δ͜ͱ͸ ஌͍ͬͯΔ͕৔߹ʹԠͯ͡ͲͪΒΛબΜͰྑ͍͔೰Ήํ w Ҏલ*B$πʔϧΛબఆ͢Δࡍʹ೰Μͩ͜ͱ͕͋Δํ ໨ඪ w

    ݱ৔໨ઢͰͷ؍఺͝ͱͷϝϦοτσϝϦοτΛ஌Δ w ࣗ෼ͷνʔϜϓϩδΣΫτʹͱͬͯ࠷దͳπʔϧΛબ୒Ͱ͖ΔΑ͏ʹͳΔ
  8. *B$͸ͦ΋ͦ΋ͳ͍ͥΔͷ͔  ද୊͸લճͷ+VMZ5FDI'FTUBXJOUFSͷൃදΛࢀর Ҿ༻ɿhttps://speakerdeck.com/fu3ak1/naze-infrastructure-as-code-gabi-yao-nafalseka

  9. ొஃऀͷഎܠ  1+ܦݧ w "84$%,͸೥൒ఔ౓ʢ1+ʣɺ5FSSBGPSN͸dϲ݄ఔ౓ʢ1+ʣ w ͲͪΒ΋࢝Ίͨͷ͸௚ۙ൒೥ʙ೥ڧ w ΠϯϑϥΑΓόοΫΤϯυΤϯδχΞܦݧͷํ͕௕͍ ݸਓతͳଐੑ

    w *B$πʔϧ͸"84$%,ͷํ͕޷͖ ※஫ҙɿެฏΛظ͍ͯ͠·͕͢ొஃऀͷൃݴ͕ͪ͜ΒدΓͷൃݴʹͳ͍ͬͯΔՄೳੑ͸͋Γ·͢ AWS CDK Terraform
  10. ొஃ֎ͰࢀߟʹͳΔ৘ใ  ൺ΂ͯΘ͔Δʂ*B$ͷબͼ͔ͨ ʙΫϥ΢υωΠςΟϒ*B$ετʔϦʔʙ 5FSSBGPSNBXTDELΛൺֱͯ͠Έͨ ݸਓͷॴײͰ͢  Ҿ༻ɿhttps://booth.pm/ja/items/3045918 Ҿ༻ɿhttps://selmertsx.hatenablog.com/entry/2021/05/07/ Terraform_/_aws-cdk_Λൺֱͯ͠Έͨ(ݸਓͷॴײͰ͢)

  11. શମߏ੒  w "84$%,ͱ͸ w 5FSSBGPSNͱ͸ w Ұൠతͳٕज़બఆͷ؍఺ w ࣮ફ্ͨ͠Ͱͷ؍఺

    w ֤؍఺Ͱൺֱ
  12. શମߏ੒  w "84$%,ͱ͸ w 5FSSBGPSNͱ͸ w Ұൠతͳٕज़બఆͷ؍఺ w ࣮ફ্ͨ͠Ͱͷ؍఺

    w ֤؍఺Ͱൺֱ
  13. "84$%, $MPVE%FWFMPQFS,JU ͱ͸  w ࢖͍׳ΕͨݴޠͰ"84ϦιʔεΛϓϩϏδϣχϯάͰ͖ΔπʔϧΩοτ w ݱࡏ͸5ZQF4DSJQU+BWB4DSJQUɺ+BWBɺ$ɺ(P ։ൃऀϓϨϏϡʔ Ͱ࢖༻Մೳ

    πʔϧ಺෦ͷ։ൃ͸5ZQF4DSJQUϝΠϯ w ίʔυิ׬ͰυΩϡϝϯτΛݟͳͯ͘΋࣮૷͕Ͱ͖Δ w $MPVE'PSNBUJPOͱൺ΂࣮ͯ૷ྔ͕গͳ͘هड़Ͱ͖Δ ྫɿ$MPVE'PSNBUJPOͰߦͷ࣮૷͕$%,ͩͱߦͰࡁΉ৔߹΋ w $%,GPS5FSSBGPSN΍DELTͳͲͰ"84֎ͷྖҬ΁ࠓޙਐߦ༧ఆ
  14. "84$%,ೖ໳ͷ͓͢͢Ί   $%,1BUUFSOT "84ެࣜͷΞʔΩςΫνϟύλʔϯΛ ༗ࢤ͕$%,ͷίʔυͰ࣮૷  "84$%,ϫʔΫγϣοϓ ͱΓ͋͑ͣखΛಈ͔ͯ͠ମײͰ͖Δ https://summit-online-japan-cdk.workshop.aws/

    https://cdkpatterns.com/
  15. 5FSSBGPSNͱ͸  w )$- )BTIJ$PSQ$POpHVSBUJPO-BOHVBHF ͰΠϯϑϥετϥΫνϟΛίʔυͱ ͯ͠هड़Ͱ͖Δπʔϧ w ϒϩοΫɺҾ਺ɺࣜͳͲͰϦιʔεΛ؆ܿʹهࡌ w

    ؀ڥʹ൓ө͢ΔલʹӨڹ͞ΕΔϦιʔεͷࠩ෼Λ໌֬ʹ֬ೝՄೳ w Ϋϥ΢υϓϩόΠμʔͳͲ͕ఏڙ͢ΔϞδϡʔϧΛ࢖͏ͱෳࡶͳߏ੒΋؆୯ʹ࡞੒ w "84͚ͩͰͳ͘ଞͷΫϥ΢υϓϩόΠμʔ΍4BB4ͷߏ੒ʹ΋ରԠ
  16. 5FSSBGPSNೖ໳ͷ͓͢͢Ί  ࣮ફ5FSSBGPSNɹ"84ʹ͓͚Δγες ϜઃܭͱϕετϓϥΫςΟε 5FSSBGPSNͷશମ૾Λମܥతʹֶ΂Δ https://www.amazon.co.jp/࣮ફTerraform-AWSʹ͓͚ΔγεςϜઃܭͱ ϕετϓϥΫςΟε-ٕज़ͷઘγϦʔζʢNextPublishingʣ-໺ଜ-༑ن/

  17. શମߏ੒  w "84$%,ͱ͸ w 5FSSBGPSNͱ͸ w Ұൠతͳٕज़બఆͷ؍఺ w ࣮ફ্ͨ͠Ͱͷ؍఺

    w ֤؍఺Ͱൺֱ
  18. ෳ਺ͷٕज़બఆͷ؍఺͔Βݕ౼  Ұൠతͳٕज़બఆͷ؍఺ ࣮ફ্ͨ͠Ͱͷ؍఺

  19. Ұൠతͳٕज़બఆͷ؍఺  ʮཧ૝ͷٕज़બఆʯͷٕज़બఆͷධՁ࣠Λࢀߟ w αʔϏεཁ݅ͷ୲อ w ηΩϡϦςΟཁ݅ w ݁Ռ੔߹ੑʢಛʹετϨʔδʣ w

    αʔϏεͷ࣮ݱՄೳੑ w ٕज़৴པੑ w ຊ൪࠾༻਺ w ։ൃ฼ମͷ҆ఆੑ w ֫ಘ͍ͯ͠Δελʔ਺ w ஀ੜ͔Βͷ೥਺ w ܦࡁੑ w αʔόʔ୅અ໿ w ਓ݅අઅ໿ w ։ൃੜ࢈ੑ w ֶशίετʢ֓೦ͷγϯϓϧ͞ɺطଘϊ΢ ϋ΢ͱͷ਌࿨ੑʣ w ਓ਺ن໛΁ͷద߹ੑ w ϝϯςφϯεੑ w ਓతࢿݯͷՄ༻ੑ w ֶशϞνϕʔγϣϯ ࢀߟɿʮཧ૝ͷٕज़બఆʯhttps://note.com/timakin/n/n2d9eaa02e633
  20. Ұൠతͳٕज़બఆͷ؍఺  ʮཧ૝ͷٕज़બఆʯͷٕज़બఆͷධՁ࣠Λࢀߟ w αʔϏεཁ݅ͷ୲อ w ηΩϡϦςΟཁ݅ w ݁Ռ੔߹ੑʢಛʹετϨʔδʣ w

    αʔϏεͷ࣮ݱՄೳੑ w ٕज़৴པੑ w ຊ൪࠾༻਺ w ։ൃ฼ମͷ҆ఆੑ w ֫ಘ͍ͯ͠Δελʔ਺ w ஀ੜ͔Βͷ೥਺ w ܦࡁੑ w αʔόʔ୅અ໿ w ਓ݅අઅ໿ w ։ൃੜ࢈ੑ w ֶशίετʢ֓೦ͷγϯϓϧ͞ɺطଘϊ΢ ϋ΢ͱͷ਌࿨ੑʣ w ਓ਺ن໛΁ͷద߹ੑ w ϝϯςφϯεੑ w ਓతࢿݯͷՄ༻ੑ w ֶशϞνϕʔγϣϯˡݸਓʹΑΓ͚Γ ࢀߟɿʮཧ૝ͷٕज़બఆʯhttps://note.com/timakin/n/n2d9eaa02e633
  21.  w ։ൃ฼ମʢఏڙձࣾʣΛվΊͯ֬ೝ    ։ൃ฼ମɿ"NB[PO8FC4FSWJDFT *OD "84$%,νʔϜ 

    "84͕ެࣜͷπʔϧͱͯ͠ఏڙ͍ͯ͠Δ ͨΊऴྃͷةݥੑ͸௿͍ ฼ମͷ҆ఆੑͱ͸ผʹఏڙऴྃͯ͠΋ $MPVE'PSNBUJPO؅ཧʹ໭ͤΔ  ։ൃ฼ମɿ)BTIJ$PSQ *OD ࣾһ਺ɿਓ ଞ੡඼ʹ7BHSBOU΍1BDLFSͳͲ༗໊ͳ ΋ͷ͕ଟ਺ ҆ఆͨ͠اۀͱ͍ͬͯ໰୊ͳ͍ ٕज़৴པੑ ։ൃ฼ମͷ҆ఆੑ
  22.     ٕज़৴པੑ ελʔ਺஀ੜ೥਺ Ҿ༻(2021/7/10࣌఺)ɿhttps://www.githubcompare.com/aws/aws-cdk+hashicorp/terraform

  23.  w ๭స৬αΠτͷٻਓ਺ͰਓతࢿݯͷՄ༻ੑΛ֬ೝ ˞࣌఺ͷ৘ใ    "ࣾٻਓ਺ɿ݅ #ࣾٻਓ਺ɿ݅ ("͕೥ఔલͷͨΊ·ͩ·ͩࢢ৔ʹ͸ਓ

    ࡐ͕গͳͦ͏ͳҹ৅ ˞ฐࣾ͸݁ߏ࣮੷ଟ͍Ͱ͢ʢײ֮஋ʣ    "ࣾٻਓ਺ɿ݅ #ࣾٻਓ਺ɿ݅ ೥ͷ࣮੷͔Β࢖༻1+΍ਓࡐ΋ଟ͍͘Δ Α͏ͳҹ৅ ։ൃੜ࢈ੑ ਓతࢿݯͷՄ༻ੑ
  24.  ͜͜·Ͱ7෼ͩͱྑ͍ϖʔε

  25. શମߏ੒  w "84$%,ͱ͸ w 5FSSBGPSNͱ͸ w Ұൠతͳٕज़બఆͷ؍఺ w ࣮ફ্ͨ͠Ͱͷ؍఺

    w ֤؍఺Ͱൺֱ
  26. ࣮ફ্ͨ͠Ͱͷٕज़બఆͷ؍఺  ࣗ෼ͷܦݧ͔Βಠࣗʹ؍఺Λ࡞੒ w ։ൃݴޠͷҧ͍ w ίʔυͷΞʔΩςΫνϟݕ౼ w νʔϜεΩϧ w

    σϓϩΠ࣌ͷڍಈ w खಈมߋͷऔΓࠐΈ w αʔόϨε w αʔόϨεʢίʔυόϯυϧʣ w $*$% w ίϯςφԾ૝Ϛγϯϕʔε w ରԠ͍ͯ͠ΔϦιʔε
  27.   5ZQF4DSJQUɺ+BWB4DSJQUɺ1ZUIPOɺ +BWBɺ$ɺ(P ։ൃऀϓϨϏϡʔ ͰϦ ιʔεΛهड़ ࣮૷ࣗମ͸5ZQF4DSJQU  )$-

    )BTIJ$PSQ$POpHVSBUJPO -BOHVBHF ͱ͍͏ಠࣗͷ%4-ͰϦιʔ εΛهड़ ࣮૷ࣗମ͸(P ٕज़બఆͷ؍఺ ։ൃݴޠͷҧ͍
  28.   ϝϦοτɿ ීஈͷ࣮૷Ͱ࢖༻͠׳ΕͨݴޠͰهड़͢ Δ͜ͱ͕Մೳ ίʔυิ׬ͰυΩϡϝϯτΛݟͳͯ͘΋ ࣮૷͕ਐΊΒΕΔ σϝϦοτɿ 5ZQF4DSJQUҎ֎Ͱ࡞Δ৔߹೔ຊޠͷ৘ ใ͕গͳΊ

     ϝϦοτɿ :".-ɺ+40/ʹ͍ۙͷͰϓϩάϥϛϯ άܦݧ͕ͳͯ͘΋࢝Ί΍͍͢ ݻఆͷݴޠͰ؆୯ͳن໿Λ࡞Ε͹։ൃऀ ʹدΒͣࣅͨΑ͏ͳॻ͖ํʹͰ͖Δ σϝϦοτɿ υϝΠϯݻ༗ݴޠ %4- ͳͷͰද໘తͳ هड़ํ๏ͷܦݧΛଞʹ׆͔ͮ͠Β͍ ٕज़બఆͷ؍఺ ։ൃݴޠͷҧ͍
  29.    ٕज़બఆͷ؍఺ ίʔυͷΞʔΩςΫνϟݕ౼ ʮBoost your infrastructure with the

    AWS CDKʯ https://aws.amazon.com/jp/blogs/aws/boost-your-infrastructure-with-cdk/ ʮModule Creation- Recommended Patternʯ https://learn.hashicorp.com/tutorials/terraform/pattern-module- creation?in=terraform/modules
  30.    ߏ੒ྫ  ελοΫΛͲͷཻ౓Ͱ෼ׂ͢Δ͔ݕ౼͕ ඞཁ ߏ੒ྫ  εςʔτ΍ϞδϡʔϧͰ࣮૷ΛͲ͜·Ͱ

    ੾Γ෼͚Δ͔ͳͲݕ౼͕ඞཁ ٕज़બఆͷ؍఺ ίʔυͷΞʔΩςΫνϟݕ౼
  31.    ϝϦοτɿ ελοΫ෼཭ͷߟ͑ํ͸ੲ͔Β஝ੵ͞Ε ͨ಺༰Λͦͷ··౰ͯ͸ΊΒΕΔ σϝϦοτɿ ࣗ༝౓͕ߴ͘$%,༻ͷίʔσΟϯάن ໿͕ͳ͍ͱݸਓʹΑΔϒϨ͕େ͖͍ ίʔυΛޮ཰Խ͗͢͠ΔͱޙʑͷಡΈղ

    ͖΍ελοΫ෼ׂͳͲ͕ࠔ೉ʹͳΔ ϝϦοτɿ ೥ͷ஝ੵͰଟ͘ͷϕετϓϥΫςΟε ͕ఏҊ͞Ε͍ͯΔ σϝϦοτɿ ઃܭ࿦ʹؔ͢Δهࣄ͕ଟ͗ͯ͢೰Ή ϞδϡʔϧϫʔΫεϖʔεͳͲͷػೳ ͕ແ͍࣌୅ͷগ͠ݹ͍هࣄ΋఺ࡏ ެࣜ΋ϫʔΫεϖʔεͷ࢖༻ํ๏͸໎૸ ؾຯ ؀ڥ෼཭ʹ࢖͏ͳ࢖͕͑ࠞࡏ ٕज़બఆͷ؍఺ ίʔυͷΞʔΩςΫνϟݕ౼
  32.    ίʔυͷΞʔΩςΫνϟݕ౼ɿࢀߟʹͳͬͨهࣄ https://learn.hashicorp.com/tutorials/terraform/pattern-module- creation?in=terraform/modules .PEVMF$SFBUJPO3FDPNNFOEFE1BUUFSO https://aws.amazon.com/jp/blogs/news/best-practices-for- developing-cloud-applications-with-aws-cdk/ "84$%,ͰΫϥ΢υΞϓϦέʔγϣϯΛ

    ։ൃ͢ΔͨΊͷϕετϓϥΫςΟε
  33.    ඞཁͳٕज़ελοΫ w 5ZQF4DSJQUͷه๏ w $%,$-*ͷ࢖͍ํ w ΞʔΩςΫνϟͷཧղ

    w OQNͳͲͷύοέʔδ؅ཧ w $%,$MPVE'PSNBUJPOͷ੍໿ ඞཁͳٕज़ελοΫ w )$-ͷه๏ w 5FSSBGPSN$-*ͷ࢖͍ํ w ΞʔΩςΫνϟͷཧղ w 5FSSBGPSNͷ੍໿ ٕज़બఆͷ؍఺ νʔϜεΩϧ
  34.    ඞཁͳٕज़ελοΫ w 5ZQF4DSJQUͷه๏ˡݴޠͷशಘ w $%,$-*ͷ࢖͍ํ w ΞʔΩςΫνϟͷཧղ

    w OQNͳͲͷύοέʔδ؅ཧ w $%,$MPVE'PSNBUJPOͷ੍໿ ඞཁͳٕज़ελοΫ w )$-ͷه๏ w 5FSSBGPSN$-*ͷ࢖͍ํ w ΞʔΩςΫνϟͷཧղ w 5FSSBGPSNͷ੍໿ ٕज़બఆͷ؍఺ νʔϜεΩϧ
  35.    ϝϦοτɿ ΞϓϦ࣮૷ͷܦݧ͕͋Ε͹࢖͍΍͍͢ +BWBܦݧऀͳΒಛʹ໰୊ͳ͍ ࣮ମݧ  ΞϓϦ࣮૷ܦݧͷ͋ΔΠϯϑϥ΍ϑϩϯ τόοΫΤϯυΤϯδχΞ͕ଟ͍νʔ

    Ϝʹ༗ޮ ϝϦοτɿ :".-΍+40/ͳͲʹ͍ۙه๏Ͱशಘ ͠΍͍͢ ΞϓϦ࣮૷ܦݧͷগͳ͍ΠϯϑϥΤϯδ χΞ΍ະܦݧऀͷଟ͍νʔϜʹ༗ޮ  ˞ϕʔεͱͳΔΞʔΩςΫνϟ࡞Γ͕ ɹͰ͖ΔΞʔΩςΫτ͸ผ్ඞཁ ٕज़બఆͷ؍఺ νʔϜεΩϧ ʮҰൠతͳٕज़બఆʯͷֶशίετʹؔ࿈
  36.   ϝϦοτɿ Ϧιʔεൺֱ͕Մೳ DELEJ⒎  ࣦഊ࣌͸େମશ෦ϩʔϧόοΫ͞ΕΔ σϝϦοτɿ $%,ͱ$MPVE'PSNBUJPOͷͲͪΒʹ໰୊ ͕͋Δͷ͔੾Γ෼͚͕ඞཁ

    ελοΫͷґଘؔ܎পʹϋϚΓ΍͍͢  ϝϦοτɿ ࣮؀ڥͱίʔυͰϦιʔεൺֱ͕Մೳ UFSSBGPSNQMBO  σϝϦοτɿ ࣦഊ࣌͸ϩʔϧόοΫ͞Εͣ໰୊ͳ͔ͬ ͨҰ෦ͷઃఆ͚ͩ൓ө͞ΕΔɻ࠶σϓϩ Π࣌ʹमਖ਼ͨ͠෦෼͚ͩ൓ө ٕज़બఆͷ؍఺ σϓϩΠ࣌ͷڍಈ
  37.  ٕज़બఆͷ؍఺ σϓϩΠ࣌ͷڍಈ 5FSSBGPSNͱ$MPVE'PSNBUJPOͷൺֱ͕ॏཁɻͪ͜ΒͷํͷൃදΛࢀর https://dev.classmethod.jp/articles/terraform-or-cloudformation/

  38.    $MPVE'PSNBUJPOʹJNQPSUޙ$%,ͷ Ϟδϡʔϧ˞Ͱཧ࿦্͸औΓࠐΈՄೳ 'PSNFSͳͲͷ֎෦πʔϧΛ࢖͏  ্ͷҊ͸྆ํͱ΋-$POTUSVDUʹͳͬ ͯ͠·͏ɻग़དྷΕ͹ຆͲͷϦιʔεΛ $%,Ͱॻ͘ͱ͍͏ڧ͍ҙࢤ͕ඞཁ

      UFSSBGPSNJNQPSUίϚϯυͰऔࠐՄೳ  5FSSBGPSNͰ࡞੒ͨ͠Ϧιʔεͷࡉ͔͍ ઃఆ಺༰ͷมߋ͸औΓࠐΈ΍͍͢ طଘͷϦιʔεΛ࠷దͳϞδϡʔϧʹ౰ ͯ͸ΊͯऔΓࠐΉͷ͸େมͦ͏ ٕज़બఆͷ؍఺ खಈมߋͷऔΓࠐΈ ※ʮInclude CloudFormation templates in the CDKʯ https://docs.aws.amazon.com/cdk/api/latest/docs/cloudformation-include-readme.html
  39.  ͕࣍AWS CDKͰ1൪ͷਪ͠ϙΠϯτʂʂ

  40.    -BNCEBपΓͷػೳ͸؆୯ʹݖݶΛઃఆ Ͱ͖ΔɻΑΓએݴతͳهड़͕Մೳ ։ൃΛ࢝Ί͖ͯ᪴΍͍͢Ϧιʔεؒ*". ϩʔϧͷݖݶΛࡉ͔͘؆୯ʹ࡞ΕΔʂ   3PMFपΓͷઃఆͰ໌ࣔతʹݖݶΛ༩͑

    Δඞཁ͕͋Γগ͠खؒ ٕज़બఆͷ؍఺ αʔόϨε ࢀߟɿhttps://dev.classmethod.jp/articles/receive-data-from-soracom-on-aws-using-terraform/#toc-3 ࢀߟɿhttps://summit-online-japan-cdk.workshop.aws/20-typescript/40-hit-counter/600-permissions.html resource aws_dynamodb_table iot_sample { name = "Terraform_Iot_Sample" … } … resource "aws_iam_role" "role" { name = "IotRuleToDynamoDBAccessRole" assume_role_policy = = <<EOF {…} EOF } resource "aws_iam_role_policy" "iam_policy_for_iot" { … policy = <<EOF { … "Action": [ "dynamodb:PutItem" ], "Resource": “${aws_dynamodb_table.iot_sample.arn}" } } EOF } export class HitCounter extends cdk.Construct { … const table = new dynamodb.Table(this, 'Hits', { … }); this.handler = new lambda.Function(this, 'HitCounterHandler', { … }); // grant the lambda role read/write permissions to our table table.grantReadWriteData(this.handler); } }
  41.    ϝϦοτɿ એݴతʹ࣮૷Ͱ͖5FSSBGPSNΑΓ୹͍ هड़Ͱ࣮૷͕Մೳ  σϝϦοτɿ ҉໧ͷύϥϝʔλ͕ଟ͘ͳΓ΍͘͢୯७ ʹ࣮૷͢Δͱ5FSSBGPSNΑΓϝϯςφ

    ϯεੑ͸Լ͕Γ΍͍͢   ϝϦοτɿ هड़ྔ͕ଟ͘ͳΓઃఆΛஸೡʹߦ͍΍͢ ͘ϝϯςφϯεੑ͕༏Ε͍ͯΔ σϝϦοτɿ $MPVE'PSNBUJPOʹൺ΂Ε͹એݴతʹ ॻ͚Δ͕$%,ʹൺ΂ΔͱݖݶࢦఆͳͲ ͸ࡉ͔͘ඞཁ ٕज़બఆͷ؍఺ αʔόϨε ʮҰൠతͳٕज़બఆʯͷϝϯςφϯεੑʹؔ࿈ ͲͪΒΛ࢖͏ʹͯ͠΋҉໧ͷઃఆʢؔ਺΍Ϟδϡʔϧ͕ඞਢͱ͍ͯ͠ͳ͍߲໨ͳͲʣ Λཧղͯ͠࢖Θͳ͚Ε͹ϝϯςφϯεੑ͸௿͘ͳΔɻॏཁͳઃఆ͸֬ೝ͢Δ͜ͱ
  42.    ެࣜͰόϯυϧػೳ͕͋Δ 1ZUIPOɺ/PEFKTɺ(P 1SFWJFX Ͱఏڙ   -BNCEBͷόϯυϧػೳ͕ͳ͍ɻಠࣗͷ

    ϏϧυεΫϦϓτ͕ඞཁ ٕज़બఆͷ؍఺ αʔόϨείʔυόϯυϧ ࢀߟɿhttps://dev.classmethod.jp/articles/terraform-lambda-deployment/ ࢀߟɿhttps://docs.aws.amazon.com/cdk/api/latest/docs/aws-lambda-nodejs-readme.html
  43.    ϝϦοτɿ $%,1JQFMJOFͱ͍͏ެࣜͷ$PEFγϦʔ ζ࣮૷͕͋Δ "84֎ʹݖݶ͕ग़ͣ҆શੑ͸Ұ൪ߴ͍  σϝϦοτɿ $PEFγϦʔζͰ1VMM3FRVFTUͷ$*Λ

    ߦ͍͍ͨ৔߹͸࡞ΓࠐΈ͕ඞཁ  ˞(JU)VC"DUJPOT$JSDMF$*୯ମͷํ͕࠷ॳ͸ָʜ    ϝϦοτɿ 5FSSBGPSN$MPVEͱ͍͏ެࣜͷπʔϧ ʹݖݶΛ౉ͯ͠σϓϩΠ͕Մೳ  σϝϦοτɿ ΞϓϦͷ$*$%͸(JU)VC"DUJPOTΛ བྷΊͨ࡞ΓࠐΈ͕ඞཁ  ˞(JU)VC"DUJPOT$JSDMF$*୯ମͷํ͕ෳࡶʹͳΒͣྑ͍͔΋ʜ ٕज़બఆͷ؍఺ $*$%πʔϧपΓ
  44.  -$POTUSVDU΍-$POTUSVDUΛ࢖͏ ͱ؆୯ʹߏஙՄೳ ྫɿBXTFDTQBUUFSOTNPEVMFͳͲ جຊ͸-$POTUSVDUͰߏ੒͠ࡉ͔͍ઃ ఆΛ͍ͨ͠৔߹͸-$POTUSVDUΛ࢖͏ ͱ໌֬ʹࢦఆͰ͖Δ $POTUSVDUͷৄࡉ͸ҎԼͷεϥΠυΛࢀর ʮ"84#MBDL#FMU0OMJOF4FNJOBS"84$MPVE%FWFMPQNFOU,JU $%,

    ʯ1 IUUQTXXXTMJEFTIBSFOFU"NB[PO8FC4FSWJDFT+BQBOBXTCMBDLCFMUPOMJOF TFNJOBSBXTDMPVEEFWFMPQNFOULJUDEL ʮ"84$%,ʹίϯτϦϏϡʔτ͢ΔͨΊͷ۩ମతͳํ๏ʯ1 IUUQTTQFBLFSEFDLDPNUPNPLJIPXUPBXTDELDPOUSJCVUF ϞδϡʔϧΛ࢖͑͹खಈͱൺֱͯ͠؆୯ ʹ&$4΍&$पΓͷߏ੒ΛߏஙՄೳ ྫFDTGBSHBUFTFSWJDFNPEVMFͳͲ ࡉ͔͍ઃఆΛ͍ͨ͠৔߹͸ެࣜϞδϡʔ ϧΛ૊Έ߹ΘͤΔͱޙ͔Β෼͔Γ΍͘͢ ࡞੒Ͱ͖Δ NPEVMFͷৄࡉ͸ҎԼͷެࣜࢿྉΛࢀর ʮ.PEVMFT0WFSWJFXʯ IUUQTMFBSOIBTIJDPSQDPNUVUPSJBMTUFSSBGPSNNPEVMF JOUFSSBGPSNNPEVMFT ٕज़બఆͷ؍఺ ίϯςφԾ૝Ϛγϯ
  45.  ͕࣍ Terraform Ͱ1൪ͷਪ͠ϙΠϯτʂʂ

  46.    ϝϦοτɿ $MPVE'PSNBUJPOͰରԠͨ͠Ϧιʔε͸ ΄΅͙͢൓ө͞ΕΔɻϚΠφʔ͔ͩΒର Ԡ͞Εͳ͍ͱ͍͏৺഑͸গͳͯ͘ࡁΉ σϝϦοτɿ "84֎෦ͷαʔϏεΛ؅ཧ͢Δػೳ͸ ؚ·Ε͍ͯͳ͍

    ͍͔ͭ͸$%,GPS5FSSBGPSNͰ؅ཧͰ͖Δ͔΋ʁ   ϝϦοτɿ "84Ҏ֎ͷΫϥ΢υαʔϏε΍4BB4ͷ Ϧιʔε؅ཧ΋Մೳ ($1"[VSF"VUI%BUB%PHFUD σϝϦοτɿ "84ͷ৽͍͠ػೳ΍Ұ෦ͷαʔϏε˞ ͸ະରԠͷ΋ͷ͕ଟʑ͋Δ ˞IoTܥͷ IoT EventsɺIoT Analytics ͳͲ ٕज़બఆͷ؍఺ ରԠػೳ AWS IoT Events AWS IoT Analytics
  47. ࣮ફ্ͨ͠Ͱͷٕज़બఆͷ؍఺  ࣗ෼ͷܦݧ͔Βಠࣗʹ؍఺Λ࡞੒ w ։ൃݴޠͷҧ͍ w ίʔυͷΞʔΩςΫνϟݕ౼ w νʔϜεΩϧ w

    σϓϩΠ࣌ͷڍಈ w खಈมߋͷऔΓࠐΈ w αʔόϨε w αʔόϨεʢίʔυόϯυϧʣ w $*$% w ίϯςφԾ૝Ϛγϯϕʔε w ରԠ͍ͯ͠ΔϦιʔε    
  48.  w αʔόϨεPS*P5΍ΔͳΒ"84$%, 5FSSBGPSNΛ࢖ͬͯ΋݁ہผͷ*B$πʔϧ΍ಠࣗπʔϧ͕ඞཁʹͳΓֶशίετ͕૿Ճ w "84֎ͷϦιʔε΋ίʔυ؅ཧ͚ͨ͠Ε͹5FSSBGPSN "84$%,͸$%,GPS5FSSBGPSNͷࠓޙͷਐḿʹظ଴ w ίϯςφԾ૝Ϛγϯ͸"84$%,΋5FSSBGPSN΋͋Γ ϝϯςφϯεੑΛҙ࣮ࣝͨ͠૷͕ඞཁɻ·ͨίʔυͷΞʔΩςΫνϟʹ͍ͭͯ͸ཁ஫ҙ

    w ΞϓϦະܦݧऀ͕ଟ͍ͳΒ5FSSBGPSN ΞϓϦܦݧऀ͕ଟ͍ͳΒ"84$%,ͱ͍͏બͼํ΋͋Γ ൺֱ݁Ռ·ͱΊ
  49. None