簡體   English   中英

AWS Cloudformation - 將 VPC_Link / NLB 附加到 api 網關中的方法給出“無效方法設置路徑”錯誤

[英]AWS Cloudformation - Attach VPC_Link / NLB to method in api gateway gives "Invalid method setting path" error

我正在嘗試使用 CloudFormation 部署帶有 VPC 鏈接和 NLB 的 API 網關。 目標是代理將所有請求傳遞給 NLB:

  NLB:
    Type: AWS::ElasticLoadBalancingV2::LoadBalancer
    Properties: 
      Type: "network"
      IpAddressType: "ipv4"
      Name: !Ref NLBName
      Scheme: "internal"
      # LoadBalancerAttributes: 
      #   - LoadBalancerAttribute
      Subnets: 
        - !Ref NLBSubnetApNortheast1a
        - !Ref NLBSubnetApNortheast1c
        - !Ref NLBSubnetApNortheast1d

  ... other code ... 

  ApiProxyMethod: 
    Type: AWS::ApiGateway::Method
    Properties: 
      RestApiId: !Ref ApiGatewayRestApi
      ResourceId: !Ref ApiProxyResource
      AuthorizationType: COGNITO_USER_POOLS
      AuthorizerId: !Ref ApiAuthorizer
      HttpMethod: ANY
      OperationName: "ProxyAllRequests"
      Integration: 
        ConnectionType: VPC_LINK
        ConnectionId: !Ref ApiGatewayVpcLink
        IntegrationHttpMethod: ANY
        # PassthroughBehavior: String        
        Type: "HTTP" # Member must satisfy enum value set: [HTTP, AWS_PROXY, HTTP_PROXY, AWS] 
        Uri: !Sub 
          - 'http://${DNSName}/{proxy}'
          - DNSName: !GetAtt NLB.DNSName
          # DNSName: The DNS name for the load balancer. For example, my-load-balancer-424835706.us-west-2.elb.amazonaws.com

當我嘗試運行它時,出現此錯誤: 在此處輸入圖像描述

錯誤詳情:

1 validation error detected: Value 'Invalid method setting path: 
null/null/logging/dataTrace. Must be one of: [/deploymentId, 
/description, /cacheClusterEnabled, /cacheClusterSize, 
/clientCertificateId, /accessLogSettings, 
/accessLogSettings/destinationArn, /accessLogSettings/format, 
/{resourcePath}/{httpMethod}/metrics/enabled, 
/{resourcePath}/{httpMethod}/logging/dataTrace, 
/{resourcePath}/{httpMethod}/logging/loglevel, 
/{resourcePath}/{httpMethod}/throttling/burstLimit/{resourcePath}/{ht
tpMethod}/throttling/rateLimit/{resourcePath}/{httpMethod}/caching/t
tlInSeconds, /{resourcePath}/{httpMethod}/caching/enabled,
 /{resourcePath}/{httpMethod}/caching/dataEncrypted, /{resourcePath}/{httpMethod}/caching/requireAuthorizationForCacheControl, 
/{resourcePath}/{httpMethod}/caching/unauthorizedCacheControlHeaderStrategy, /*/*/metrics/enabled, /*/*/logging/dataTrace, 
/*/*/logging/loglevel, /*/*/throttling/burstLimit 
/*/*/throttling/rateLimit /*/*/caching/ttlInSeconds, 
/*/*/caching/enabled, /*/*/caching/dataEncrypted, 
/*/*/caching/requireAuthorizationForCacheControl, 
/*/*/caching/unauthorizedCacheControlHeaderStrategy, 
/variables/{variable_name}, /tracingEnabled] (Service: ApiGateway, 
Status Code: 400, Request ID: 748f725f-fa59-4885-9058-9d4d17722d5e, 
Extended Request ID: null)' at 'statusMessage' failed to satisfy 
constraint: Member must have length less than or equal to 1024


我能夠找到錯誤的來源是AWS::ApiGateway::Method ,而且Uri似乎不正確。

當我將Uri更改為"http://NLB-myapp-internal-beta-123.elb.ap-northeast-1.amazonaws.com/{proxy}"時,一切正常。

我試圖搜索錯誤消息,但沒有任何線索。 可能是什么原因? 錯誤信息是什么意思?

我認為它應該是:

        Type: HTTP_PROXY 
        Uri: !Sub "http://${NLB.DNSName}"

你在那里不需要任何{proxy}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM