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 年前

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

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

回答问题的准则