$30 off During Our Annual Pro Sale. View Details »

Lambda@Edgeで複数オリジンに振り分けてみた

kawaji
November 13, 2021

 Lambda@Edgeで複数オリジンに振り分けてみた

2021/11/13 クラウドお遍路

kawaji

November 13, 2021
Tweet

More Decks by kawaji

Other Decks in Technology

Transcript

  1. ઒࿏ོٛ -BNCEB!&EHFͰෳ਺Φ ϦδϯʹৼΓ෼͚ͯΈͨ ࢛ࠃΫϥ΢υ͓ว࿏2021

  2. ࣗݾ঺հ w ઒࿏ོٛ w ̏ࣇͷ෕ʢখɺɼஉࢠʣ w ༗ݶձࣾདྷ੘઒ిࢉॴଐ w ίϛϡχςΟ 


    +"846(ಙౡ໊ݹ԰ 
 Ұൠࣾஂ๏ਓ&4%ཧࣄ w ུྺ 
 14ήʔϜ։ൃɺύνϯίձࣾ ৽ଔ̍೥ ɺϑϦ ʔϥϯεʢ̑೥ʣɺ๏ਓܦӦʢ̍̐೥ʣˠฏࣾ һʢ೥ʣ !LBXBKJ@TDSBUDI
  3. ͜Μͳ͜ͱ΍ͬͯΔձࣾʹ͍·͢

  4. ٕज़ऀओମͰઌ୺ʹτϥΠ͍ͯ͠Δ

  5. "84Λར༻͍ͯ͠Δ QEYMBSHF೥Ϧβʔϒυε λϯμʔτΛར༻த ʢ̏̌̌̌ສԁ͙Β͍Β͍͠ʣ

  6. ϦϞʔτϫʔΫଟ͍ ΋ͱ΋ͱग़ࣾ͠ͳ͍ϑϧϦϞʔτϝϯόʔ΍ɺ࢖͍෼͚͍ͯ Δϝϯόʔ͕͍ΔதͰۀ຿͕Մೳʹͳ͓ͬͯΓɺίϩφՒʹ ͳͬͯ΋ϑϧϦϞʔτϝϯόʔ͕શһʹͳ͚ͬͨͩͰͨ͠ɻ ΋ͪΖΜ࢛ࠃ͔Β࢓ࣄ΋Մೳʂʂ

  7. ࢛ࠃͱͷग़ձ͍ ࢛ࠃΏ͔Γ࿮ͳͷͰ Ѫඤ ಙౡձ৔

  8. ͓͖ͬͳ৺ͱثΛ΋ͭํʑͱަྲྀͰ͖·ͨ͠ Ѫඤ ಙౡ

  9. ͦΜͳதͰಙౡࢧ෦ϝϯόʔೖΓ ઒࿏͞Μɺࠓ೔͔Βಙౡࢧ෦ϝϯόʔ ʹͳͬͨΜͰʂʂ

  10. Ͱ΋ຊ೔͸Ѫඤ͔Β

  11. ຊ୊͸ऴΘͬͨͷͰ͓·͚ίʔφʔͰ͢

  12. ԿΛ࿩͔͢ʁ ࠓ೔͸-BNCEB!&EHFΛ঺հ͠Α͏ͱࢥ͍·͢

  13. -BNCEB!&EHF ಛ௃ ίϯςϯπ഑৴ΛΧελϚΠζ͢Δ Ϣʔβʔʹ͍ۙϦʔδϣϯͰ࣮ߦ͞ΕΔ -BNCEBͳͷͰαʔόʔߏங͕ෆཁ Ϣʔεέʔε Ұྫ  ΦϦδϯϨεϙϯεͷϔομʔΛՃ޻ ηΩϡϦςΟཁ݅ͳͲ

     ಈతͳϧʔςΟϯά ϏϔΠϏΞ΁ͷQBUIʹΑΔϧʔϧઃఆͰ͸࣮ݱͰ͖ͳ͍ϧʔςΟϯά͕Մೳ -BNCEBͱͯ͠%ZOBNP%#ͳͲͷ৘ใΛར༻ͯ͠ෳࡶͳཁ݅΋૊ΈࠐΊΔ
  14. -BNCEB!&EHF ಛ௃ ίϯςϯπ഑৴ΛΧελϚΠζ͢Δ Ϣʔβʔʹ͍ۙϦʔδϣϯͰ࣮ߦ͞ΕΔ -BNCEBͳͷͰαʔόʔߏங͕ෆཁ Ϣʔεέʔε Ұྫ  ΦϦδϯϨεϙϯεͷϔομʔΛՃ޻ ηΩϡϦςΟཁ݅ͳͲ

     ಈతͳϧʔςΟϯά ϏϔΠϏΞ΁ͷQBUIʹΑΔϧʔϧઃఆͰ͸࣮ݱͰ͖ͳ͍ϧʔςΟϯά͕Մೳ -BNCEBͱͯ͠%ZOBNP%#ͳͲͷ৘ใΛར༻ͯ͠ෳࡶͳཁ݅΋૊ΈࠐΊΔ ࠓ೔঺հ͢ΔϢʔεέʔε
  15. എܠ ̎ͭͷผ؅ཧ͞ΕͨίϯςϯπΛ഑৴͍ͨ͠ QBUI্͔Β͸ίϯςϯπσΟϨΫτϦΛϢʔβʔʹײͤͨ͘͡͞ͳ͍ 
 ✗ ˓ BQQIPHFIUNM IPHFIUNM BQQGVHBIUNM GVHBIUNM

    ϏϔΠϏΞͷύεύλʔϯͰ͸දݱ͕Ͱ͖ͳ͍
  16. ϏϔΠϏΞ͓͞Β͍ ϏϔΠϏΞ͸༏ઌॱҐɾύεύλʔϯΛྻڍ͢Δ͜ͱʹΑΓϦΫΤετ͕޲͔͏΂͖ ΦϦδϯΛܾఆ͢Δ࢓૊Έ Α͋͘Δઃఆ ༏ઌॱҐ ύεύλʔϯ ΦϦδϯ  BQJ "1*(BUFXBZ

     BQQ BQQΛอ͍࣋ͯ͠Δ4όέοτ  BQQ BQQΛอ͍࣋ͯ͠Δ4όέοτ
  17. ΍Γ͍ͨ͜ͱ ͜ΕΛ ༏ઌॱҐ ύεύλʔϯ ΦϦδϯ  BQJ "1*(BUFXBZ  

    BQQPSBQQΛอ͍࣋ͯ͠Δ4όέοτΛ͍͍ײ͡Ͱ ৼΓ෼͚Δ ༏ઌॱҐ ύεύλʔϯ ΦϦδϯ  BQJ "1*(BUFXBZ  BQQ BQQΛอ͍࣋ͯ͠Δ4όέοτ  BQQ BQQΛอ͍࣋ͯ͠Δ4όέοτ ͜͏͍ͨ͠
  18. ͦΕ-BNCEB!&EHF࢖͑͹Ͱ͖ΔΑ L a mbd a ιʔείʔυ(typescript)

  19. ͦΕ-BNCEB!&EHF࢖͑͹Ͱ͖ΔΑ deployͨ͠L a mbd a ͱCloudFrontΛؔ࿈෇͚Δ ɹ

  20. -BNCEB!&EHFͷ஫ҙ఺ ؀ڥม਺͕ར༻Ͱ͖ͳ͍ EFQMPZઌ͕VTFBTU -BNCEBΛόʔδϣχϯά͞Εͨঢ়ଶͰEFQMPZ͢Δ͜ͱ

  21. -BNCEB!&EHFͷ஫ҙ఺ -BNCEBʹઃఆΛ౉ͤͳ͍͜ͱΛҙຯ͢Δ ։ൃ؀ڥɺຊ൪؀ڥͰͦΕͧΕҟͳΔ஋Λར༻͍ͨ࣌͠ʹࠔΔ ղܾҊ "84ΞΧ΢ϯτ͕ҟͳΔͳΒύϥϝʔλετΞʹಉ໊ͷΩʔͰ஋ΛೖΕΔ ʢίʔϧυελʔτͷ౓ʹ઀ଓ͢Δҝߴίετʁʣ ΦϦδϯͷΧελϜϔομʔΛར༻͢Δʢ௿ίετͳͷͰ͓͢͢Ίʣ ؀ڥม਺͕ར༻Ͱ͖ͳ͍

  22. -BNCEB!&EHFͷ஫ҙ఺ -BNCEB!&EHF༻ʹ࡞੒ͨ͠-BNCEB͸VTFBTUʹEFQMPZ͢Δࣄ͕ඞཁ EFQMPZޙ$MPVE'SPOUʹؔ࿈ͮ͘-BNCEBͷόʔδϣϯΛߋ৽͕ඞཁ ࣮ߦ͸Ϣʔβʔʹ͍ۙΤοδϩέʔγϣϯͰߦΘΕΔͨΊɺϩά͸ҰՕॴʹ ू·Βͳ͍ deployઌ͕us-e a st-1

  23. ͓·͚ͷ͓·͚

  24. $MPVE'SPOU'VODUJPOT ੈքதͷΤοδϩέʔγϣϯʹ૊ΈࠐΈͰಈ࡞͢Δߴ଎࣮ߦ͞ΕΔ 
 -BNCEBGVODUJPO ࣮ߦ্࣌ؒݶ͸NT -BNCEB!&EHFͱൺ΂ͯʮग़དྷͳ͍͜ͱʯ͕ଟ͍ ग़དྷͳ͍͜ͱͷྫ ΦϦδϯΛࢦఆ͢Δ͜ͱ͸ग़དྷͳ͍ %ZOBNP%#ͷΑ͏ͳଞͷ"84αʔϏεʹ઀ଓ͸ग़དྷͳ͍ Τοδϩέʔγϣϯʹ૊Έࠐ·ΕΔ௿ϨΠςϯγʔͳॲཧઐ༻ͷ࢓૊Έ

  25. $MPVE'SPOU'VODUJPOT 3FBDU "OHVMBSͳͲͷ4"1'SBNFXPSLΛར༻͢ΔͱɺϏϧυʹΑΔ੒Ռ෺ ͕JOEFYIUNMͱΞηοτ KBWBTDSJQU ը૾ ͱͳΔ ը໘ભҠʹ͸IPNF MPHJOͳͲར༻͢Δ͕࣮ࡍରԠ͢ΔϦιʔε IUNM

    ͸ଘ ࡏ͠ͳ͍ ͜ͷΑ͏ͳ࣌ʹ4ΛΦϦδϯͱͯ͠ར༻͢ΔͱΤϥʔ͕ฦ͞ΕΔ Τϥʔ͕ฦ͞Εͨ࣌ʹJOEFYIUNMΛฦ͢ํ๏͕঺հ͞ΕͨΓ͍ͯ͠Δ͕ɺ $MPVE'SPOU'VODUJPOTΛར༻ͯ͠ϧʔςΟϯάͯ͋͛͠Δͱ࢖͍΍͍͢ 
 ʢ$MPVE'SPOUͷཪʹ"1*(BUFXBZ͕ଘࡏ͢ΔͱΤϥʔ࣌ʹIUNMΛฦ͢͸ࠔΔͷͰʣ ࡢࠓͷSPA(Single P a ge Applic a tion)Λ੩తίϯςϯπͱͯ͠S3ʹஔ࣌͘ʹศར
  26. $MPVE'SPOU'VODUJPOT w ࣮Ϧιʔε͕ଘࡏ͠ͳ͍ύεΛཁٻ͞Εͨͱ͖͸JOEFYIUNMʹϧʔςΟϯά ͢Δ͚ͩ w ύε͕Ұ཯JOEFYIUNMʹͳΔ͜ͱͰݸผύεͰͷΩϟογϡͰ͸ͳ͘Ωϟο γϡ͕ޮ཰త w ͨͩɺݱঢ়KBWBTDSJQU &4

    ͔͠ར༻Ͱ͖ͳ͍ͷͰ஫ҙɻ.BQ 4FUͱ͔ͳ͍ݴ ޠʹ఍߅ײ͸͋Δ΋ͷͷͦΜͳʹෳࡶͳ͜ͱΛ͢Δ͜ͱ͸૝ఆ͠ͳ͍ͷͰେ ৎ෉ɻ w γϛϡϨʔλ͕ଘࡏͯ͠NTҎ಺ʹऩ·Δ͔͸ࣄલνΣοΫՄೳ ࡢࠓͷSAP(Single P a ge Applic a tion)Λ੩తίϯςϯπͱͯ͠S3ʹஔ࣌͘ʹศར
  27. ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠