尝试通过CloudFormation创建AWS::ApiGateway::BasePathMapping时,出现以下错误:
Invalid domain name identifier specified下面是我的CloudFormation模板中用于创建AWS::ApiGateway::BasePathMapping的部分
{
"Parameters": {
"ApiDomainName": {
"Description": "The domain name for the API",
"Type": "String"
}
},
"Resources": {
"ApiBasePathMapping": {
"Type": "AWS::ApiGateway::BasePathMapping",
"Properties": {
"DomainName": {
"Ref": "ApiDomainName"
},
"RestApiId": {
"Ref": "RepositoryApi"
},
"Stage": {
"Ref": "ApiProductionStage"
}
},
"DependsOn": [
"ApiProductionStage"
]
}
}
}documentation没有提到它需要对DomainName有什么特别的东西,但是这个资源的文档似乎缺少一些信息(它没有列出输出,例如,尽管有一个Distribution Domain Name作为示例创建)。
堆栈的其余部分按预期工作。我正在尝试将此资源作为更改集添加。我确实拥有我尝试使用的域,并且我已经在ACM中为该域创建了证书。
发布于 2017-05-12 03:51:09
引用自AWS论坛:
只有在域名添加到接口网关后,才能创建或修改基础路径映射。当找不到基础路径映射中给定的域名时,会返回指定的域名标识无效,表示域名尚未添加。
此外,从2017年3月起,CloudFormation提供的自定义资源是唯一通过CloudFormation将域名添加到接口网关的方式。
参考:https://forums.aws.amazon.com/message.jspa?messageID=769627
发布于 2018-07-12 22:01:43
现在可以这样做了。您只需在CFN模板上显式声明存在依赖项(DependsOn):
...
ApiDevMapping:
Type: 'AWS::ApiGateway::BasePathMapping'
Properties:
BasePath: v1.0
Stage: dev
DomainName: my-api.example.com
RestApiId: !Ref MobileApiDev
DependsOn:
- MobileApiDevDomain
...https://stackoverflow.com/questions/43924140
复制相似问题