Which solution will meet these requirements with the LEAST operational overhead?
Create a Lambda layer to store the external library. Configure the Lambda function to use the layer.
Create an Amazon S3 bucket. Upload the external library into the S3 bucket. Mount the S3 bucket folder in the Lambda function. Import the library by using the proper folder in the mount point.
Load the external library to the Lambda function’s /tmp directory during deployment of the Lambda package. Import the library from the /tmp directory.
Create an Amazon Elastic File System (Amazon EFS) volume. Upload the external library to the EFS volume. Mount the EFS volume in the Lambda function. Import the library by using the proper folder in the mount point.
Explanations:
Using a Lambda layer allows the developer to package the external library separately, reducing the Lambda function’s deployment package size and providing easy version control with minimal operational overhead.
Mounting an S3 bucket directly in Lambda is not supported; Lambda functions cannot directly access S3 as a file system. Additionally, the library size would still count against the package limits if included in the function.
Loading the library into the /tmp directory does not effectively reduce the package size and is limited by the /tmp storage space, which is only 512 MB and not ideal for larger libraries.
While EFS can store larger libraries, it introduces additional complexity and operational overhead compared to using a Lambda layer, making it less efficient for this scenario.