by shigemk2

当面は技術的なことしか書かない

CloudFormation ListenerRule

ListenerArnはRefで取れたりする。

  ListenerRule1:
    Type: 'AWS::ElasticLoadBalancingV2::ListenerRule'
    Properties:
      Actions:
        - Type: forward
          TargetGroupArn: !Ref TargetGroup1
      Conditions:
        - Field: http-header
          HttpHeaderConfig:
            HttpHeaderName: User-Agent
            Values:
              - Mozilla
        - Field: http-header
          HttpHeaderConfig:
            HttpHeaderName: Referer
            Values:
              - 'https://www.amazon.com/'
      ListenerArn: !Ref Listener
      Priority: 1
  Listener:
    Type: 'AWS::ElasticLoadBalancingV2::Listener'
    Properties:
      DefaultActions:
        - Type: forward
          TargetGroupArn: !Ref TargetGroup1
      LoadBalancerArn: !Ref LoadBalancer
      Port: '8000'
      Protocol: HTTP
 ```

[https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-listener.html:embed:cite]



[https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-listenerrule.html:embed:cite]