Bird
Raised Fist0
AWScloud~10 mins

Auto Scaling with ELB integration in AWS - Step-by-Step Execution

Choose your learning style10 modes available
Process Flow - Auto Scaling with ELB integration
Start: Define Launch Configuration
↓
Create Auto Scaling Group
↓
Attach ELB to Auto Scaling Group
↓
Monitor Metrics (CPU, etc.)
↓
Scale Out: Increase Instances
↓
ELB Distributes Traffic to New Instances
↓
Scale In: Decrease Instances
↓
ELB Removes Terminated Instances
↓
End: Desired Capacity Maintained
The flow starts by defining how instances launch, then creates a group that can grow or shrink. The ELB is attached to balance traffic. Metrics trigger scaling, and ELB updates targets accordingly.
Execution Sample
AWS
1. Define Launch Configuration
2. Create Auto Scaling Group with min=1, max=3
3. Attach ELB to Auto Scaling Group
4. CPU > 70% triggers scale out
5. CPU < 30% triggers scale in
This setup automatically adds or removes instances based on CPU load, with ELB balancing traffic among active instances.
Process Table
StepCPU Utilization (%)Auto Scaling ActionInstance CountELB Target Instances
125No action1[Instance1]
275Scale out2[Instance1, Instance2]
380No action2[Instance1, Instance2]
420Scale in1[Instance1]
550No action1[Instance1]
💡 CPU stabilizes between thresholds, no further scaling needed
Status Tracker
VariableStartAfter Step 1After Step 2After Step 3After Step 4After Step 5
CPU Utilization (%)N/A2575802050
Instance Count112211
ELB Target Instances[Instance1][Instance1][Instance1, Instance2][Instance1, Instance2][Instance1][Instance1]
Key Moments - 2 Insights
Why does the ELB remove Instance1 after scaling in at step 4?
Because the Auto Scaling Group terminated Instance2 to reduce capacity, ELB updates its targets to only include active instances, as shown in execution_table step 4.
Why is there no scaling action at step 3 even though CPU is 80%?
Scaling out already happened at step 2, so the group is at increased capacity. The policy waits for metrics to drop before scaling again, as seen in execution_table step 3.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the instance count after step 2?
A1
B2
C3
D0
💡 Hint
Check the 'Instance Count' column in execution_table row for step 2
At which step does the ELB remove an instance from its targets?
AStep 4
BStep 2
CStep 1
DStep 5
💡 Hint
Look at the 'ELB Target Instances' column changes in execution_table
If CPU stayed at 85% after step 3, what would likely happen next?
ANo scaling action
BScale in to 1 instance
CScale out to 3 instances
DTerminate all instances
💡 Hint
Refer to the scaling policy in execution_sample and instance count limits
Concept Snapshot
Auto Scaling with ELB integration:
- Define launch config and Auto Scaling Group
- Attach ELB to distribute traffic
- Monitor metrics (e.g., CPU)
- Scale out when metric > threshold
- Scale in when metric < threshold
- ELB updates targets automatically
Full Transcript
This visual execution shows how Auto Scaling works with an Elastic Load Balancer (ELB). First, a launch configuration defines how instances start. Then, an Auto Scaling Group is created with minimum and maximum instance counts. The ELB is attached to this group to balance incoming traffic. The system monitors CPU utilization. When CPU goes above 70%, the group adds an instance (scale out). When CPU drops below 30%, it removes an instance (scale in). The ELB updates its target list to include only active instances. This keeps the application responsive and efficient automatically.

Practice

(1/5)
1. What is the main purpose of integrating an Auto Scaling group with an Elastic Load Balancer (ELB)?
easy
A. To distribute incoming traffic evenly across all running instances
B. To store data persistently across instances
C. To create backups of instances automatically
D. To monitor the health of the database

Solution

  1. Step 1: Understand Auto Scaling and ELB roles

    Auto Scaling adjusts the number of servers based on demand. ELB distributes user traffic across these servers.
  2. Step 2: Identify integration benefit

    Linking Auto Scaling with ELB ensures traffic is balanced only to healthy, running instances, improving availability.
  3. Final Answer:

    To distribute incoming traffic evenly across all running instances -> Option A
  4. Quick Check:

    Auto Scaling + ELB = balanced traffic [OK]
Hint: ELB balances traffic; Auto Scaling adjusts servers [OK]
Common Mistakes:
  • Confusing ELB with storage or backup services
  • Thinking Auto Scaling manages data persistence
  • Assuming ELB monitors databases
2. Which of the following is the correct way to attach an Auto Scaling group to an ELB target group in AWS CLI?
easy
A. aws elb attach-instances --group-name my-asg --target-group-arn arn:aws:elasticloadbalancing:region:123456789012:targetgroup/my-target-group/abcdef123456
B. aws elb create-auto-scaling-group --name my-asg --target-group my-target-group
C. aws autoscaling create-target-group --name my-target-group --auto-scaling-group my-asg
D. aws autoscaling attach-load-balancer-target-groups --auto-scaling-group-name my-asg --target-group-arns arn:aws:elasticloadbalancing:region:123456789012:targetgroup/my-target-group/abcdef123456

Solution

  1. Step 1: Identify correct AWS CLI command

    The command to attach an Auto Scaling group to an ELB target group is 'aws autoscaling attach-load-balancer-target-groups'.
  2. Step 2: Verify command parameters

    It requires the Auto Scaling group name and the target group ARN, matching aws autoscaling attach-load-balancer-target-groups --auto-scaling-group-name my-asg --target-group-arns arn:aws:elasticloadbalancing:region:123456789012:targetgroup/my-target-group/abcdef123456.
  3. Final Answer:

    aws autoscaling attach-load-balancer-target-groups --auto-scaling-group-name my-asg --target-group-arns arn:aws:elasticloadbalancing:region:123456789012:targetgroup/my-target-group/abcdef123456 -> Option D
  4. Quick Check:

    Attach ASG to ELB target group uses attach-load-balancer-target-groups [OK]
Hint: Use 'attach-load-balancer-target-groups' with ASG name and target group ARN [OK]
Common Mistakes:
  • Using ELB commands instead of Auto Scaling commands
  • Confusing target group ARN with target group name
  • Trying to create target groups via Auto Scaling CLI
3. Given this AWS Auto Scaling group configuration snippet:
{
  "AutoScalingGroupName": "web-asg",
  "TargetGroupARNs": ["arn:aws:elasticloadbalancing:region:123456789012:targetgroup/web-tg/abc123"],
  "MinSize": 2,
  "MaxSize": 4,
  "DesiredCapacity": 3
}

What happens when one instance fails health checks in the ELB target group?
medium
A. Auto Scaling terminates the unhealthy instance and launches a new one to maintain desired capacity
B. ELB stops sending traffic but Auto Scaling does not replace the instance
C. Auto Scaling increases MaxSize to 5 automatically
D. Nothing happens until manual intervention

Solution

  1. Step 1: Understand health check integration

    When an instance fails ELB health checks, Auto Scaling detects it as unhealthy.
  2. Step 2: Auto Scaling response

    Auto Scaling terminates the unhealthy instance and launches a new one to keep the desired capacity at 3.
  3. Final Answer:

    Auto Scaling terminates the unhealthy instance and launches a new one to maintain desired capacity -> Option A
  4. Quick Check:

    Unhealthy instance triggers replacement by Auto Scaling [OK]
Hint: Auto Scaling replaces unhealthy instances to keep desired capacity [OK]
Common Mistakes:
  • Thinking ELB alone replaces instances
  • Assuming MaxSize changes automatically
  • Believing manual steps are needed
4. You configured an Auto Scaling group with an ELB target group, but new instances are not receiving traffic. What is the most likely cause?
medium
A. The ELB is in a different AWS region than the Auto Scaling group
B. The Auto Scaling group has MinSize set to zero
C. The instances are not registered with the ELB target group
D. The instances do not have public IP addresses

Solution

  1. Step 1: Check ELB and Auto Scaling integration

    If instances are not registered with the ELB target group, ELB cannot send traffic to them.
  2. Step 2: Evaluate other options

    MinSize zero means no instances; region mismatch prevents communication; public IP not required for ELB internal routing.
  3. Final Answer:

    The instances are not registered with the ELB target group -> Option C
  4. Quick Check:

    Instances must be registered with ELB target group to get traffic [OK]
Hint: Check instance registration in ELB target group first [OK]
Common Mistakes:
  • Assuming public IP is required for ELB traffic
  • Ignoring instance registration status
  • Confusing region mismatch with availability zone issues
5. You want to ensure your Auto Scaling group scales out only when the average CPU usage across all instances exceeds 70%, and also that new instances are healthy in the ELB before receiving traffic. Which combination of settings achieves this?
hard
A. Configure scaling policy on network traffic, and skip ELB health checks
B. Create a scaling policy based on CPU > 70%, enable ELB health checks with grace period
C. Use ELB health checks only, no CPU-based scaling policy
D. Set MinSize to 0, MaxSize to 10, and disable ELB health checks

Solution

  1. Step 1: Define scaling trigger

    Scaling based on average CPU > 70% ensures scale out matches demand.
  2. Step 2: Ensure instance health before traffic

    Enabling ELB health checks with a grace period lets new instances become healthy before receiving traffic.
  3. Step 3: Combine both for smooth scaling

    This combination prevents traffic to unhealthy instances and scales only when needed.
  4. Final Answer:

    Create a scaling policy based on CPU > 70%, enable ELB health checks with grace period -> Option B
  5. Quick Check:

    CPU scaling + ELB health checks = safe, demand-based scaling [OK]
Hint: Combine CPU scaling policy with ELB health checks and grace period [OK]
Common Mistakes:
  • Disabling ELB health checks causing traffic to unhealthy instances
  • Using wrong metric like network traffic for CPU-based scaling
  • Not setting grace period causing premature traffic routing
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard