Nee*_*raj 8 aws-cloudformation aws-lambda
我正在尝试创建云层堆栈.堆栈已正确部署.已创建Lambda函数,但代码未作为内联函数添加到函数中.
它说
您的Lambda函数"lambda_function"无法内联编辑,因为处理程序中指定的文件名与部署包中的文件名不匹配.
云形成代码:
LambdaFunction:
Type: "AWS::Lambda::Function"
Properties:
Code:
ZipFile: !Sub |
import json
def lambda_handler(event,context):
#Creating delete request
...
Description: Lambda function.
FunctionName: lambda_function
Handler: lambda_function.lambda_handler
Role : !GetAtt LambdaExecutionRole.Arn
Runtime: python2.7
Timeout: 5
Run Code Online (Sandbox Code Playgroud)
Ser*_*lev 14
index如果您指定内联代码,则处理程序的第一部分应始终如此.
如果通过在Code属性中指定ZipFile属性将源代码指定为内联文本,请将index.function_name指定为处理程序. http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html
所以只需使用:
LambdaFunction:
Type: "AWS::Lambda::Function"
Properties:
Code:
ZipFile: !Sub |
import json
def lambda_handler(event,context):
#Creating delete request
...
Description: Lambda function.
FunctionName: lambda_function
Handler: index.lambda_handler
Role : !GetAtt LambdaExecutionRole.Arn
Runtime: python2.7
Timeout: 5
Run Code Online (Sandbox Code Playgroud)
注意index.lambda_handler而不是lambda_function.lambda_handler.
| 归档时间: |
|
| 查看次数: |
8654 次 |
| 最近记录: |