![](/img/trans.png)
[英]Fail to create a custom domain name for websocket API gateway using AWS Cloudformation
[英]Connect aws WebSocket api to custom domain name
我使用 aws WebSocket api 創建了一個消息傳遞應用程序,並使用無服務器進行部署。 API 已成功部署,我可以使用 wscat 測試這些 API。 我在堆棧中也有其他 Rest api。 I tried mapping my new WebSocket api stack to an existing domain name, but getting the error: Only REGIONAL domain names can be managed through the API Gateway V2 API. For EDGE domain names, please use the API Gateway V1 API. Also note that only REST APIs can be attached to EDGE domain names.
Only REGIONAL domain names can be managed through the API Gateway V2 API. For EDGE domain names, please use the API Gateway V1 API. Also note that only REST APIs can be attached to EDGE domain names.
我被困住並試圖弄清楚要進行哪些更改。
I went through https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-api.html and https://docs.aws.amazon.com/apigateway/latest/developerguide/how -to-custom-domains.html但無法弄清楚。
您can't mix API Gateway mapping between RestApis and Websocket APIs
。 換句話說,它可以表示為我們不能為 RestAPI 和 WebSocket 使用相同的域或子域。
ApiGWCustomDomainName:
Type: 'AWS::ApiGateway::DomainName'
Properties:
RegionalCertificateArn: !Ref RegionalCertificateArn
DomainName: !Ref DomainName
EndpointConfiguration:
Types:
- REGIONAL
SecurityPolicy: TLS_1_2
AppApiMapping:
Type: 'AWS::ApiGatewayV2::ApiMapping'
Properties:
ApiMappingKey : !Ref BasePath
DomainName: !Ref ApiGWCustomDomainName
ApiId: !Ref websocketAPI
Stage : !Ref Stage
ApiGWCustomDomainName:
Type: 'AWS::ApiGateway::DomainName'
Properties:
CertificateArn: !Ref CertificateArn
DomainName: !Ref DomainName
AppApiMapping:
Type: 'AWS::ApiGateway::BasePathMapping'
Properties:
BasePath: !Ref BasePath
DomainName: !Ref ApiGWCustomDomainName
RestApiId: !Ref RestApi
Stage : !Ref ApiStageName
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.