stevec
stevec

Reputation: 52738

How to install/use Ruby gems in an AWS Lambda function?

AWS Lambda has support for Ruby 2.5, and it's straightforward to run a simple Ruby script in this environment

However, suppose your script requires some gems, how do you install and use gems in AWS Lambda?

Upvotes: 5

Views: 6372

Answers (1)

bwest
bwest

Reputation: 9844

Install the gems into the project folder by using the --path flag when running bundle install. Then include the installed dependencies in your .zip.source bundle. There are docs on creating a Ruby bundle.

Another option would be to create a lambda layer, which can make your deploys faster (smaller zip file) and be used to organize your code.

Upvotes: 4

Related Questions