【发布时间】:2018-06-20 06:18:59
【问题描述】:
我正在尝试使用 CloudFormation 为 API 网关定义自定义域(实际上是子域)。根据我能够找到的所有文档,以下内容应该可以工作,但是当我部署它时,我得到Invalid domain name identifier specified 的BasePathMapping
aws cloudformation deploy --template-file packaged-prompt.yaml --capabilities CAPABILITY_IAM --stack-name prompt-stack
prompt.yaml
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
...
Certificate:
Type: 'AWS::CertificateManager::Certificate'
Properties:
DomainName: example.mydomain.com
DomainName:
Type: 'AWS::ApiGateway::DomainName'
Properties:
CertificateArn: !Ref Certificate
DomainName: example.mydomain.com
Mapping:
Type: 'AWS::ApiGateway::BasePathMapping'
Properties:
DomainName: !Ref DomainName
RestApiId: !Ref Api
Api:
Type: AWS::Serverless::Api
Properties:
StageName: prod
DefinitionBody:
swagger: 2.0
info:
title:
Ref: AWS::StackName
paths:
....
【问题讨论】:
-
您在 CloudFormation 中部署堆栈或在 API Gateway 中部署 API 时是否收到错误?如果在 BasePathMapping 中指定阶段,是否得到相同的结果?
-
当我在 CloudFormation 中部署时。当我设置舞台时,CloudFormation 挂在
CREATE_IN_PROGRESS上。距离上次活动已经一个多小时了。 -
使用 EDGE endpointConfigurationType 的域名一般需要 40 分钟左右。您可以尝试使用 REGIONAL endpointConfigurationType(创建只需几秒钟)。可以从 cfn docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/… 做到这一点?
-
另外,当您在此堆栈中创建证书时,它会挂起,直到您验证它为止。您为其注册证书的域的所有者将receive an email 要求验证。另一种方法是使用DNS verification。如果您确实尝试注册
mydomain.com,除非您拥有它并且可以验证它,否则堆栈最终会失败。有兴趣知道最终的失败消息是什么。 -
您确定您输入的域名格式有效且不包含任何字符吗?例如,您是否不小心输入了 HTTP 或 domaincom 忘记了一个点?
标签: aws-api-gateway amazon-cloudformation