Skip to content
A Serverless Framework example using an AWS lambda which runs a Ruby function
Ruby Other
  1. Ruby 99.6%
  2. Other 0.4%
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ruby
README.md
fetch-ruby.sh
handler.js
index.rb
package.json
serverless.yml

README.md

Serverless Ruby!

A Serverless Framework example using an AWS lambda which runs a Ruby function. Inspired by serverless-php.

This project demonstrates a few cool technlogies. Foremost is the amazing AWS Lambda. It's pretty exciting to see serverless architectures gaining adoption! Adding to the fun we have serverless, a framework for packaging and deploying across different providers including AWS, Google, and IBM. Also worth mentioning is the inclusion of Ruby. AWS Lambda supports a number of different languages natively, but Ruby is not one of them. Therefore we specially bundle the Ruby interpreter (courtesy of Traveling Ruby) and wrap it in a Node.js script which executes it as a binary.

Prerequsites

  1. npm install -g serverless
  2. Create a new user serverless in AWS Console, download the credentials.csv file and setup provider: https://www.youtube.com/watch?v=HSd9uYj2LJA

Install

serverless install --url https://github.com/stewartlord/serverless-ruby

Deploy Function

$ serverless deploy
Serverless: Packaging service...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service .zip file to S3 (7.21 MB)...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
..............
Serverless: Stack update finished...
Service Information
service: serverless-ruby
stage: dev
region: us-east-1
api keys:
  None
endpoints:
  GET - https://xxxxxxxxxx.execute-api.us-east-1.amazonaws.com/dev/hello
functions:
  hello: serverless-ruby-dev-hello

Try It Out!

{
    "status": 200,
    "body": "\"Hello from Ruby\""
}
--------------------------------------------------------------------
START RequestId: e9f2de65-31bc-11e7-a576-c18c442d05f7 Version: $LATEST
END RequestId: e9f2de65-31bc-11e7-a576-c18c442d05f7
REPORT RequestId: e9f2de65-31bc-11e7-a576-c18c442d05f7	Duration: 126.52 ms	Billed Duration: 200 ms 	Memory Size: 1024 MB	Max Memory Used: 23 MB
You can’t perform that action at this time.