Skip to content

unable to upload zip folder from s3 to aws lambda

0

i am trying to upload my python fastapi app to aws lambda via s3 but i am facing this issue but by zip size is 111.9 MB

aws lambda error in s3 my size is shown is less then 250 mb s3 bucket zip

asked 10 months ago164 views
2 Answers
1
Accepted Answer

The 111.9 MB in the screenshot is the size of the compressed zip file. As per the error message and also stated in the quota documentation (https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html#function-configuration-deployment-and-execution), the total size of the deployment package must not exceed 250 MB after being uncompressed ("unzipped"), or in other words, in the form it would take in the local file system of the Lambda function's runtime environment.

I suggest you unpack the zip file on your local system and check the total size of the files it contains.

EXPERT
answered 10 months ago
EXPERT
reviewed 10 months ago
0

The issue you're facing is related to the size limit for Lambda deployment packages. While AWS Lambda allows deployment packages up to 250 MB when uploaded through AWS CLI or SDKs, there's a smaller limit of 50 MB when uploading directly through the AWS Management Console.

In your case, even though your zip file in S3 is 111.9 MB, which is below the 250 MB limit, it's still above the 50 MB limit for direct uploads through the console. This explains the "RequestEntityTooLargeException" error you're seeing.

To resolve this issue, you have a few options:

  1. Use the AWS CLI or SDK to deploy your Lambda function instead of the console. This will allow you to use the full 250 MB limit.

  2. Optimize your deployment package to reduce its size. This could involve removing unnecessary dependencies or files.

  3. Consider using Lambda Layers to separate some of your dependencies from your main function code. This can help reduce the size of your main deployment package.

  4. If your package size cannot be reduced below 250 MB, you should consider using container images for your Lambda function. Lambda supports container images up to 10 GB in size, which would easily accommodate your current package.

Remember, when using S3 to store your deployment package, make sure the S3 bucket is in the same region as your Lambda function to avoid any potential issues.

If you continue to face issues or if your package size grows beyond these limits, you might want to explore using container images for your Lambda function, which allows for much larger deployments up to 10 GB.
Sources
Troubleshoot deployment issues in Lambda - AWS Lambda
Not able to use deepeval on Lambda | AWS re:Post
Lambda Package Exceeds 60MB: Solutions for Large Dependencies? | AWS re:Post

answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.