Amazon web services 如何在cloudformation lambda中为aws lambda设置最大重试次数?
我有一个通过VisualStudio创建的无服务器项目,我正在寻找在cloudformation模板中设置特定lambda的最大重试次数。 我看到了EventInvokeConfig,但是lambda函数名是自动生成的,并且不同于每个环境。我想知道是否有一个aws特定的参数来获取lambda函数名Amazon web services 如何在cloudformation lambda中为aws lambda设置最大重试次数?,amazon-web-services,amazon-cloudformation,Amazon Web Services,Amazon Cloudformation,我有一个通过VisualStudio创建的无服务器项目,我正在寻找在cloudformation模板中设置特定lambda的最大重试次数。 我看到了EventInvokeConfig,但是lambda函数名是自动生成的,并且不同于每个环境。我想知道是否有一个aws特定的参数来获取lambda函数名 "EventInvokeConfig": { "Type" : "AWS::Lambda::EventInvokeConfig", "Properties" : { "Func
"EventInvokeConfig": {
"Type" : "AWS::Lambda::EventInvokeConfig",
"Properties" : {
"FunctionName" : "???",
"MaximumRetryAttempts" : 0,
"Qualifier" : "$LATEST"
}
}
这是我的无服务器模板
{
"AWSTemplateFormatVersion":"2010-09-09",
"Transform":"AWS::Serverless-2016-10-31",
"Description":"An AWS Serverless Application that uses the ASP.NET Core framework running in Amazon Lambda.",
"Resources":{
"MyFunctionLambda":{
"Type":"AWS::Serverless::Function",
"Properties":{
"Handler":"MyPlatformServerless::MyPlatformServerless.Lambdas.MyFunctionLambda::FunctionHandler",
"Runtime":"dotnetcore2.1",
"CodeUri":"",
"Description":"Default function",
"MemorySize":512,
"Timeout":60,
"Role":null
}
}
}
}
您可以使用
Ref
instrinsic函数。对于类型为AWS::Serverless::Function
的资源,返回的值是函数的名称
这可以在模板中定义的其他资源中引用。对于EventInvokeConfig
,模板如下所示
{
"AWSTemplateFormatVersion":"2010-09-09",
"Transform":"AWS::Serverless-2016-10-31",
"Description":"An AWS Serverless Application that uses the ASP.NET Core framework running in Amazon Lambda.",
"Resources":{
"MyFunctionLambda":{
"Type":"AWS::Serverless::Function",
"Properties":{
"Handler":"MyPlatformServerless::MyPlatformServerless.Lambdas.MyFunctionLambda::FunctionHandler",
"Runtime":"dotnetcore2.1",
"CodeUri":"",
"Description":"Default function",
"MemorySize":512,
"Timeout":60,
"Role":null
}
},
"EventInvokeConfig": {
"Type" : "AWS::Lambda::EventInvokeConfig",
"Properties" : {
"FunctionName" : { "Ref" : MyFunctionLambda },
"MaximumRetryAttempts" : 0,
"Qualifier" : "$LATEST"
}
}
}
}
lambda函数是作为这个cloudformation模板的一部分创建的吗?@franklinsijo是的lambda函数是在cloudformation模板中创建的请用完整的模板更新帖子!