How can i Deploy my Express app on AWS LAmbda whose dependencies(node_modules) exceeds 1GB in size

0

I am trying to deploy my Nestjs(Express) app to Aws Lambda functions , I am getting an error

Resource handler returned message: "Unzipped size must be smaller than 262144000 bytes

I know that there is limit of 250Mb size for Lambda function . Here is my code detail .. My core code size is almost 14MB in size unzipped and it is except the dependencies (node_modules folder) , node_modules file size is 990 Mb, it may be go on increasing when we go on developing the app.

Can you suggest some workaround, or concept how i can manage the dependency outside of Lambda function and without impacting the app working.

I even tried Lambda layer , As i read, it is generally used to separate the dependencies from the main lambda function to make lambda function light , but this even doesn't seem to work for me as the 250MB size limitation is including lambda layers as well.

Please suggest me any other alternatives that I can use to implement my app to AWS Lambda.

Sagar
gefragt vor 6 Monaten241 Aufrufe
1 Antwort
0

If you cannot slim down the size of the application to fit within the limits for a zip based deployment. You could package the application code and node_modules into a container image. AWS Lambda supports container images up to 10GB in size. Details on how to do this with Node can be found here: https://docs.aws.amazon.com/lambda/latest/dg/nodejs-image.html

AWS
Steve
beantwortet vor 6 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen