Created
November 23, 2021 17:35
-
-
Save rememberlenny/85072999c6c1ba8e209c1bf9cc59f489 to your computer and use it in GitHub Desktop.
How to render a ruby gem as a lambda layer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
How to render the layer from a gem | |
This code is copied from: https://dev.to/peterc/how-to-create-a-aws-lambda-layer-of-your-gemfile-ruby-gem-dependencies-1gfj | |
LAYER_NAME="my-ruby-layer" | |
mkdir $LAYER_NAME && cd $_ | |
bundle init | |
bundle add fast_jsonparser --skip-install | |
rm Gemfile.lock | |
docker run --rm -v $PWD:/var/layer \ | |
-w /var/layer \ | |
amazon/aws-sam-cli-build-image-ruby2.7 \ | |
bundle install --path=ruby | |
mv ruby/ruby ruby/gems | |
zip -r layer.zip ruby | |
aws lambda publish-layer-version \ | |
--layer-name $LAYER_NAME \ | |
--region eu-west-1 \ | |
--compatible-runtimes ruby2.7 \ | |
--zip-file fileb://layer.zip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment