Dealing with Size Limits in AWS Lambda
Size Limits in Zip Based Lambda Functions
You need to be aware of multiple size limits for Lambda zip based functions:
50 MB for compressed deployment package of a function,
250 MB after a function is unzipped,
75 GB for all Lambda functions that have been deployed in a region,
10 MB when you are uploading a function through Console UI
Some Possible Solutions
The possible workarounds are:
Reduce the function package size,
Use container image or layers based functions,
Use some other AWS product like ECS,
Store large libraries and files in a S3 bucket and download them during runtime.
Reducing function package size
AWS SDK libraries are already in place, upload only your own code and third party libraries.
Carefully selecting which libraries to include and excluding unnecessary dependencies.
Package Lambda functions individually using the Individually: true flag.
Use serverless-webpack to reduce the package size.
Store large binaries or files in the package in S3 and download them during runtime.
If you're using Python libraries, you can get rid of botocore, boto3 as they are already present in AWS's lambdas functions.
Keep in Mind
Lambda function has a maximum runtime of 15 minutes; downloading large files will take time away the time from your functions runtime.
You can configure ephemeral storage (/tmp) between 512 MB and 10 GB.