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달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠