DEV Community

Cover image for Full Stack Serverless with Rails & AWS SAM/Lambda
Ken Collins for AWS Heroes

Posted on

Full Stack Serverless with Rails & AWS SAM/Lambda

Today I am excited to announce three major updates to Lamby, Custom Ink's open source tools for using Ruby on Rails with AWS Lambda via SAM.

ActiveRecord with RDS Proxy using MySQL

  • Dockerized CDK stacks for creating your first RDS DB Instance & Proxy.
  • A precompiled Mysql2 gem with statically linked libmysqlclient for Amazon Linux 1 & 2.
  • Using SSM Parameter Store for secure DATBASE_URL environment variables.
  • Integrated MySQL local development using Docker Compose.

Event-Driven ActiveJob with SQS

  • Uses the Shoryuken gem to send ActiveJobs to SQS queues.
  • Creates all resources & policies in CloudFormation/SAM.
  • Leverages SAM's Makefile builds to copy Rails applications to a standalone Lambda responding to SQS events.
  • Guides on concurrency, FIFO queues, using Lambda's EventInvokeConfig and Destinations features for success/error handling.

CloudWatch Logs, Metrics, & Observability

  • Project uses lograge gem's JSON formatter. Easily parsed by CloudWatch Logs Insights.
  • New Ruby gem for CloudWatch Embedded Metrics.
  • Introduction to using both in CloudWatch Dashboards.

Existing Lamby Features

  • Dockerized SAM Cookiecutter getting started project. From development to 1st deploy in 5 minutes.
  • Base project is Rails v6 with on Ruby 2.7 with Node 12 and Webpacker.
  • Starts on API Gateway HTTP API but can be used with REST API or Application Load Balancers.
  • Guides include how to setup Custom Domain Names.
  • Usage of SSM Parameter Store for RAILS_MASTER_KEY with an integrated bootstrap process for multiple engineers to edit encrypted credentials.
  • Rails setup to serve static CSS/JS assets but easily configured to use S3 asset hosts with CloudFront.
  • Database options & guides include DynamoDB with Aws::Record and or Aurora Serverless with the new activerecord-aurora-serverless-adapter gem for MySQL.

Top comments (0)