【发布时间】:2018-11-11 05:54:20
【问题描述】:
我使用cloudformation模板创建了MyAPI、MyAPIGetMethod、MyAPIDeployment。
现在,我有一个单独的脚本,我将使用它来创建阶段。像这样的东西。该脚本抛出一个错误,它不知道我在DeploymentId 和RestApiId 中使用的是什么资源。确切的错误是Template validation error: Template error: instance of Fn::GetAtt references undefined resource MyAPIDeployment
{
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters" : {
"EnvType": {
"Type": "String",
"Default": "test",
"AllowedValues": ["test", "prod"],
"Description": "Select what stage need to be created"
}
},
"Conditions":{
"CreateProdStage" : {"Fn::Equals": [{"Ref":"EnvType"}, "prod"]},
"CreateTestStage" : {"Fn::Equals": [{"Ref":"EnvType"}, "test"]}
},
"Resources": {
"TestStage" : {
"Type" : "AWS::ApiGateway::Stage",
"Condition":"CreateTestStage",
"Properties" : {
"DeploymentId" : {"Fn::GetAtt" : ["MyAPIDeployment", "Arn"]},
"Description" : "Test Stage",
"RestApiId" : {"Fn::GetAtt" : ["MyAPI", "Arn"]},
"StageName" : "test"
}
},
"ProdStage" : {
"Type" : "AWS::ApiGateway::Stage",
"Condition":"CreateProdStage",
"Properties" : {
"DeploymentId" : {"Fn::GetAtt" : ["MyAPIDeployment", "Arn"]},
"Description" : "Prod Stage",
"RestApiId" : {"Fn::GetAtt" : ["MyAPI", "Arn"]},
"StageName" : "prod",
"MethodSettings":[{
"CachingEnabled":"true",
"HttpMethod":"GET",
"ResourcePath":"/",
"CacheTtlInSeconds":300,
"ThrottlingBurstLimit" : 2000,
"ThrottlingRateLimit" : 1000
}]
}
}
}
}
【问题讨论】:
标签: amazon-web-services amazon-cloudformation