Description
For a request-serving application, an Auto Scaling Group without a suitable load balancer connection can have difficulty routing traffic to new instances or bypassing unhealthy ones. Queue workers and batch jobs, however, may not need a load balancer.
load_balancers associates Classic Load Balancers. ALBs and NLBs use target groups; actual registration and health checks also need configuration.
Potential impact
- Service requests may not be distributed effectively as instance capacity grows.
- Mismatched health detection and traffic routing can prolong an outage.
Remediation
Define the workload’s request path and attach the required Classic Load Balancer or target group. Review instance registration, load balancer health checks and Auto Scaling replacement criteria together, and test request handling during scaling and failure. Do not add unnecessary load balancer connections to workloads that do not need them.
Examples
These excerpts use the older ec2_asg module and a launch configuration. Check support in the installed collection and account, and replace lc-1 and load balancer names with actual values. Network configuration is omitted.
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
The Classic Load Balancer list is empty. Check other traffic paths or target groups and the workload’s actual requirements.
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
This associates lb1 and lb2. Association alone does not establish application health; verify registration and health checks.