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.
-
Copy and put these files in empty directory (first commit)
-
execute init.sh (2nd commit).
rails new .
get executed inside and defalut Rails files are created. -
Download this file as handler from official aws-samples (3rd commit)
-
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)
-
(Optional) Use welcome page on production. (5th commit)
-
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)