该问题通常出现在AWS CloudFormation模板中,其中Lambda函数使用ProvisionedConcurrency配置选项进行自动伸缩。出现了'DependsOn value null”错误,因为Lambda函数缺少依赖项。
解决此问题的方法是在CloudFormation模板中为Lambda函数添加依赖项。以下是示例代码:
"LambdaFunction": { "Type": "AWS::Lambda::Function", "Properties": { "Code": { "S3Bucket": "my-bucket", "S3Key": "my-lambda-function.zip" }, "FunctionName": "my-lambda-function", "Handler": "index.handler", "Role": { "Fn::GetAtt": [ "LambdaExecutionRole", "Arn" ] }, "Runtime": "nodejs12.x", "ProvisionedConcurrencyConfig": { "ProvisionedConcurrentExecutions": 10 } }, "DependsOn": "LambdaExecutionRole" }
在此示例中,Lambda函数的'DependsOn”属性设置为'LambdaExecutionRole”,以确保Lambda函数在执行之前会先创建IAM角色。通过添加正确的依赖项,即可解决此问题。
上一篇:AutoscaleMongoDBCommunityOperatorReplicaset
下一篇:AutoScaling::LaunchConfiguration的默认BlockDeviceMappings设置