Ruby on AWS Lambda
Why?
Because:
- AWS Lambda has immense potential and interesting implications
- AWS Lambda doesn't officially support Ruby, as yet
- Ruby has immense potential and interesting implications as well!
How?
By:
- packaging a Ruby binary with our app
- thank you, Traveling Ruby!
- Lambda executes a simple NodeJS program that shells out to our code
- see
index.js
- see
- Ruby executes your code
- yes, Bundler works! (within reason)
- Hello World is about 8MB, leaving you 42MB of room to get crazy
- (no native gems)
Usage
- Sign up for Amazon AWS
- Get access to Amazon S3
- Get access to Amazon Lambda
- Create an IAM account with access to S3 and Lambda
- Install the aws cli tools
- Set up an AWS profile in
~/.aws/credentials
for the account created above - Change the variables in
deploy.sh
to match your app and AWS settings - Ensure you're using ruby 2.1.x in this directory
- Ensure you're using Bundler version 1.9.9
- Add any gems you need to app/Gemfile
cd app
and runbundle install
from there (you need a Gemfile.lock)- edit
app/app.rb
with your application code - run
./deploy.sh linux-x86_64
- test your Lambda Function!
- i've been using the web console for testing