Amazon cloudformation 如何使用CloudFormation为API网关v2 websocket连接设置VPC

Amazon cloudformation 如何使用CloudFormation为API网关v2 websocket连接设置VPC,amazon-cloudformation,amazon-gateway,Amazon Cloudformation,Amazon Gateway,无法使用Cloudformation为websocket路由集成请求定义集成类型“VPC链接” 我们不使用无服务器,但已有提供websocket功能的微服务。 这些微服务在专用网络上运行,仅通过连接到运行它们的EKS群集的VPC链路可用 所有与AWSAPI网关/WebSocket相关的在线云信息示例都使用无服务器集成 我可以使用AWS控制台手动配置集成类型“VPC链接”,但似乎不支持使用Cloudformation进行配置。 或者至少,如何实现这一点还不清楚 Cloudformation文档还明

无法使用Cloudformation为websocket路由集成请求定义集成类型“VPC链接”

我们不使用无服务器,但已有提供websocket功能的微服务。 这些微服务在专用网络上运行,仅通过连接到运行它们的EKS群集的VPC链路可用

所有与AWSAPI网关/WebSocket相关的在线云信息示例都使用无服务器集成

我可以使用AWS控制台手动配置集成类型“VPC链接”,但似乎不支持使用Cloudformation进行配置。 或者至少,如何实现这一点还不清楚

Cloudformation文档还明确指出,对于AWS::APIGatewayV2::Integration.ConnectionType,唯一可用的类型是“INTERNET”,而不是“VPC_链接”

有人知道这是否可以实现吗?如果没有,我还有什么其他选择可以实现自动化


基础设施是使用Terraform设置的,由于缺乏对API网关/WebSocket的支持,我已经需要“回退”到CloudFormation,但CloudFormation似乎还没有支持所有功能。

恐怕我也遇到了类似的问题。我无法使用VPC链接创建API网关Websocket API与专用ALB(http集成)的集成

我可以使用cloudFormation成功地将Api网关HTTP Api与使用VPC链接的内部ALB集成,如所示

但是,即使
AWS::APIGatewayV2::Integration.ConnectionType
同时支持
INTERNET
VPC\u-LINK
,但它似乎不起作用,云形成堆栈因以下错误而失败:

VpcLink V2 are not supported for WEBSOCKET Apis. Only Http Apis are supported. (Service: AmazonApiGatewayV2; Status Code: 400; Error Code: BadRequestException
关于我如何尝试的云形成样本

websocketApiGateway:
  Type: AWS::ApiGatewayV2::Api
  Properties:
    Name: websocket-gateway
    Description: Api Gateway for websocket
    ProtocolType: WEBSOCKET
    RouteSelectionExpression: $request.body.action

connectRoute:
  Type: AWS::ApiGatewayV2::Route
  Properties:
    ApiId: !Ref websocketApiGateway
    RouteKey: $connect
    AuthorizationType: NONE
    OperationName: ConnectRoute
    RouteResponseSelectionExpression: $default
    Target: !Join
      - /
      - - integrations
        - !Ref connectIntegration

connectIntegration:
  Type: AWS::ApiGatewayV2::Integration
  Properties:
    ApiId: !Ref websocketApiGateway
    Description: Websocket $connect integration
    IntegrationType: HTTP_PROXY
    IntegrationMethod: ANY
    ConnectionType: VPC_LINK
    ConnectionId: !Ref privateLink
    IntegrationUri: # with VPC_LINK I can't use a well formed url, it's necessary to use the ALB's ARN
      Fn::ImportValue: alb-http-listener-id
    RequestParameters:
      "integration.request.header.domainName": "context.domainName"
      "integration.request.header.stage": "context.stage"
      "integration.request.header.connectionId": "context.connectionId"
    PayloadFormatVersion: 1.0

privateLink:
  Type: AWS::ApiGatewayV2::VpcLink
  Properties:
    Name: private-link
    SecurityGroupIds:
      - !Ref securityGroup
    SubnetIds:
      - !Ref privateNetworkA
      - !Ref privateNetworkB
      - !Ref privateNetworkC
如果任何人有进一步的信息,请张贴。不幸的是,缺乏支持和混乱的文档