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

AWS SAM + Rubyのすゝめ

Y_uuu
March 24, 2021

AWS SAM + Rubyのすゝめ

Fukuoka.rb 200回 LT大会 (#202)
https://fukuokarb.connpass.com/event/206956/

みんな、RubyでLambda Functionを書こう!

Y_uuu

March 24, 2021
Tweet

More Decks by Y_uuu

Other Decks in Technology

Transcript

  1. AWS SAM + Rubyͷ͢ʍΊ
    2021-03-24(Wed
    )

    Fukuoka.rb 200ճ LTେձ (#???)
    Ԭቌ ༤ฏ
    1

    View full-size slide

  2. ॕɾFukuoka.rb 200ճ!!
    🎉🎉🎉

    View full-size slide

  3. ࣗݾ঺հ
    Ԭቌ ༤ฏ
    Okazaki Yuhei
    ‣ I
    D

    - @yuuu @Y_uuu
    ‣ ࣗݾ঺հ
    • FusicͷIoTΫϥ΢υΤϯδχΞ
    • ݩɾ૊ࠐΈΤϯδχΞ(2018೥͔ΒWebܥ΁
    )

    • ࠷ۙͷ͓࢓ࣄ͸ઐΒAzure
    ‣ Skil
    l

    3
    image
    ʘNewʗ

    View full-size slide

  4. AWS Lambda
    4
    ‣ ͍ΘΏΔFaaS (Function as a Service)
    - αʔόϨε
    - εςʔτϨε
    - ίϯςφ
    - Πϕϯτۦಈ
    - ͪΐͬͱͨ͠ϓϩάϥϜΛ؆୯ʹಈ͔ͤΔ

    View full-size slide

  5. Lambda͸RubyͰ΋ॻ͚Δ
    5
    ‣ re:Invent 2018Ͱൃද
    - Rubyist׻تʂ
    - ฐࣾͰ΋RubyͰͷ࣮૷͕૿͑Δ
    ‣ 2020೥2݄ʹruby 2.7΋ରԠ

    View full-size slide

  6. ΋ͬͱར༻͞ΕΔ΂͖
    6
    ‣ ଞͷݴޠʹൺ΂Δͱਓؾ͕௿͍Β͍͠
    https://www.datadoghq.com/ja/state-of-serverless/

    View full-size slide

  7. Rubyistʹ΋ͬͱLambdaΛ࢖ͬͯ΋Β͍͍ͨʂ
    AWS SAM + Rubyͷ͢ʍΊ

    View full-size slide

  8. AWS SAM
    8
    ‣ SAM=Serverless Application Mode
    l

    - LambdaΛத৺ͱͨ͠AWSϦιʔεΛ؆୯ʹ࡞੒
    - CLIΛ࢖ͬͯ؆୯ʹߏஙɾςετɾσϓϩΠՄೳ

    View full-size slide

  9. 3 STEPͰ؆୯σϓϩΠʂ
    ࢖͍ํ

    View full-size slide

  10. STEP0. ࣄલ४උ
    10
    ‣ AWSΞΧ΢ϯτͷ࡞੒
    ‣ AWS SAM CLIͷΠϯετʔϧ
    - https://docs.aws.amazon.com/ja_jp/serverless-application-model/latest/
    developerguide/serverless-sam-cli-install.html
    ‣ AWSೝূ৘ใͷઃఆ
    - https://docs.aws.amazon.com/ja_jp/serverless-application-model/latest/
    developerguide/serverless-getting-started-set-up-credentials.html
    AWS SAMΛ࢖͏ͨΊʹҎԼͷ४උ͕ඞཁͰ͢

    View full-size slide

  11. STEP1. ϓϩδΣΫτ࡞੒
    11
    AWS SAM CLIΛ࢖ͬͯϓϩδΣΫτΛ࡞੒͠·͢

    View full-size slide

  12. STEP1. ϓϩδΣΫτ࡞੒
    12
    ໎Θͣʮ3 - ruby2.7ʯΛબ୒͠·͠ΐ͏

    View full-size slide

  13. STEP2.ίʔσΟϯά
    13
    ༧Ίhello_world͕αϯϓϧͱͯ͠༻ҙ͞Ε͍ͯΔ

    View full-size slide

  14. STEP2.ίʔσΟϯά
    14
    AWSϦιʔεߏ੒Λtemplate.ymlʹهड़

    View full-size slide

  15. STEP2.ίʔσΟϯά
    15
    ඞཁͳRubyGemΛGemfileʹ௥Ճ

    View full-size slide

  16. STEP2.ίʔσΟϯά
    16
    app.rbʹRubyͷϓϩάϥϜΛهड़

    View full-size slide

  17. STEP3.σϓϩΠ
    17
    AWS SAM CLIΛ࢖ͬͯϏϧυˠσϓϩΠ

    View full-size slide

  18. STEP3.σϓϩΠ
    18
    AWS SAM CLIΛ࢖ͬͯϏϧυˠσϓϩΠ

    View full-size slide

  19. API͕׬੒
    19
    https://bit.ly/3qUzb0K

    View full-size slide

  20. ࠷ۙ࡞ͬͨ΋ͷΛ঺հ
    Ԡ༻ྫ

    View full-size slide

  21. Թ౓ηϯαΛ࢖ͬͨIoTγεςϜ
    21
    Թ౓ηϯα͔Βଌఆ஋Λऩूˠ௨஌
    https://github.com/yuuu/iot_dev_starting_book_site
    AWS SAMͰߏங

    View full-size slide

  22. Թ౓ηϯαΛ࢖ͬͨIoTγεςϜ
    22
    ϒϥ΢βͰଌఆ஋ΛάϥϑԽ
    https://github.com/yuuu/iot_dev_starting_book_site
    AWS SAMͰߏங

    View full-size slide

  23. ToFଌڑηϯαΛ࢖ͬͨண࠲؂ࢹγεςϜ
    23
    ଌఆ஋ʹԠͨ͡ϑΟʔυόοΫ੍ޚ
    https://github.com/yuuu/build_and_learn_soracom_book_site
    AWS SAMͰߏங

    View full-size slide

  24. ฐࣾࣾһͷ20ࡀͷ஀ੜ೔ΛΧ΢ϯτμ΢ϯ͢ΔSlack Bot
    24
    ੒ਓࣾһ͔ΒͷΞυόΠεΛఴ͑ͯΧ΢ϯτμ΢ϯϝοηʔδΛPOST

    View full-size slide

  25. ·ͱΊ
    25
    •RubyͰLambdaΛॻ͖·͠ΐ͏ʂ
    • ͜͜·Ͱ5෼Ҏ಺ʹऩ·͍ͬͯΔ͸ͣʘ(^o^)ʗ

    View full-size slide

  26. ͝ਗ਼ௌ͍͖ͨͩ͋Γ͕ͱ͏͍͟͝·ͨ͠
    Thank You
    We are Hiring
    !

    https://recruit.fusic.co.jp/

    View full-size slide