How to deploy AWS Lambda with large dependencies?
Short answer
D Package the application code and dependencies into a container image. Push the image to an Amazon Elastic Container Registry (Amazon ECR) repository. Deploy the image to the Lambda function.
Question
Key Takeaways
This question tests your understanding of AWS Lambda deployment package size limits versus container image limits, with the common trap being assuming that storing a .zip file in S3 bypasses the 250 MB unzipped size restriction.
For AWS Lambda functions requiring dependencies exceeding the standard 250 MB unzipped limit, container images are the necessary deployment method. The community consensus confirms that packaging code and large dependencies into a container image stored in Amazon ECR is the only viable solution for a 500 MB dependency.
Common mistake: Many candidates incorrectly choose Option B, believing that uploading a .zip file to Amazon S3 bypasses Lambda's storage limits; however, Lambda functions cannot use deployment packages (zipped or unzipped) that exceed the 250 MB limit.
Expert Analysis
Why the Answer Is Correct
Option D is correct because AWS Lambda supports container images up to 10 GB, which easily accommodates the 500 MB dependency. Unlike .zip deployment packages, container images allow for much larger dependencies and libraries. The workflow involves building the image, pushing it to Amazon ECR, and then deploying the Lambda function from that repository.
Why the Other Options Are Wrong
Options A and B are incorrect because Lambda deployment packages (.zip files) have a hard limit of 250 MB for the unzipped size (and 50 MB for the zipped size). A 500 MB dependency violates these limits regardless of whether it is uploaded directly or via S3. Option C is incorrect because Lambda functions cannot be configured to run container images directly from an Amazon S3 bucket; they must pull images from Amazon Elastic Container Registry (ECR).
Community Comment Notes
Comment [1] highlights confusion regarding code size versus dependency size but correctly identifies D as the universally correct answer. Comment [2] suggests a runtime download strategy, which is a valid workaround for static assets but is not a deployment option listed in the question choices. Comment [3] reaffirms that D is the definitive answer.
Official Reference
- https://docs.aws.amazon.com/lambda/latest/dg/configuration-deployment-package.html
- https://docs.aws.amazon.com/lambda/latest/dg/images-create.html
These links open the official vendor documentation in a new tab.
Exam Strategy
Always memorize the critical Lambda size limits: 250 MB for unzipped .zip deployment packages and 10 GB for container images. If a question mentions dependencies or assets larger than 250 MB, immediately eliminate any .zip-based options.
Community Votes
60% of anonymous learners picked answer D. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 3 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 3
-
preachr 👍 1 Answered BIf the dependency file is too large for a Lambda layer (i.e., greater than 250 MB when compressed), store the file in an Amazon S3 bucket. In your Lambda function code, you can download the dependency file from S3 at runtime using the AWS SDK. This would ensure that the function has access to the file without exceeding Lambda's storage limits.
-
tullio85 👍 1 Answered BI think the question should have been more specific about the size of the code. The solution D is always correct. The solutiuon B is correct if the uncompressed size is less than 512MB. In the question was not specified the size of the code. In my experience is rarely to have a micoreservice code size more 12MB.
-
YUICH 👍 3 Answered Dthe answer is D
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All DVA-C02 Questions
Access 100 questions with complete answers and detailed explanations.
View Full DVA-C02 Practice Test →