我正在使用两个自定义资源在我的cloudFormation模板中。基本上这些自定义资源是具有自定义代码的lambda函数。我想开始创建的第二lambda后恒定3分钟。创建具有恒定超时的cloudFormation waitCondition
我以为使用cloudFormation的WaitCondition与超时属性来解决这个问题。但它需要一个WaitHandle的具有超时前收到成功信号。一旦接收到信号,WaitCondition就会转到Create-Complete。但在我的情况下,我不能让自定义函数发送信号等待句柄。在完成第一个自定义资源后,我需要持续3分钟的等待时间。然后,后开始第二个自定义资源创建创建完成WaitCondition的。这里是我的代码:
"SecondCustomResource": {
"Type": "Custom::SecondCustomResource",
"DependsOn" : "WaitCondition",
"Properties": {
"ServiceToken": { "Fn::GetAtt" : ["SecondCustomResourceFunction", "Arn"] }
}
},
"SecondCustomResourceFunction": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"S3Bucket": { "Ref": "S3Bucket" },
"S3Key": { "Ref": "S3Key" }
},
"Handler": { "Fn::Join" : [ "", [{ "Ref": "ModuleName" },".handler"] ] },
"Runtime": "nodejs4.3",
"Timeout": "30"
}
},
"WaitCondition": {
"Type" : "AWS::CloudFormation::WaitCondition",
"DependsOn" : "FirstCustomResource",
"Properties": {
"Timeout": "180"
}
},
"FirstCustomResource": {
"Type": "Custom::FirstCustomResource",
"Properties": {
"ServiceToken": { "Fn::GetAtt" : ["FirstCustomResourceFunction", "Arn"] }
}
},
"FirstCustomResourceFunction": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"S3Bucket": { "Ref": "S3Bucket" },
"S3Key": { "Ref": "S3Key" }
},
"Handler": { "Fn::Join" : [ "", [{ "Ref": "ModuleName" },".handler"] ] },
"Runtime": "nodejs4.3",
"Timeout": "30"
}
}
这似乎并不奏效。任何破解或解决方法都有一个恒定的WaitCondition?
你有没有在堆栈中,可以提供“休眠”的实例,然后将信号处理? –
不,我正在自定义函数中部署一个kubernetes集群。从Google云发送成功信号很困难。 –