我想将现有的 Rest API 移动到 HTTP API,并在自定义域配置中出错。我的 HTTP API SAM 文件是:
resHttpApiGateway:
Type: AWS::Serverless::HttpApi
Properties:
StageName: !Sub "${paramEnvironment}"
CorsConfiguration:
AllowOrigins:
- "*"
AllowHeaders:
- Content-Type
- X-Amz-Date
- Authorization
- X-Api-Key
- correlation-object
AllowMethods:
- GET
- POST
- PUT
- DELETE
Auth:
Authorizers:
authTokenAuthorizer:
AuthorizerPayloadFormatVersion: 1.0
FunctionArn: !Ref paramLambdaAuthorizer
Identity:
Headers:
- Authorization
ReauthorizeEvery: 0
Domain:
EndpointConfiguration: REGIONAL
DomainName: !If
- condIsLocal
- !Sub "dev.${paramBaseDomain}"
- !Sub "${paramEnvironment}.${paramBaseDomain}"
CertificateArn: arn:aws:acm:xxx
Route53:
HostedZoneId: xxx
BasePath: "company-api"
我在 Cloudformation 中遇到的错误:
The domain name you provided already exists. (Service: AmazonApiGatewayV2; Status Code: 400; Error Code: BadRequestException; Request ID: ddba8c65-63de-4be4-9316-afd777e8b63f; Proxy: null)
因为我在 API Gateway 中配置了一个现有的自定义域。看起来它试图创建一个自定义域名,有没有办法将 HTTP API 实例映射到现有的自定义域?对于 REST API,我使用AWS::ApiGateway::BasePathMapping进行此任务的映射,但找不到 HTTP API 替代方案。