我正在将 AWS SAM 与 Python 结合使用。我的目标是拥有两个 Lambda:
还有一些其他 SO 问题可以处理这种情况,但据我所知,没有人涉及在本地部署 SAM 时如何做到这一点。
这是我的 SAM 模板文件:
# template.yaml
Resources:
FunctionA:
# PUT /functions/a, should invoke FunctionB asynchronously
Type: AWS::Serverless::Function
Properties:
CodeUri: api/
Handler: functions.a
Runtime: python3.7
Events:
FunctionA:
Type: Api
Properties:
Path: /functions/a
Method: put
FunctionB:
# Long-running asynchronous function
Type: AWS::Serverless::Function
Properties:
FunctionName: 'FunctionB'
CodeUri: api/
Handler: functions.b
Runtime: python3.7
EventInvokeConfig:
MaximumRetryAttempts: 2
DestinationConfig:
OnSuccess:
Type: SQS
OnFailure:
Type: SQS
Run Code Online (Sandbox Code Playgroud)
我的 Python lambda …