gpt4 book ai didi

amazon-web-services - AWS lambda 和外部库

转载 作者:行者123 更新时间:2023-12-04 08:05:01 24 4
gpt4 key购买 nike

在我准备 AWS 认证的过程中,我在各种模拟考试资源上发现了以下问题(为了不违反法律规定,对描述进行了轻微的重新表述):

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?

在所有这些资源中,标记为正确的答案是这样的:

Install the external libraries in Lambda to be available to all Lambda functions.

我发现它“有点”令人困惑。我一直认为使用外部库的唯一正确方法是将它们包含到部署包中。还是我错过了一些新功能?请赐教。

最佳答案

您可能会想到新的“Lambda 层”功能:

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

关于amazon-web-services - AWS lambda 和外部库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55816492/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com