AWS Certified Developer – Associate (DVA-C02) — Question 455
A developer created reusable code that several AWS Lambda functions need to use. The developer bundled the code into a zip archive. The developer needs to deploy the code to AWS and update the Lambda functions to use the code.
Which solution will meet this requirement in the MOST operationally efficient way?
Answer options
- A. Upload the zip archive to Amazon S3. Configure an import path on the Lambda functions to point to the zip archive.
- B. Create a new Lambda function that contains and runs the shared code. Update the existing Lambda functions to invoke the new Lambda function synchronously.
- C. Create a Lambda layer that contains the zip archive. Attach the Lambda layer to the Lambda functions.
- D. Create a Lambda container image that includes the shared code. Use the container image as a Lambda base image for all the functions.
Correct answer: C
Explanation
AWS Lambda layers are specifically designed to share common code, libraries, or dependencies across multiple functions, making Option C the most operationally efficient solution. Option A is incorrect because Lambda does not support directly importing code from an arbitrary S3 zip archive path at runtime. Option B introduces unnecessary network overhead, latency, and invocation costs, while Option D adds the overhead of managing container image builds and deployments for simple code sharing.