Reputation: 34900
During my preparation to AWS certification I found the following question on various mock-exam resources (the description is slightly re-formulated in order not to violate legal rules):
We have a lambda function which uses some external libraries (which are not part of standard Lambda libraries). How to optimise the lambda compute time consumed?
In all these resources the answer marked as right is like this:
Install the external libraries in Lambda to be available to all Lambda functions.
I am finding it "a bit" confusing. I always thought that the only one proper way to use external libraries is to include them into the deployment package. Or am I missing some new feature? Please, enlighten me.
Upvotes: 3
Views: 2751
Reputation: 46859
You might be thinking of the new 'Lambda Layers' feature:
You can configure your Lambda function to pull in additional code and content in the form of layers. A layer is a ZIP archive that contains libraries, a custom runtime, or other dependencies. With layers, you can use libraries in your function without needing to include them in your deployment package.
Layers let you keep your deployment package small, which makes development easier. You can avoid errors that can occur when you install and package dependencies with your function code. For Node.js, Python, and Ruby functions, you can develop your function code in the Lambda console as long as you keep your deployment package under 3 MB.
https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html
Upvotes: 5