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

AWS Lambda & Ruby/Rails with SAM

AWS Lambda & Ruby/Rails with SAM

F0b14b7dbae1e90259eb946d1c841a17?s=128

Ken Collins

March 06, 2019
Tweet

Transcript

  1. AWS Lambda & Ruby/Rails with SAM

  2. Congratulations! The simple fact that you are sitting here listening

    to me, means you've made a glorious contribution to Science! Tragic, but informative. Cave Johnson
  3. Ken Collins Staff Engineer @CustomInk @MetaSkills

  4. None
  5. ⠀ ⠀ ⠀      

  6. KNOWLEDGE Rails & Lambda Ruby & Lambda Tech Intro AWS

    SAM Objectives & Results
  7. None
  8. None
  9. Change The World One Lambda at a Time!

  10. Using Ruby with AWS Lambda & SAM https://github.com/757rb/hello-757rb-lambda

  11. Custom Ink | Tech Blog https://technology.customink.com

  12. https://dctechslack.herokuapp.com https://slackin757dev.herokuapp.com DCTech || 757Dev

  13. Tech Intro

  14. Strap Bootstrap your macOS development system. GitHub Project https://github.com/MikeMcQuaid/strap

  15. • ./bin/ • bootstrap, setup, build, server, 
 deploy, test,

    … • Usually Bash Strap
  16. AWS Lambda

  17. None
  18. AWS SAM GitHub Project https://github.com/awslabs/serverless-application-model/

  19. $ sam

  20. https://github.com/awslabs/serverless- application-model/blob/master/versions/ 2016-10-31.md

  21. https://docs.aws.amazon.com/ AWSCloudFormation/latest/UserGuide/aws- template-resource-type-ref.html CLOUDFORMATION

  22. $ sam local start-api

  23. $ sam build --use-container

  24. $ sam package … $ sam deploy …

  25. Ruby & Lambda

  26. Project Pillars • Local Development Feedback • Using Gems with

    Native Extensions • Using DynamoDB
  27. Contrived Architecture DynamoDB HTTP /plos?query={query}

  28. None
  29. Docker Image lambci/lambda:ruby2.5

  30. Local Dev Deps

  31. Easy Development & Browser Refreshes

  32. Patterns • Directories (app, test, etc) • Lean Handler &

    PORO Usage • Debug HTML. Event, Context, & ENV • Minitest, TravisCI, & Capybara*
 
 *not really
  33. Aws::Record GitHub Project https://github.com/aws/aws-sdk-ruby-record

  34. DynamoDB

  35. Used in IAM Execution Role DynamoDB

  36. None
  37. Patterns…

  38. None
  39. Patterns • Easy/Lazy Development & Test • Table Migrations •

    SimpleTable On Demand Defaults
  40. Using Ruby with AWS Lambda & SAM https://github.com/757rb/hello-757rb-lambda

  41. Rails & Lambda

  42. Product Site http://rubyonjets.com

  43. Ruby on Jets

  44. Ruby on Jets

  45. None
  46. None
  47. None
  48. None
  49. None
  50. None
  51. None
  52. None
  53. None
  54. None
  55. Little Gotcha List • Docker Shared Volume Perf • Logging

    & RAILS_LOG_TO_STDOUT • Keeping Package Size Down. • Invoke URL & Custom Domains
  56. None
  57. Coming Soon • Quality Rack Integration. Session, Cookies, & More.

    • Deploy asset:precompile to S3. • Encrypted Session Secret via AWS System Manager Param Store. • Better Gemfile dev/test groups.
  58. None
  59. Lambda Layers

  60. --help

  61. None
  62. RailsConf 2019

  63. https://dctechslack.herokuapp.com https://slackin757dev.herokuapp.com DCTech || 757Dev

  64. None