jets icon indicating copy to clipboard operation
jets copied to clipboard

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

Open tlhampton13 opened this issue 3 years ago • 3 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

tlhampton13 avatar Oct 26 '21 15:10 tlhampton13

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.

tongueroo avatar Oct 26 '21 16:10 tongueroo

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

tlhampton13 avatar Oct 26 '21 19:10 tlhampton13

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.

tongueroo avatar Oct 26 '21 19:10 tongueroo

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

tongueroo avatar Dec 05 '23 21:12 tongueroo