AWS Lambda Go First Impression

AWS Lambda Go First Impression

presentation @ golang.tokyo #12

5bfed9aa3a9ebccb0c0f0cb65ee9e012?s=128

Seiji Takahashi

January 29, 2018
Tweet

Transcript

  1. First Impression of

  2. aws-lambda-go • Seiji Takahashi • Github: timakin / Twitter: @__timakin__

    • גࣜձࣾGunosy ৽نࣄۀ։ൃࣨ • Go / Swift ࣗݾ঺հ
  3. ੵ ۃ ࠾ ༻ தʂ

  4. ࠓ೔࿩͢͜ͱ

  5. None
  6. None
  7. None
  8. ࠓ·ͰͲ͏͔ͯͨ͠ • apex • ਖ਼ࣜαϙʔτ͞Εͯͳ͍ݴޠͰ΋lambdaͷ ؔ਺Λॻ͚Δ • awscliΑΓ؆୯ʹσϓϩΠ

  9. ࠓ·ͰͲ͏͔ͯͨ͠ • Node (index.js) -> GoͷόΠφϦ • apex.HandlerFuncͱ͍͏ϋϯυϥͷ
 ίʔϧόοΫ಺෦ͰΠϕϯτड͚औΓ

  10. ࠓ͸Ͳ͏͢Δ͔ • aws-lambda-go • awsਖ਼ࣜαϙʔτͷlambda package • apexΛ࢖ͬͯͨਓͳΒҠߦ͸༰қ

  11. ࣮ࡍʹҠߦͯ͠ΈΔ

  12. before

  13. after

  14. ҧ͍͸ʁ • ຊ࣭తʹ͸ͳ͍ • ݟͨ໨্ίʔϧόοΫͰड͚औΔ͔ɺ
 ී௨ʹϋϯυϥʔͷҾ਺Ͱड͚औΔ͔ͷ
 ҧ͍͸͋Δɻ • deploy͕awscliܦ༝ɻ •

    AWSެࣜDocͰinitͰͷάϩʔόϧม਺ͷ
 ॳظԽ͕ਪ঑͞Ε͍ͯΔɻ
  15. packageͷίʔυ • AWS͸೜ज़Έ͍ͨͳίʔυॻ͖͕ͪ • aws-sdk-goͱ͔͍͢͝ɻ
 ίʔϧόοΫͷຐज़ࢣͰ΋͍ΔͷͰ͸ɻ • aws-lambda-go΋ޚଟ෼ʹ࿙Εͳ͍

  16. None
  17. ͜Ε͸Կ 
 RPC༻ͷΧελϜϦεφʔͷ࡞੒ ͔Βͷݺͼग़͠Λͯ͘͠ΕΔ܅

  18. <- package͕࣮૷͍ͯ͠ΔInvoke
 funcΛݺͼग़ͤΔΑ͏ʹwrap

  19. <- ͍͕ͭ͜Ғ͍΍ͭ

  20. ɾϦΫΤετͷτϨʔγϯά ɾλΠϜΞ΢τ؅ཧ ɾRequestIDͷอ࣋ ͳͲͷͨΊʹಠࣗcontextΛ࡞੒্ͨ͠ͰɺhandlerΛݺͼग़͠

  21. None
  22. None
  23. None
  24. ৻·͍͠ context in context (request-scopedͳͷͰਖ਼͍͠)

  25. <- RPCͷݺͼग़͠ީิʹొ࿥

  26. <- RPC Accept

  27. None
  28. None
  29. ҰఆͷϧʔϧΛ९क͢Ε͹ϋϯυϥͱΈͳ͞ΕΔ

  30. ৘೤తͳreflection

  31. ษڧʹͳΔ

  32. ·ͱΊ • aws-lambda-go͸Ҡߦɺ৽ن࡞੒ָ͕ʂ • த਎ͷίʔυ͕໘ന͍ʂ • RPC callͷ࣮ྫ • contextͷ࢖͍ํʹ͍ͭͯߟ͑ͤ͞ΒΕΔ

    • reflectionͷԠ༻ྫ
  33. Thank you! ✨