Skip to content

A Serverless Framework example using an AWS lambda which runs a Ruby function

Notifications You must be signed in to change notification settings

stewartlord/serverless-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A Serverless Framework example using an AWS lambda which runs a Ruby function

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages