微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

提供的请求无效:AWS::ElasticLoadBalancingV2::ListenerRule 验证异常

如何解决提供的请求无效:AWS::ElasticLoadBalancingV2::ListenerRule 验证异常

我只需要使用 CloudFormation 创建一个 TargetGroup 和 ListenerRule,但我收到错误

我的 CloudFormation:

TargetGroup:
    Type: AWS::ElasticLoadBalancingV2::TargetGroup
    Properties:
      Name: !Sub ${StackName}-alb
      VpcId: !Ref VpcId
      Port: !Ref ContainerPort
      Protocol: HTTP
      Matcher:
        HttpCode: 200
      HealthCheckIntervalSeconds: 10
      HealthCheckPath: !Ref HealthCheckPath
      HealthCheckProtocol: HTTP
      HealthCheckTimeoutSeconds: 5
      HealthyThresholdCount: 2
      targettype: ip
      TargetGroupAttributes:
        - Key: deregistration_delay.timeout_seconds
          Value: 30

  ListenerRule:
    Type: AWS::ElasticLoadBalancingV2::ListenerRule
    DependsOn: 
      - TargetGroup
    Properties:
      Actions:
        - Type: forward
          TargetGroupArn: !Ref TargetGroup
      Conditions:
        - Field: host-header
          Values:
            - "www.mydominian.*"
      ListenerArn: !Ref ListenerArn
      Priority: 164

Invalid request provided 所以,错误是图像

解决方法

AWS::StackName 看起来好像缺少 AWS:: 前缀


建议尝试使用 CloudFormation Linter 中的 VSCode 在创作模板以及自动完成和文档链接时内联查看其中一些错误:

Visual Studio Code extension

[cfn-lint] E1019: Parameter StackName for Fn::Sub not found at Resources/TargetGroup/Properties/Name/Fn::Sub

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。