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
已提问 6 个月前241 查看次数
1 回答
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
已回答 6 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则