Q21 — AWS DVA-C02 Ch.3

Question 21 of 100 | ← Chapter 3

A developer is designing a serverless application with two AWS Lambda functions to process images. One Lambda function stores objects in an Amazon S3 bucket and writes associated metadata to an Amazon DynamoDB table. The other Lambda function retrieves objects from the S3 bucket using metadata stored in the DynamoDB table. Both Lambda functions use the same Python libraries to perform complex computations and are approaching the maximum compressed deployment package size limit.

Correct Answer: B. Create a Lambda layer containing the required Python libraries. Use the Lambda layer in both Lambda functions.

Explanation

Option B is correct. When multiple Lambda functions share common dependencies and approach the deployment package size limit, using a Lambda layer allows extraction and reuse of shared libraries across functions. This reduces individual deployment package sizes without duplicating code, minimizing operational overhead. Option A increases deployment complexity and maintenance burden. Option C violates separation of concerns, harms scalability and maintainability, and may exceed timeout or memory limits. Option D introduces runtime latency, dependency on network calls, and potential failure points during cold starts. Therefore, option B is optimal.