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

Building Serverless Applications in Ruby with AWS Lambda

Alex Wood
April 18, 2019

Building Serverless Applications in Ruby with AWS Lambda

An overview of the benefits of AWS Lambda, and a survey of open source tools that can help Ruby developers create serverless applications using AWS Lambda.

Alex Wood

April 18, 2019
Tweet

More Decks by Alex Wood

Other Decks in Programming

Transcript

  1. BUILDING SERVERLESS
    APPLICATIONS IN RUBY
    WITH AWS LAMBDA

    View Slide

  2. WHO AM I?
    ▸ Currently: Building Serverless
    Open Source Tooling at AWS
    ▸ Formerly: AWS SDK for Ruby Team
    ▸ Author of Ruby runtime for AWS
    Lambda
    ▸ Twitter: @alexwwood
    ▸ Please do tweet your comments
    and questions about this talk!

    View Slide

  3. AGENDA
    ▸ Overview of AWS Lambda & Ecosystem
    ▸ Review of Open Source Tools
    ▸ AWS SAM CLI
    ▸ AWS SDK for Ruby
    ▸ aws-record
    ▸ Demo
    ▸ Web and Event-Driven Application Hybrid

    View Slide

  4. AWS LAMBDA & ECOSYSTEM

    View Slide

  5. SERVERLESS IS DEAD.
    Chris Munns, AWS Principal Developer Advocate
    CAUSE OF DEATH: EXCESSIVE BUZZWORD USAGE

    View Slide

  6. WHAT SERVERLESS MEANS

    View Slide

  7. WHAT SERVERLESS MEANS
    No Servers to Provision or Manage

    View Slide

  8. WHAT SERVERLESS MEANS
    Scales With Usage

    View Slide

  9. WHAT SERVERLESS MEANS
    Pay For Value

    View Slide

  10. WHAT SERVERLESS MEANS
    Availability and Fault Tolerance Built In

    View Slide

  11. PRODUCTION APP DEVELOPMENT INVOLVES MANY THINGS
    ▸ Code & Tests
    ▸ User Authentication
    ▸ Monitoring
    ▸ Load Balancing
    ▸ Auto Scaling
    ▸ Handling Server/Container Failures
    ▸ Security Isolation
    ▸ Operating System Management

    View Slide

  12. PRODUCTION APP DEVELOPMENT INVOLVES MANY THINGS
    ▸ Code & Tests
    ▸ User Authentication
    ▸ Monitoring
    ▸ Load Balancing
    ▸ Auto Scaling
    ▸ Handling Server/Container Failures
    ▸ Security Isolation
    ▸ Operating System Management

    View Slide

  13. AWS LAMBDA HANDLES MANY THINGS
    ▸ Code & Tests
    ▸ User Authentication
    ▸ Monitoring
    ▸ Load Balancing
    ▸ Auto Scaling
    ▸ Handling Server/Container Failures
    ▸ Security Isolation
    ▸ Operating System Management
    AWS Lambda Handles These
    AWS Lambda Integrates
    With Solutions For These

    View Slide

  14. AWS LAMBDA WORKS FOR MANY THINGS
    ▸ Web Applications
    ▸ Backend Services
    ▸ Data Processing
    ▸ Chatbots
    ▸ Amazon Alexa
    ▸ IT Automation

    View Slide

  15. OPEN SOURCE TOOLS

    View Slide

  16. THIS IS ONE OF THE THINGS MY NEW TEAM OWNS
    AWS SAM CLI
    ▸ Generate, Build, and Deploy Serverless Applications
    ▸ Develop and Test AWS Lambda Functions Locally
    ▸ Local API Gateway w/ Hot Reloading
    ▸ https://github.com/awslabs/aws-sam-cli

    View Slide

  17. NOW IN VERSION 3!
    AWS SDK FOR RUBY
    ▸ Supports >= 174 AWS services.
    ▸ Built-in support for pagination, waiters for state changes.
    ▸ Helpful abstractions for Amazon S3, Amazon SQS, and more.
    ▸ Modularized with statically generated code for performance.
    ▸ Removes 'autoload' for thread safety.
    ▸ https://github.com/aws/aws-sdk-ruby

    View Slide

  18. WATCH THE "DAT401" SESSION FROM AWS RE:INVENT 2018, YOU WON'T REGRET IT
    AWS-RECORD GEM
    ▸ Data mapping abstraction library for Amazon DynamoDB.
    ▸ Similar patterns to ActiveRecord APIs.
    ▸ Full support for collection types (Lists, Maps, Sets).
    ▸ Declarative table configuration and migrations.
    ▸ https://github.com/aws/aws-sdk-ruby-record

    View Slide

  19. LIVE DEMO
    IF YOU JUST CAME FOR THE DOGS, THEN
    THIS IS WHAT YOU CAME FOR!

    View Slide

  20. THE IMPORTANT THING IS THAT IT HAS PUPPIES. EVERYTHING ELSE IS A BONUS!
    DOG RATING APP DESIGN
    ObjectCreated
    API Gateway Sinatra App
    Is it a dog?
    Write to Index if Dog
    DynamoDB Table
    Upload via Presigned Post
    ‣ Show Dogs
    ‣ Upload Dog
    ‣ Rate Dog

    View Slide

  21. THE IMPORTANT THING IS THAT IT HAS PUPPIES. EVERYTHING ELSE IS A BONUS!
    WEB APPLICATION COMPONENTS
    API Gateway Sinatra App DynamoDB Table
    Upload via Presigned Post
    ‣ Show Dogs
    ‣ Upload Dog
    ‣ Rate Dog

    View Slide

  22. THE IMPORTANT THING IS THAT IT HAS PUPPIES. EVERYTHING ELSE IS A BONUS!
    EVENT-DRIVEN COMPONENTS
    ObjectCreated
    Is it a dog?
    Write to Index if Dog
    DynamoDB Table

    View Slide

  23. THE IMPORTANT THING IS THAT IT HAS PUPPIES. EVERYTHING ELSE IS A BONUS!
    EVENT-DRIVEN COMPONENTS
    ObjectDeleted
    DynamoDB Table
    Delete Item from Table

    View Slide

  24. CAN YOU JUST SHOW ME THE
    DEMO, PLEASE?
    - Somebody (Probably)

    View Slide

  25. CONCLUSION

    View Slide

  26. SERVERLESS BENEFITS
    ▸ AWS Lambda handles many elasticity, scalability, high-
    availability, security and fault-tolerance problems for you.
    ▸ Focus more on code, ship faster.

    View Slide

  27. 4 OUT OF 5 DENTISTS RECOMMEND CHECKING THESE TALKS OUT
    RELATED TALKS
    ▸ ATX Serverless Days 2019 - Serverless is Dead
    ▸ AWS re:Invent 2018 ARC306 - Serverless Architectural
    Patterns
    ▸ AWS re:Invent 2018 SRV305 - Inside AWS: Technology
    Choices for Modern Applications
    ▸ AWS re:Invent 2018 DAT401 - Advanced Design Patterns
    for Amazon DynamoDB

    View Slide

  28. THANK YOU!
    ▸ Find our work on GitHub:
    ▸ https://github.com/aws/aws-sdk-ruby
    ▸ https://github.com/aws/aws-sdk-ruby-record
    ▸ https://github.com/awslabs/aws-sam-cli
    ▸ Find me on the internets:
    ▸ Twitter: @alexwwood
    ▸ Web: https://alexwood.codes

    View Slide