Coder Social home page Coder Social logo

rails-lambda-spike's Introduction

Rails and AWS Lambda Spike

This git repository demonstrates a spike into running a simple Ruby on Rails application on AWS Lambda

AWS SAM is used to package and deploy the application. It is scripted in package-and-deploy.sh and uses template.yml as the CloudFormation template.

The application is deployed in the following arrangement: Component Architecture

API Gateway receives in coming requests and routes them to the RailsLambda Function.

RailsLambda uses lambda.rb to start the Rails application and handle events passed from the API Gateway. The #handle method translates the AWS Lambda event messages into the format required by Rack. It is based on the lambda.rb example from the sinatra demo, but some additional changes have been made to make Rails happy.

The Rails application communicates with a RDS Postgres database. This requires that the Lambda is deployed into the same VPC, and subnets, as the database. The Lambda also needs an IAM role that has permission to execute inside a VPC. All of this is configured using the CloudFormation template.

A second lambda function is also configured that can be used to run database schema migrations. When invoked the lambda function will run the db:create and db:migrate rake tasks. This behaviour is defined in lambda.rb with the #migration_handler method.

rails-lambda-spike's People

Stargazers

Paul Dougan avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.