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

Learn to Program The Cloud with Ruby & AWS Lambda

Learn to Program The Cloud with Ruby & AWS Lambda

A curated set of resources and guides on how to use Ruby & Rails as your entry point to learning native AWS cloud architectures. Presented to DC Ruby User Group. https://www.meetup.com/dcruby/events/wzqbvpybcjbxb/

Ken Collins

June 18, 2020
Tweet

More Decks by Ken Collins

Other Decks in Technology

Transcript

  1. Learn to Program
    The Cloud
    with Ruby & AWS Lambda

    View Slide

  2. Ken Collins @MetaSkills Principal Engineer @CustomInkTech

    View Slide

  3. Programming
    The Cloud

    View Slide

  4. View Slide

  5. Getting Started
    AWS, SAM, & Lambda
    https://aws.amazon.com/serverless/sam/

    View Slide

  6. https://dev.to/aws-heroes/aws-lambda-microservice-
    workshop-using-s3-libvips-ruby-4o96
    Start Small. Ruby S3/Image Microservice.

    View Slide

  7. https://lamby.custominktech.com/docs/quick_start
    And Grow. Rails & JavaScript Starter Application.
    Deploy in 5 min.

    View Slide

  8. https://lamby.custominktech.com/docs/quick_start
    And Grow. Rails & JavaScript Starter Application.

    View Slide

  9. https://lamby.custominktech.com/docs/quick_start
    And Grow. Rails & JavaScript Starter Application.

    View Slide

  10. Unconscious Bias? or
    Knowledge Gaps?
    (open discussion)

    View Slide

  11. Rails & Lambda
    (from the inside out)

    View Slide

  12. How Does
    Lamby Work?

    View Slide

  13. How Does
    Lamby Work?
    Hash Convert

    View Slide

  14. How Does
    Lamby Work?
    app.rb
    Everything else is
    just basically Rails

    View Slide

  15. How Does
    Lamby Work?
    3 Seconds (cold start)
    Milliseconds

    View Slide

  16. • Think of app.rb as config.ru
    for API Gateway.
    • Rails is in good company!
    Express, Flask, etc all do the
    same thing.
    • Think of Lambda as a
    cheaper PAYGO on Heroku.
    Rails & Lambda (inside out)

    View Slide

  17. Scaling compute
    is not your
    problem anymore.

    View Slide

  18. The Serverless
    Application Model
    https://aws.amazon.com/serverless/sam/

    View Slide

  19. Core SAM CLI Commands. More on the ./bin directory later.

    View Slide

  20. Infrastructure as Code (IaC) . I hope you like YAML!

    View Slide

  21. SAM is Syntactic Sugar for CloudFormation. Meta & DRY!

    View Slide

  22. AWS::Serverless::Function

    View Slide

  23. • AWS Resource Specification Language.
    • CLI Interface to Develop & Deploy Apps.
    • Lamby Uses Cutters Templates.
    • Super fast Squirrel on GitHub. Keep Up!
    • Bookmark These Resources…
    Serverless Application Model

    View Slide

  24. AWS Serverless Application Model (AWS SAM) Specification
    https://github.com/awslabs/serverless-application-model
    https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification.html
    Intrinsic Function Reference
    https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html
    AWS Resource and Property Types Reference
    https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html
    AWS SAM CLI GitHub Release Notes
    https://github.com/awslabs/aws-sam-cli/releases

    View Slide

  25. Docker Conventions


    View Slide

  26. https://github.blog/2015-06-30-scripts-to-rule-them-all/
    Normalized Script Convention

    View Slide

  27. Docker & Docker Compose Bin Scripts.

    View Slide

  28. Docker Compose. Avoids Repeated ENV & Volume Configs

    View Slide

  29. Docker. Rails, SAM, JavaScript, Etc on Lambda Dev.

    View Slide

  30. Script Conventions. Underscore for Container
    bin/_server
    bin/server

    View Slide

  31. • Node & Webpacker
    • Compiled & Served
    Assets
    • Dotenv Integration
    • Encrypted
    Credentials with SSM
    Parameter Store
    Dig In & Explore
    https://github.com/customink/lamby-cookiecutter
    • CloudWatch Logging
    & Lograge
    • API Gateway HTTP
    API v2 Default
    • Custom Domain
    Names, SSL, &
    CloudFront

    https://lamby.custominktech.com

    View Slide

  32. • Native MySQL & PostgreSQL using
    AWS RDS Proxy. Migrations?
    • Best Practices for Background Tasks
    & Event-Driven architecture using
    EventBridge, Asynchronous
    Invocations, and SNS/SQS. ActiveJob?
    Coming Soon…

    View Slide

  33. View Slide