How to deploy AWS Lambda with large dependencies?

A developer needs to deploy the code for a new application on an AWS Lambda function. The application needs a dependency file that is 500 MB to run the business logic. Which solution will meet these requirements?

  1. Compress the application code and dependencies into a .zip file. Directly upload the .zip file as a deployment package for the Lambda function instead of copying the code.
  2. Compress the application code and dependencies into a .zip file. Upload the .zip file to an Amazon S3 bucket. Configure the Lambda function to run the code from the .zip file in the S3 bucket.
  3. Package the application code and dependencies into a container image. Upload the image to an Amazon S3 bucket. Configure the Lambda function to run the code in the image.
  4. 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. Source Reference Answer

Community Votes

D
60%
B
40%

60% 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 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.

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.

Community Discussion (3 comments)

tullio85 👍 1 Selected: B
I 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.
preachr 👍 1 Selected: B
If 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.
YUICH 👍 3 Selected: D
the answer is D

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

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

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.

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