AWSCloudFormation-将VPC_Link/NLB附加到API网关中的方法时出现无效的方法设置路径错误
创始人
2024-09-24 07:00:44
0

在API Gateway中,可以使用AWS CloudFormation将VPC Link和NLB附加到HTTP API的方法中。但是,在这个过程中,您可能会遇到“Invalid method setting path”错误。这个错误通常是由于API Gateway无法正确定位VPC Link或NLB而导致的。

下面是一些可能导致此错误并可能解决此错误的代码示例:

  1. 检查VPC Link和NLB ARN是否正确,并确保它们没有语法错误。

Example VPC_Link resource:

Resources:
  MyApiGateway:
    Type: 'AWS::ApiGatewayV2::Api'
    Properties:
      Name: !Sub ${AWS::StackName}-MyApi
      ProtocolType: HTTP
      CorsConfiguration:
        AllowMethods:
          - GET
          - POST
          - PUT
          - DELETE
          - PATCH
        AllowOrigins:
          - '*'
        MaxAge: 300
  MyRoute:
    Type: 'AWS::ApiGatewayV2::Route'
    Properties:
      ApiId: !Ref MyApiGateway
      RouteKey: ANY /
      Target: integrations/${MyProxyIntegration.Arn}
  MyVpcLink:
    Type: 'AWS::ApiGatewayV2::VpcLink'
    Properties:
      Name: !Sub ${AWS::StackName}-MyVpcLink
      SecurityGroupIds:
        - !Ref InternalSG
      SubnetIds:
        - !Ref PrivateSubnetOne
        - !Ref PrivateSubnetTwo

Example NLB resource:

Resources:
  MyNetworkLoadBalancer:
    Type: 'AWS::ElasticLoadBalancingV2::LoadBalancer'
    Properties:
      Name: !Sub ${AWS::StackName}-MyNetworkLoadBalancer
      Scheme: internal
      Type: network
      Subnets:
        - !Ref PrivateSubnetOne
        - !Ref PrivateSubnetTwo
    DependsOn: PrivateSubnetOne
  1. 确保正确地配置了MethodSetting路径。

Example MethodSetting resource:

MyHttpApi:
  Type: "AWS::ApiGatewayV2::Api"
  Properties:
    Name: "My-http-api"
    ProtocolType: "HTTP"
    RouteSelectionExpression: "request.method = $method"
MyIntegration:
  Type: "AWS::ApiGatewayV2::Integration"
  Properties:
    ApiId: !Ref MyHttpApi
    Description: "Http 2

相关内容

热门资讯

aapoker真的假的!wep... aapoker真的假的!wepoker透视脚本下载(透视)挂-竟然详细存在有挂wepoker透视脚本...
透视关于!xpoker透视辅助... 透视关于!xpoker透视辅助(透视)约局吧德州透视,教程教程书(有挂规律)-哔哩哔哩约局吧德州透视...
hhpoker软件靠谱吗!we... hhpoker软件靠谱吗!wepoker私人局开挂视频(透视)教程-一直推荐是真的挂亲,关键说明,w...
透视关于!aapoker辅助工... 透视关于!aapoker辅助工具安全吗(透视)werplan辅助软件,教程绝活儿(确实有挂)-哔哩哔...
德普之星辅助工具如何设置!we... 德普之星辅助工具如何设置!wepoker轻量版书签(透视)工具-一直教你真的有挂德普之星辅助工具如何...
wepoker怎么拿到好牌!w... wepoker怎么拿到好牌!wepokerplus透视脚本免费(透视)插件-确实解谜有挂1、超多福利...
透视专业!wepoker好友局... 透视专业!wepoker好友局透视(透视)wepoker透视最简单三个步骤,教程项目(有挂技术)-哔...
德普之星app安卓版破解版!w... 德普之星app安卓版破解版!we poker游戏下(透视)插件-竟然有挂有挂1、玩家可以在德普之星a...
透视关于!德州局透视(透视)约... 透视关于!德州局透视(透视)约局吧辅助器,教程大纲(有挂分享)-哔哩哔哩1、下载好约局吧辅助器脚本下...
hhpoker真的有透视吗!大... hhpoker真的有透视吗!大菠萝手游辅助(透视)教程-其实关于真的是有挂在进入hhpoker真的有...