What should the developer do to reduce the size of the Lambda deployment packages with the LEAST operational overhead?
Package each Python library in its own .zip file archive. Deploy each Lambda function with its own copy of the library.
Create a Lambda layer with the required Python library. Use the Lambda layer in both Lambda functions.
Combine the two Lambda functions into one Lambda function. Deploy the Lambda function as a single .zip file archive.
Download the Python library to an S3 bucket. Program the Lambda functions to reference the object URLs.
Explanations:
Packaging each Python library in its own .zip file and deploying them separately would not reduce the overall size of the deployment packages. Each Lambda function would still need to include the same library code, resulting in duplicate code and increased total size. This approach also adds complexity to deployment management.
Creating a Lambda layer with the required Python library allows both Lambda functions to share the same library code without including it in each deployment package. This reduces the size of the individual Lambda function packages and minimizes operational overhead since Lambda layers are managed separately and can be updated independently.
Combining the two Lambda functions into one would not effectively reduce the size of the deployment package since the same library would still need to be included in the single package. Additionally, this would complicate the architecture and limit the functions’ scalability and maintainability.
Downloading the Python library to an S3 bucket and referencing it from the Lambda functions introduces unnecessary complexity and operational overhead. It would require additional code to handle downloading and managing the library during runtime, which can lead to increased latency and possible failure if the library cannot be retrieved.