Two Lambda functions use the same large Python library, and both deployment packages are approaching the zipped size limit. To reduce package size with the least operational overhead, what should the developer do?
Choose an answer
Tap an option to check your answer.
Correct answer: Create a Lambda layer containing the Python library and attach that layer to both functions..
Why this is the answer
Creating a Lambda layer for the shared Python library is the most efficient solution. Lambda layers allow you to centralize common code and dependencies, reducing the size of individual deployment packages and promoting code reuse. This approach has minimal operational overhead because you manage the library once in the layer, and both functions automatically inherit it. Packaging each library in its own .zip file and deploying copies defeats the purpose of reducing package size and increases redundancy. Merging the two functions into one might exceed memory or execution time limits, and it couples unrelated logic. Uploading the library to S3 and referencing it at runtime is not a standard or performant way to include dependencies for Lambda functions; dependencies should be part of the deployment package or a layer.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed