AWS Certified Developer – Associate / Question #1045 of 557

Question #1045

A company is deploying a serverless application using AWS Lambda functions. The functions require a shared utility module that is regularly updated with enhancements and patches. The company aims to maintain the module's latest version across all functions with minimal operational overhead.

Which approach best satisfies these requirements?

A

Upload the utility module and Lambda code to an Amazon S3 bucket. Configure the Lambda functions to reference the module from the bucket.

B

Package the utility module into a Lambda layer. Associate the layer with all applicable Lambda functions.

C

Deploy the utility module to an Amazon Elastic File System (EFS) volume. Mount the EFS volume to each Lambda function's execution environment.

D

Develop a dedicated Lambda function to host the utility module. Modify existing functions to invoke the dedicated function when the module is needed.

Explanation

Answer B is correct because Lambda layers are designed to manage shared code and dependencies across multiple Lambda functions. When the utility module is packaged into a layer, updates to the module only require publishing a new layer version. Associating this layer with all applicable Lambda functions ensures they automatically use the latest version without modifying the function's code, reducing operational effort.

Option A (S3) requires updating each Lambda function's code to reference the new S3 object version, which increases overhead. Option C (EFS) introduces complexity due to VPC configuration and potential latency, as EFS is a network-mounted filesystem. Option D (dedicated Lambda function) adds unnecessary invocation overhead and complexity. Lambda layers provide the most efficient and scalable solution for shared, frequently updated code.

Answer

The correct answer is: B