gpt4 book ai didi

amazon-web-services - AWS Cloudformation - 将 VPC_Link/NLB 附加到 api 网关中的方法会出现 "Invalid method setting path"错误

转载 作者:行者123 更新时间:2023-12-03 07:39:51 30 4
gpt4 key购买 nike

我正在尝试使用 CloudFormation 来部署具有 VPC Link 和 NLB 的 API Gateway。目标是将所有请求代理传递到 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

当我尝试运行它时,出现以下错误: enter image description here

错误详细信息:

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}

关于amazon-web-services - AWS Cloudformation - 将 VPC_Link/NLB 附加到 api 网关中的方法会出现 "Invalid method setting path"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72017261/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com