- Newest
- Most votes
- Most comments
Hello.
"TargetGroupARNs" is specified in the AutoScaling settings, so when EC2 scales out, it will be linked to the specified target group.
Also, it may not be included because it is not the full text of the CloudFormation template, but please create a listener using "AWS::ElasticLoadBalancingV2::Listener" to link the target group to the ALB.
https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-listener.html
For example, to add a listener for port 80, you need to add the following template.
AlbListener:
Type: AWS::ElasticLoadBalancingV2::Listener
Properties:
DefaultActions:
- TargetGroupArn: !Ref InstanceTargetGroup
Type: forward
LoadBalancerArn: !Ref LoadBalancer
Port: 80
Protocol: HTTP
The key missing element is the Listener configuration for your Load Balancer.
For example:
LoadBalancerListener:
Type: AWS::ElasticLoadBalancingV2::Listener
Properties:
DefaultActions:
- Type: forward
TargetGroupArn: !Ref InstanceTargetGroup
LoadBalancerArn: !Ref LoadBalancer
Port: 80
Protocol: HTTP
Hello,
You have almost completed the implementation to allow your Load Balancer to forward traffic across EC2 instances in the Auto Scaling group. However, you need to configure the Listeners in the Application Load Balancer (ALB). Listeners are essential as they enable the ALB to listen for incoming traffic and forward it to the target group. To read more about Listeners, https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html
LoadBalancerListener:
Type: AWS::ElasticLoadBalancingV2::Listener
Properties:
DefaultActions:
- Type: forward
TargetGroupArn: !Ref InstanceTargetGroup
LoadBalancerArn: !Ref LoadBalancer
Port: 80
Protocol: HTTP
Relevant content
- Accepted Answerasked 2 years ago
- asked 5 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 5 months ago