How to use a 15 GB ML library across multiple AWS Lambda functions?

A developer needs to implement a custom machine learning (ML) library in an application. The size of the library is 15 GB. The size of the library is increasing. The application uses AWS Lambda functions. All the Lambda functions must have access to the library. Which solution will meet these requirements?

  1. Save the library in Lambda layers. Attach the layers to all Lambda functions.
  2. Save the library in Amazon S3. Download the library from Amazon S3 inside the Lambda function.
  3. Save the library as a Lambda container image. Redeploy the Lambda functions with the new image.
  4. Save the library in an Amazon Elastic File System (Amazon EFS) file system. Mount the EFS file system in all the Lambda functions. Source Reference Answer

Community Votes

D
75%
A
25%

75% of anonymous learners picked answer D. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

This question tests your knowledge of AWS Lambda size limitations (250 MB unzipped) and the correct workaround—Amazon EFS—for sharing large, growing dependencies like ML libraries across multiple functions.

When an ML library exceeds the 250 MB unzipped limit for Lambda layers and deployment packages, Amazon EFS must be used to mount the shared library across all Lambda functions. The community overwhelmingly agrees on EFS as the only viable solution for large, growing code packages.

Many candidates choose Lambda Layers (Option A), mistakenly believing layers can accommodate any size or misreading the 250 MB unzipped limit as 250 GB. Some also confuse the total layer count limit with the size limit.

Community Discussion (9 comments)

nder 👍 12 Selected: D
Quick google will tell you the max size of a lambda layer is 250mb.
preachr 👍 1 Selected: D
https://aws.amazon.com/blogs/compute/using-amazon-efs-for-aws-lambda-in-your-serverless-applications/ Sharing large code packages with Lambda EFS is useful for sharing software packages or binaries that are otherwise too large for Lambda layers. You can copy these to EFS and have Lambda use these packages as if there are installed in the Lambda deployment package.
65703c1 👍 1 Selected: D
D is the correct answer.
DeaconStJohn 👍 3 Selected: D
I've been going back and forward on this one for a few days. I have settled for EFS primarily based off a blog I read from an AWS community builder who specializes in lambda. https://betterdev.blog/serverless-ml-on-aws-lambda/#overcoming_lambda_size_limitations:~:text=the%20DynamoDB%20table.-,Overcoming%20Lambda%20size%20limitations,-If%20we%20package 250mb limit per lambda, although the layers capacity is 75gb this covers your whole environment and breaches the single lambda limit. The blog uses a container solution, the limit here is 10GB which is still to small for our use case. EFS fits this use case even though it is a tad more troublesome to implement. Granted the blog is 2 years old, I'm hoping not much has changed since.
SerialiDr 👍 3 Selected: D
D. Save the library in an Amazon Elastic File System (Amazon EFS) file system. Mount the EFS file system in all the Lambda functions. This approach allows Lambda functions to access large libraries or datasets that exceed the size limits of Lambda's deployment package. By using Amazon EFS, a fully managed elastic file storage, the library can be stored once and mounted onto multiple Lambda functions simultaneously. This eliminates the need to package the library with each Lambda function, which would not be feasible given the size constraints of Lambda layers and deployment packages. Additionally, this method requires minimal code changes, focusing only on configuring the Lambda functions to mount the EFS file system, providing a scalable and efficient solution for making large libraries available to serverless applications.
Abdullah22 👍 2 Selected: D
just the layer limitation 250 mb .
KarBiswa 👍 4 Selected: A
Upto 75 GB can be accommodated. https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html
ANDRES715 👍 4 Selected: A
La solución recomendada para este caso es guardar la biblioteca en capas Lambda y adjuntar esas capas a todas las funciones Lambda. Esto permitirá que todas las funciones Lambda tengan acceso a la biblioteca sin necesidad de duplicarla en cada función. Las capas Lambda son una forma de compartir código y bibliotecas comunes entre varias funciones Lambda. Puedes crear una capa Lambda que contenga la biblioteca de aprendizaje automático y luego adjuntar esa capa a todas las funciones Lambda que necesiten acceder a ella. Al utilizar capas Lambda, puedes reducir el tamaño de las funciones Lambda y simplificar su mantenimiento. Además, si el tamaño de la biblioteca está aumentando, puedes actualizar la capa Lambda sin tener que modificar y volver a implementar todas las funciones Lambda.
CrescentShared 👍 2 Selected: D
S3 takes too long.

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Understanding AWS Lambda Size Limitations

AWS Lambda imposes strict size constraints on deployment packages and layers. The unzipped deployment package (including all layers) cannot exceed 250 MB. The zipped deployment package is limited to 50 MB per function. These limits are hard boundaries and cannot be increased via service quotas.

Why Amazon EFS Is the Correct Answer

Amazon Elastic File System (Amazon EFS) provides a fully managed, elastic NFS file system that can be mounted directly into Lambda functions. This integration was introduced specifically to address scenarios where libraries, datasets, or binaries are too large for Lambda's native packaging options. By storing the 15 GB ML library on EFS and mounting it to all Lambda functions, the developer achieves:

  • No size constraints tied to Lambda's deployment package limits
  • Shared access across all functions without duplication
  • Scalability as the library continues to grow
  • Faster cold starts compared to downloading large files from S3 at runtime

Why the Other Options Fail

  • Option A (Lambda Layers): Incorrect. Lambda layers have a combined unzipped size limit of 250 MB along with the deployment package. A 15 GB library vastly exceeds this limit. Community members who voted for A likely confused the total number of layers allowed (up to 75) with the size limit.
  • Option B (Amazon S3): Incorrect. While technically possible to download the library from S3 during function initialization, this approach introduces unacceptable latency for a 15 GB download on every cold start. It also consumes ephemeral storage (/tmp is limited to 10 GB by default, expandable to 10 GB max, still insufficient for 15 GB).
  • Option C (Lambda Container Image): Incorrect. Container images for Lambda are limited to 10 GB in size. A 15 GB library exceeds this limit. Additionally, redeploying all functions with a new image every time the library grows is operationally burdensome.

Community Consensus

The community strongly agrees (75% vs 25%) that Option D is correct. Multiple commenters cite the 250 MB layer limit and reference AWS blog posts confirming EFS as the recommended pattern for large ML libraries in serverless applications.

Official Reference

Exam Strategy

When you see a Lambda question involving large dependencies (ML models, large binaries, datasets), immediately check if the size exceeds 250 MB. If it does, Amazon EFS is almost always the answer. Eliminate Lambda Layers and container images based on their respective size limits (250 MB and 10 GB).

Related Analysis

Practice All DVA-C02 Questions

Access 100 questions with complete answers and detailed explanations.

View Full DVA-C02 Practice Test →

← Back to DVA-C02 Study Guide