部署多个 AWS Lambda 函数
Deploying multiple AWS Lambda functions
如果我有多个 AWS Lambda 函数,是否可以在单个 YML 文件中为所有三个函数指定部署配置,或者我是否需要为每个 Lambda 函数编写特定的 YML 文件?
是的 - 您可以在同一个无服务器框架服务定义中拥有多个函数。
例如(您可以在 documentation 中查看更多信息):
service: myService
provider:
name: aws
runtime: nodejs6.10
functions:
functionOne:
handler: handler.functionOne
description: optional description for your Lambda
events: # All events associated with this function
- http:
path: users/create
method: post
functionTwo:
handler: handler.functionTwo
events:
- s3: photos
functionThree:
handler: handler.functionThree
memorySize: 512 # function specific
如果我有多个 AWS Lambda 函数,是否可以在单个 YML 文件中为所有三个函数指定部署配置,或者我是否需要为每个 Lambda 函数编写特定的 YML 文件?
是的 - 您可以在同一个无服务器框架服务定义中拥有多个函数。
例如(您可以在 documentation 中查看更多信息):
service: myService
provider:
name: aws
runtime: nodejs6.10
functions:
functionOne:
handler: handler.functionOne
description: optional description for your Lambda
events: # All events associated with this function
- http:
path: users/create
method: post
functionTwo:
handler: handler.functionTwo
events:
- s3: photos
functionThree:
handler: handler.functionThree
memorySize: 512 # function specific