我正在使用兩個自定義資源在我的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雲發送成功信號很困難。 –