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

Ruby × AWS Lambdaで サーバーレスの導入~TUNAG分析基盤の事例をもとに~

uuushiro
June 08, 2019

Ruby × AWS Lambdaで サーバーレスの導入~TUNAG分析基盤の事例をもとに~

uuushiro

June 08, 2019
Tweet

More Decks by uuushiro

Other Decks in Technology

Transcript

  1. 3VCZº"84-BNCEBͰ αʔόʔϨεͷಋೖ /BHPZB3VCZ,BJHJ 56/"(෼ੳج൫ͷࣄྫΛ΋ͱʹ  :VTIJSP.BUTVUBOJ!VVVTIJSP

  2. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE ࣗݾ঺հ 2 Yushiro Matsutani Twitter/GitHub @uuushiro 2016.9 גࣜձࣾελϝϯͰΠϯλʔϯ։࢝

    2017.1 גࣜձࣾελϝϯʹೖࣾʢ৽ଔୈ1߸ʣ ݱࡏ͸ج൫νʔϜ Rubyྺ΋͏͙͢3೥͘Β͍
 ॳΊͯ৮ͬͨRailsͷόʔδϣϯ͸5.0
  3. ձ ࣾ ֓ ཁ

  4. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE גࣜձࣾελϝϯ 4 w೥݄ʹ૑ۀ ݄ઃཱ  w໊ࣾ4UBS.FNCFSTʹ༝དྷ wຊ໊ࣾݹ԰ ُౡӺ

    
 ࢧࣾޒ൓ాɺകాɺ෱Ԭ w໾৬һ໊ ϓϩμΫτ෦໊  w56/"(ͷاըɺ։ൃɺӡ༻
  5. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE 56/"(ͱ͸ 5 wձࣾͱࣾһɺࣾһಉ࢜ͷ৴པؔ܎ߏஙΛ໨తͱͨ͠اۀ޲͚4/4 w೥݄ʹϦϦʔε͠ɺಋೖاۀ਺͸Λ௒͑Δ   wۀ຿࿈བྷͰ͸ͳ͘ɺ͓ޓ͍Λ஌Γཧղ͢Δ͜ͱ͕໨త wlࣾ಺4/4͸೉͍͠zΛɺίϯαϧςΟϯάͱzࣾ಺੍౓zͰղܾ

  6. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE ڈ೥ͷ݄຤ʹ"84-BNCEB͕3VCZʹରԠ 6

  7. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE "84-BNCEBͱ͸ʁ 7 w'VODUJPOTBTB4FSWJDF wαʔόʔͷ؅ཧແ͠ͰίʔυΛ࣮ߦͰ͖Δ wैྔ՝੍ۚ wࣗಈͰεέʔϧΞ΢τ IUUQTEPDTBXTBNB[PODPNKB@KQMBNCEBMBUFTUEHXFMDPNFIUNM

  8. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE 3VCZ,BJHJʹͯ 8

  9. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE 3VCZ,BJHJʹͯ 9

  10. 3VCZº"84-BNCEBͷ ؅ཧϑϨʔϜϫʔΫɾࣗಈςετʹ͍ͭͯ ։ൃɾӡ༻دΓͷ࿩Λ͠·͢

  11. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE ΞδΣϯμ 11 ؅ཧϑϨʔϜϫʔΫΛར༻ͨ͠։ൃ αʔόʔϨε׆༻ͷഎܠ ࣗಈςετ

  12. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE ΞδΣϯμ 12 ؅ཧϑϨʔϜϫʔΫΛར༻ͨ͠։ൃ αʔόʔϨε׆༻ͷഎܠ ࣗಈςετ

  13. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE 56/"(ͷچ෼ੳج൫ͷ՝୊ 13 㾎σʔλ૿Ճ͠ॲཧ͕࣌ؒ૿େ 㾎ूܭ༻αʔόʔ &$ ͷӡ༻ίετ͕͔͔Δ

  14. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE "84-BNCEBͰղܾͦ͠͏ 14 w"84-BNCEBͰม׵ॲཧΛฒྻॲཧ࣌ؒ͠୹ॖ w&$Λ"84-BNCEBʹஔ͖׵͑ӡ༻ίετͷ࡟ݮ

  15. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE ৽ج൫ʹ͓͚Δ
 -BNCEBͷར༻Πϝʔδ 15 w"84αʔϏεؒͷ
 ઀ணࡎͱͯ͠࢖͏ w3VCZͰ42-Λ
 ಈతʹ૊ΈཱͯΔ

  16. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE ΞδΣϯμ 16 ؅ཧϑϨʔϜϫʔΫΛར༻ͨ͠։ൃ αʔόʔϨε׆༻ͷഎܠ ࣗಈςετ

  17. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE αʔόʔϨεΞϓϦέʔγϣϯͷ؅ཧ͕େม 17 wෳ਺ͷ"84-BNCEBͷ؅ཧ͕൥ࡶ wσϓϩΠʹख͕͔͔ؒΔ w(FN΍ڞ௨ίʔυͷѻ͍͕Α͘Θ͔Βͳ͍

  18. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE "844FSWFSMFTT"QQMJDBUJPO.PEFM "844". 18 wαʔόʔϨεΞϓϦέʔγϣϯͷ؅ཧϑϨʔϜϫʔΫ w$MPVE'PSNBUJPOͷ֦ு wϩʔΧϧͰ"84-BNCEBͷߏஙɾςετɾσόοά͕Մೳ wΞϓϦέʔγϣϯͷϏϧυɾύοέʔδϯάɾσϓϩΠίϚϯυΛఏڙ

  19. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE 4".ͷ࢖༻ྫ3VCZͷαϯϓϧΞϓϦέʔγϣϯ 19

  20. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE 4".ͷ࢖༻ྫ3VCZͷαϯϓϧΞϓϦέʔγϣϯ 20 wର৅ؔ਺ͷϑΥϧμͷ[JQϑΝΠϧΛ࡞੒͠4΁Ξοϓϩʔυ wQBDLBHFEZBNMΛ࡞੒͠ϩʔΧϧͷੜ੒෺΁ͷࢀরΛ
 Ξοϓϩʔυͨ͠4ͷ63-ʹஔ͖׵͑Δ wςϯϓϨʔτʹهड़͞Ε͍ͯΔ௨ΓͷϦιʔε͕ߏங͞ΕΔ

  21. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE -BNCEBͷ࣮ߦ؀ڥΛ
 λʔήοτͱ͢Δ੒Ռ෺Λੜ੒ ґଘؔ܎ͷղܾ 21 ੒Ռ෺ΛBXTTBNCVJME഑Լʹ࡞੒ (FNpMFʹԠͯ͡ҎԼ͕࣮ߦ͞ΕΔ "84-BNCEBͰ͸WFOEPSCVOEMF͕ HFNͷ୳ࡧσΟϨΫτϦର৅

  22. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE OBUJWFFYUFOUJPOͷѻ͍OPLPHJSJ 22 wωΠςΟϒ֦ு͕͋Δ(FN͸ɺ-BNCEBͱ
 ಉ౳؀ڥͰίϯύΠϧ͢Δඞཁ͕͋Δ wOPLPHJSJ͕ґଘ͍ͯ͠ΔMJCYNMͱMJCYTMU͸ -BNCEBͷΠϝʔδʹؚ·Ε͍ͯΔͷͰɺҎԼͰ
 ϏϧυՄೳ

  23. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE OBUJWFFYUFOUJPOͷѻ͍NZTRM 23 wNZTRM͕ґଘ͍ͯ͠ΔNZTRMEFWFM͸-BNCEBͷ
 Πϝʔδʹؚ·Ε͍ͯͳ͍ w-BNCEBΠϝʔδίϯςφͰඞཁͳύοέʔδΛ
 Πϯετʔϧ্ͨ͠ͰCVOEMFJOTUBMMΛ͢Δ wඞཁͳڞ༗ϥΠϒϥϦ MJCNZTRMDMJFOU

    ͸ɺ -%@-*#3"3:@1"5)ʹ഑ஔ͢Δ
  24. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE ڞ௨ίʔυ΍(FNΛ͏·͘ѻ͍͍ͨ 24 wෳ਺ͷ-BNCEBͰڞ௨ͷ3VCZίʔυ΍
 (FN͕ଘࡏ  ͦΕͧΕσϓϩΠύοέʔδʹؚΊͳ͚Ε͹ͳΒͳ͍ wίʔυΛมߋ͢Δͨͼʹґଘؔ܎ͷ
 Ξοϓϩʔυ͕ඞཁ

     (FNͱΞϓϦέʔγϣϯίʔυมߋͷपظ͸ҟͳΔ
  25. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE "84-BNCEB-BZFST 25 w ෳ਺ͷ"84-BNCEBͰίʔυΛڞ༗Ͱ͖Δ࢓૊Έ w -BNCEBΛݺͼग़͢ͱ-BZFST͕ίϯςφͷPQU഑ԼʹϚ΢ϯτ͞ΕΔ w TBNCVJME͸ݱ࣌఺ͰඇରԠ

    IUUQTBXTBNB[PODPNKQCMPHTDPNQVUFXPSLJOHXJUIBXTMBNCEBBOEMBNCEBMBZFSTJOBXTTBN
  26. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE "84-BNCEB-BZFSTͷϝϦοτ 26 wؔ਺ίʔυͷαΠζ͕খ͘͞ͳΔ wґଘؔ܎ͱϏδωεϩδοΫͷؒͰɺؔ৺ࣄͷ෼཭Λڧ੍ IUUQTBXTBNB[PODPNKQCMPHTDPNQVUFXPSLJOHXJUIBXTMBNCEBBOEMBNCEBMBZFSTJOBXTTBN

  27. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE ڞ௨ίʔυ༻-BZFST 27 IUUQTHJUIVCDPNBXTMBCTBXTMBNCEBDPOUBJOFSJNBHFDPOWFSUFS -BZFSTʹ͓͚Δ3VCZϥΠϒϥϦͷ୳ࡧύε

  28. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE (FN༻-BZFST 28 IUUQTHJUIVCDPNBXTMBCTBXTMBNCEBDPOUBJOFSJNBHFDPOWFSUFS -BZFSTʹ͓͚ΔHFNͷ୳ࡧύε

  29. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE JNHMBNCEBΛ࢖ͬͨ
 -BZFSTͷσϓϩΠ ͓·͚ 29 w %PDLFSΠϝʔδΛ-BNCEB΍
 -BZFSTʹม׵͠σϓϩΠ w

    ґଘؔ܎ΛΠϝʔδʹด͡ࠐΊ
 มߋ͕͋Ε͹࠶Ϗϧυ w ศར͕ͩ4".ͷ
 ϩʔΧϧ࣮ߦ -BZFST΋ؚΊͨ ͕
 ׆͔ͤͳ͍ͷͰࠓճ͸ෆ࠾༻ IUUQTHJUIVCDPNBXTMBCTBXTMBNCEBDPOUBJOFSJNBHFDPOWFSUFS
  30. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE "844".Λར༻ͨ͠։ൃ·ͱΊ 30 wෳ਺ͷ-BNCEB͸ςϯϓϨʔτͰҰݩ؅ཧ wσϓϩΠ͸TBNDMJͰίϚϯυͰ؆୯ʹ wґଘؔ܎͸TBNCVJMEίϚϯυͰղܾ  ඞཁʹԠͯ͡-BNCEBͷ%PDLFSΠϝʔδΛར༻ wڞ௨ίʔυ΍(FN͸-BZFSTͰڞ༗Մೳ

  31. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE ΞδΣϯμ 31 ؅ཧϑϨʔϜϫʔΫΛར༻ͨ͠։ൃ αʔόʔϨε׆༻ͷഎܠ ࣗಈςετ

  32. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE ࣗಈςετͷํ਑ 32 w-BNCEB͸ଞͷαʔϏεͱͷ࿈ܞ͕ଟ͘
 ౷߹ςετ͕ॏཁʹͳΔ wΫϥ΢υ্Ͱͷݕূ͸ֻ͕͔࣌ؒΓա͗ΔͷͰ
 ͳΔ΂͘ϩʔΧϧͰ࣮ߦɾςετ͍ͨ͠ w*".ݖݶͳͲͷςετ͸Ϋϥ΢υ্Ͱߦ͏

  33. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE ϩʔΧϧςετ 33 w"84-BNCEBͷґଘΛഉআ͠
 ୯ମςετΛ͠΍͍͢Α͏ʹ w"84αʔϏεʹґଘ͢ΔϩδοΫ͸ελϒΛར༻ wϩʔΧϧʹ-BNCEBͷΤϯυϙΠϯτΛىಈ͠
 -BNCEBɾ-BZFSTΛςετ

  34. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE ςετͷྫ"UIFOB΁ͷΫΤϦ͕ࣦഊͨ͠έʔε 34 "UIFOB΁ͷΫΤϦ࣮ߦ"1*Λୟ͘ ΫΤϦ͸ඇಉظతʹॲཧ͞ΕΔͨΊ
 ࣮ߦ*%Λ΋ͱʹ࣮ߦঢ়گΛ໰͍߹ΘͤΔ ΫΤϦͷ݁ՌΛऔಘ͠ঢ়ଶ͕
 l'"*-&%zͳΒྫ֎Λ౤͛Δ 1

    2 3
  35. !35 "844%,GPS3VCZΛ࢖ͬͯ
 "UIFOBͷΫΤϦΛ࣮ߦ͢Δ"1*Λୟ͘ 1

  36. !36 "844%,GPS3VCZΛ࢖ͬͯ
 "UIFOBͷΫΤϦΛ࣮ߦ͢Δ"1*Λୟ͘ ΫΤϦ࣮ߦ*%Λ΋ͱʹ
 ࣮ߦঢ়گΛ໰͍߹ΘͤΔ 1 2

  37. !37 "844%,GPS3VCZΛ࢖ͬͯ
 "UIFOBͷΫΤϦΛ࣮ߦ͢Δ"1*Λୟ͘ ΫΤϦ࣮ߦͷ
 εςʔλε໰͍߹Θͤ݁Ռ͕
 '"*-&%ʹͳͬͨΒྫ֎Λ౤͛Δ ΫΤϦ࣮ߦ*%Λ΋ͱʹ
 ࣮ߦঢ়گΛ໰͍߹ΘͤΔ 1 2

    3
  38. !38 ϋϯυϥʔͷҾ਺ͳͲ -BNCEBʹґଘ͢ΔՕॴ͔Β
 ϩδοΫΛ੾Γ཭͢

  39. !39 -BNCEBʹґଘ͠ͳ͍ίʔυʹͳΓ
 ී௨ʹςετͰ͖Δ

  40. !40 "84αʔϏεʹґଘ͢ΔϩδοΫΛ Ͳ͏ςετ͢Δ͔ʁ

  41. !41 "84αʔϏεʹґଘ͢ΔϩδοΫΛ Ͳ͏ςετ͢Δ͔ʁ ελϒΛ೜ͼࠐ·ͤΔ༨஍Λ༩͑Δ

  42. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE "844%,GPS3VCZͷελϒػೳ 42 w"1*ΞΫηεͷϨεϙϯεɾΤϥʔΛελϒ͢Δ w"84"1*ΫϥΠΞϯτΛ࣮ߦ͢ΔΑ͏ʹৼΔ෣͏ w-PDBM4UBDL΋͍͍͕ɺࠓճඞཁͳ"84"UIFOBɾ(MVF͸
 ඇαϙʔτͩͬͨ  5FTUBCMF-BNCEB

    !U@XBEB ͕ͱͯ΋ࢀߟʹͳΔ  IUUQTTQFBLFSEFDLDPNUXBEBUFTUBCMFMBNCEBXPSLJOHF⒎FDUJWFMZXJUIMFHBDZMBNCEB
  43. !43 ελϒػೳΛ༗ޮʹ

  44. !44 "UIFOBΫΤϦ࣮ߦͷ
 ϨεϙϯεσʔλΛ࡞੒ "UIFOBΫΤϦ࣮ߦͷ Ϩεϙϯεʹઃఆ

  45. !45 "UIFOBΫΤϦ
 ࣮ߦঢ়گ͕z'"*-&%zͷ σʔλΛ࡞੒ ΫΤϦ࣮ߦঢ়گ֬ೝϦΫΤετͷ ϨεϙϯεʹϑΣΠΫͷ݁ՌΛઃఆ

  46. !46 ελϒΦϒδΣΫτΛ
 Ҿ਺Ͱ౉͢ ϩʔΧϧͰ"84αʔϏε ґଘͷςετ͕Ͱ͖ͨ

  47. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE ϩʔΧϧͰ"84-BNCEBɾ-BZFSTͷςετ 47 ϩʔΧϧͰ-BNCEBͷΤϯυϙΠϯτΛىಈ ΤϯυϙΠϯτΛϩʔΧϧʹ޲͚Δ -BZFSTΛؚΊͨςετ͕ ϩʔΧϧͰ࣮ߦՄೳʹ

  48. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE $*$% 48 w$PEF%FQMPZͷ1SF)PPLؔ਺Λར༻͠؆қͳ౷߹ςετΛ࣮ߦ w1SF)PPLؔ਺Ͱɺ৽WFSͷ-BNCEBΛ࣮ߦ wΤϥʔ͕͋Ε͹ϩʔϧόοΫ

  49. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE ৽෼ੳج൫ΞʔΩςΫνϟ 49

  50. $PQZSJHIU˜TUNO JOD"MMSJHIUTSFTFSWFE ·ͱΊ 50 w-BNCEB͕3VCZରԠͨ͜͠ͱͰαʔόʔϨε͕
 ελϝϯʹͱͬͯ਎ۙͳ΋ͷʹͳͬͨ w؅ཧϑϨʔϜϫʔΫͷ͓͔͛Ͱӡ༻ָ͕ʹ wͳΔ΂͘ϩʔΧϧͰςετ͢Δ͜ͱͰ։ൃ଎౓61