rubyonjets / jets

Ruby on Jets

Home Page:http://rubyonjets.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deploy application code to a Lambda layer instead of to the Function

tlhampton13 opened this issue · comments

Summary

Deploy application code as a layer instead of directly to the lambdas. Each lambda is currently deployed with a separate copy of the entire application code. Creating a code-layer will significantly reduce the amount of Lambda Code Storage used by Jets. All that should need to be deployed to the lambdas is a proxy function to the code stored in the layer.

Motivation

We have hit the Lambda Code Storage limit multiple times. Deploying all application code to every lambda consumes a lot of Lambda Code Storage.

Guide-level explanation

Reference-level explanation

Drawbacks

Unresolved Questions

So Lambda Layers still count against the AWS Lambda code size limit. Currently 250MB. So don't believe moving the app code into a lambda layer will help.

See: https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html

This quota applies to all the files you upload, including layers and custom runtimes.

It's a bummer.

Also note, considered deploying each lambda function as unique functions. Took a stab at it years ago and figured it would mean having to calculate all the permutations of the code and uploading a different version to s3. It proved complicated. So unsure how to approach it or if it's worth the complexity.

Sorry for the confusion ... "Function and layer storage" is the limit this ticket is about .... which defaults to 75 GB.

Oh I see. So hitting into the aggregated 75GB limit from all the lambda functions across the entire AWS account. A shared Lambda layer would help in that case. Will consider PRs. No sweat either way.

Jets 5 handles this in another way. A single lambda function is deployed to handle all controller requests.

https://blog.boltops.com/2023/12/05/jets-5-improvements-galore/

Closing out