Description
If an Auto Scaling group serves requests through a load balancer, register its instances with that load balancer or its target group. Batch jobs and queue workers may use a different request path.
Potential impact
A new instance that is never registered cannot receive requests through the load balancer.
Remediation
Use load_balancers for Classic Load Balancer names or target_group_arns for ALB or NLB target group ARNs. After scaling, verify that new instances register and serve requests. When testing a failure, check both load-balancer health checks and Auto Scaling replacement settings.
Examples
The example uses the deprecated community.aws.ec2_asg name. Use amazon.aws.autoscaling_group for new tasks. Supply a launch configuration or template supported by your account, network settings and actual Classic Load Balancer names. The samples use lc-1, lb1 and lb2.
Before
- name: Create Auto Scaling Group
community.aws.ec2_asg:
name: special
load_balancers: []
launch_config_name: lc-1
min_size: 1
max_size: 10
desired_capacity: 5
After
- name: Create Auto Scaling Group
community.aws.ec2_asg:
name: special
load_balancers:
- lb1
- lb2
launch_config_name: lc-1
min_size: 1
max_size: 10
desired_capacity: 5