Serverless Ruby Layer

A Serverless Plugin to auto deploy gems to AWS Layer using Gemfile



Serverless Ruby Layer

serverless npm Build Status Coverage Status MIT License

A Serverless Plugin to bundle ruby gems from Gemfile and deploy it to the lambda layer automatically while running serverless deploy.

It auto-configures the AWS lambda layer and RUBY_PATH to all the functions.


Install ⚡️ serverless. Refer here for serverless installation instructions.

Navigate to your serverless project and install the plugin

sls plugin install -n serverless-ruby-layer

This will add the plugin to package.json and the plugins section of serverless.yml.


Check out the documentation here for,

Getting Started

Simple Usage


service: basic

  - serverless-ruby-layer

  name: aws
  runtime: ruby2.5

    handler: handler.hello


  source ''
  gem 'httparty'

Running sls deploy automatically deploys the required gems as in Gemfile to AWS lambda layer and make the gems available to the RUBY_PATH of the functions hello.handler

Refer example amd docs for more details


The plugin operation can be customized by specifying the custom configuration under rubyLayer.

For example, to use docker environment for packing gem, the below configuration is added to serverless.yml

    use_docker: true

For more details, refer the docs here


Using the custom configuration, the plugin can be utilized for below cases,

  • Using locallly installed bundler for gems which native extensions - Example - Docs
  • Using Docker for gems with OS native C extensions or system libraries like http, Nokogiri - Example - Docs
  • Preinstall OS packages (yum packages) for gems which requires OS native system libraries like pg, mysql, RMagick - Example - Docs
  • Using Dockerfile for gems which with other OS Linux image or system libraries and utilities - Example - Docs
  • Include / Exclude specific functions from layer configuration - Include Example , Exclude Example - Docs


Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update the tests as appropriate.

Refer Guidelines for more information.



view on Github

Latest commit b2f54ec on Sep 24, 2017

New to serverless?

To get started, pop open your terminal & run:

npm install serverless -g