Lambda: Failed to create layer version: Unzipped size must be smaller than 262144000 bytes

0

Please i need help creating a layer.

I have previously done this, only this time my zip file that contains all dependencies is about 600+ mb, and Lambda has a limit of 250mb.

What other options do i have, i am thinking docker but i don't know my way around that. But if there are other options i would love to hear thank you.

The project is running completely using python.

已提問 1 年前檢視次數 11854 次
1 個回答
1
已接受的答案

I'd check that all the dependencies included in the zip file are required and if not exclude what can be removed. Like you can remove node_modules in NodeJs or venv in Python.

The alternative solutions depend on the use case, for instance how often is your Lambda invoked? if it's invoked once per day or such, you can eventually load the dependencies from S3 on start. You can also mount an EFS network share to your lambda [2]

A container image is a good solution for this and you can create an image up to 10Gb. The documentation describes the steps to follow to get started [2].

[1] https://aws.amazon.com/blogs/compute/using-amazon-efs-for-aws-lambda-in-your-serverless-applications/ [2] https://docs.aws.amazon.com/lambda/latest/dg/images-create.html

profile pictureAWS
專家
已回答 1 年前
profile pictureAWS
專家
已審閱 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南