Reputation: 1647
I'm trying to stand up a small Cloudformation stack comprised of an application load balancer, a target group, and an ECS service. However, the stack fails to create the WidgetsServiceLbListenerRule
resource with the following error:
"Invalid request provided: AWS::ElasticLoadBalancingV2::ListenerRule Validation exception" (RequestToken: 98057bbb-ad4f-5f09-3e89-cc6b645c6e7f, HandlerErrorCode: InvalidRequest)
Why is the listener rule failing to create?
Here's the relevant stack code:
Resources:
# The load balancer
Lb:
Type: AWS::ElasticLoadBalancingV2::LoadBalancer
Properties:
Name: !Join ['', [!Ref Env, '-rest-api-lb-rev', !Ref Rev]]
Scheme: internet-facing
SecurityGroups:
- !Ref LbSg
Subnets:
- Fn::ImportValue: !Sub "${VpcStackName}-PubSubnet1Id"
- Fn::ImportValue: !Sub "${VpcStackName}-PubSubnet2Id"
- Fn::ImportValue: !Sub "${VpcStackName}-PubSubnet3Id"
Type: application
LbListener:
Type: AWS::ElasticLoadBalancingV2::Listener
Properties:
DefaultActions:
- Type: fixed-response
FixedResponseConfig:
ContentType: text/plain
MessageBody: The specified route doesn't exist
StatusCode: 404
LoadBalancerArn: !Ref Lb
Port: 80
Protocol: HTTP
# Widgets service
WidgetsServiceLbTargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
HealthCheckPath: /actuator/health
Name: !Join ['', [!Ref Env, '-widgets-rev', !Ref Rev]]
Port: 80
Protocol: HTTP
VpcId:
Fn::ImportValue: !Sub "${VpcStackName}-VpcId"
# THIS ONE FAILS TO CREATE
WidgetsServiceLbListenerRule:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Properties:
Actions:
- Type: forward
TargetGroupArn: !Ref WidgetsServiceLbTargetGroup
Conditions:
- Field: path-pattern
Values:
- '/widgets*'
ListenerArn: Ref !LbListener
Priority: 1
<ECS service and other assets omitted for brevity>
More info
WidgetsServiceLbListenerRule
and then tried to add it back in as a change set. This also produced the same error.aws --profile clexp elbv2 create-rule --listener-arn <arn> --priority 1 --conditions file://conditions.json --actions file://actions.json
conditions.json:
[{"Type": "forward","TargetGroupArn": "<arn>"}]
actions.json:
[{"Field": "path-pattern","Values": ["/widgets*"]}]
Any help is much appreciated.
Upvotes: 4
Views: 2103
Reputation: 238847
Instead of :
ListenerArn: Ref !LbListener
it should be:
ListenerArn: !Ref LbListener
Upvotes: 2