Skip to content

umihico/serverless-rails-demo

Repository files navigation

How to Rails on AWS Lambda

Instead of cloning this repository, this instruction explains step by step how you can configure and deploy Ruby on Rails on AWS Lambda from scratch.

  1. Copy and put these files in empty directory (first commit)

  2. execute init.sh (2nd commit). rails new . get executed inside and defalut Rails files are created.

  3. Download this file as handler from official aws-samples (3rd commit)

  4. Modify files to adapt Lambda environment. (4th commit)

    • Modify config.ru file location
    • Modify to adapt HTTP API event (original example uses REST API)
    • Use STDOUT for logging, because writing files is not allowed. (except /tmp)
    • Gitignore directory that Serverless Framework generates
    • Record events on cloudwatch. (optional)
  5. (Optional) Use welcome page on production. (5th commit)

  6. Deploy and visit generated URL! execute SECRET_KEY_BASE=$(cat tmp/development_secret.txt) sls deploy (reusing dev secret in this way is lazy and not recommended)

About

Ruby on Rails hosted on AWS Lambda with smallest modification

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published