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

Lambdaで勤怠連絡

32110e49878cbda9c310dcc5c53e750c?s=47 k-kurikuri
April 17, 2018

 Lambdaで勤怠連絡

Go(Un)Conference

32110e49878cbda9c310dcc5c53e750c?s=128

k-kurikuri

April 17, 2018
Tweet

More Decks by k-kurikuri

Other Decks in Technology

Transcript

  1. AlexaͱLambdaͰ ۈଵ࿈བྷΛ͔ͨͬͨ͠… Go(Un)ConferenceLTେձ@k-kurikuri

  2. ΞδΣϯμ • AlexaͱAWS Lambda(Go)Ͱۈଵ࿈བྷ͍ͨ͠ • Ͱ΋͍᪴ͨͷͰஅ೦ͨ͠ • Ͱ΋୅ସҊͰ։ൃͨ͠ͷͰৼΓฦΓ • σϞ

    • TODOͳͲɺ·ͱΊ
  3. ։ൃʹࢸΔ͖͔͚ͬ • Amaozon EchoΛߪೖͨ͠ • Alexa Skill։ൃΩοτ͕͋ΓɺΧελϜεΩϧ ΛAWS LambdaͰ࣮૷Ͱ͖Δ •

    2018/01ʹެࣜαϙʔτ͞ΕͨGoΛ࢖͍͍ͨ
  4. AWS Lambdaͱ͸? • ͍ΘΏΔαʔόʔϨεΞʔΩςΫνϟ • EC2ͷΑ͏ʹৗ࣌αʔόΛՔಇ͢ΔͷͰ͸ͳ ͘ɺΠϕϯτۦಈͰඞཁͳ࣌ʹॲཧΛߦ͏ • ඞཁͳ࣌ʹػೳΛ࢖༻͢ΔͨΊඅ༻͕҆͘͢Ή •

    Python, Java, Node.js, C#, GoͰ࣮૷Ͱ͖Δ
  5. ͔ͤͬ͘࡞ΔͳΒ ࣗ෼ͷ໾ʹཱͭ΋ͷΛ

  6. ۈଵϝʔϧΛૹΔͷ͕ ࠷ߴʹμϧ͍

  7. ෍ஂͷத͔Βۈଵ࿈བྷ͍ͨ͠ • ʮΞϨΫαɻମௐෆྑͰ஗ࠁ(or ܽۈ)͢Δɻग़ࣾ͸ 12:00ͷ༧ఆʯ • ͬͦ͘͞Amazon Developer͔ΒLambdaͱAlexaΛɹ ࿈ܞͤͯ͞ΈΔ •

    Alexa͕εΩϧͷԻ੠ೝࣝͯ͘͠Εͳͯ͘υϋϚϦ • ͦ΋ͦ΋งғؾ։ൃ͕ྑ͘ͳ͍
  8. ͬ͞͞ͱAlexa͸அ೦ʂ

  9. ํ޲స׵ • ͱʹ͔͘LambdaͰGo࢖͍͍ͨΜ΍ • APIGateway + LambdaͰGmailૹ৴͠Α͏ • ػೳͷ࣮૷͓͚ͯ͠͹ΠϕϯττϦΨʔ͸ɹ ޙͰ΋࿈ܞͰ͖Δ

  10. ཧ૝

  11. ݱ࣮

  12. ։ൃπʔϧ • serverless (npm) • goenv • aws-lambda-go • oauth2/google,

    api/gmail/v1 • IntelliJ + FileWatcher + go fmt
  13. serverless (sls) module • CLIͰLambdaͷ։ൃ͕ग़དྷΔnpmϞδϡʔϧ • sls create, sls deployͰςϯϓϨʔτϓϩδΣΫτ

    ࡞੒͔ΒσϓϩΠ·Ͱ • σϓϩΠͷϑϩʔ͸CloudFormation, S3, Lambda • Node.js, Python, Java͸ϩʔΧϧ։ൃՄೳ
  14. Goͷ࣮૷Ͱ٧·ͬͨՕॴ • Golang͔ΒGmailΛૹ৴͢Δ࣌ʹɺSubjectͷ೔ຊޠ͕จࣈ Խ͚͢Δ • DotenvͰ࢖༻͢ΔϑΝΠϧ͸Ϗϧυʹ͸ؚ·Εͳ͍? • depͰ “golang.org/x/oauth2/google”Λensureͯ͠΋ࢀর Ͱ͖ͳ͍

    • Go1.9vͰϏϧυͨ͠ޙʹɺbrew upgrade goͰ1.10ʹ্͛ ͨΒϏϧυ͕௨Βͳ͘ͳͬͨ
  15. σϞ

  16. TODO • ग़ࣾ࣌ؒͱ஗ࠁཧ༝͕ܾΊଧͪͳͷͰɺΦϓγϣϯ ͰࢦఆͰ͖ΔΑ͏ʹ͢Δ • GoͰ٧·ͬͨՕॴ͸1ͭͣͭղফ • ෍ஂ͔Βۈଵ࿈བྷ͢ΔͨΊɺAlexaͷεΩϧ։ൃΛ ଓ͚͍ͨ •

    ։ൃίετ8hҐ (֓ࢉ)
  17. github.com/k-kurikuri/lambda-send-mail

  18. ͝੩ௌ ͋Γ͕ͱ͏͍͟͝·ͨ͠