← Back to Home

Elastic Load Balancing & Auto Scaling Groups

AWS CLF-C02 — Domain 3: Cloud Technology & Services

Scalability & High Availability Concepts

Scalability

Scalability means an application can handle greater loads by adapting. There are two types:

TypeDescriptionExample
Vertical Scaling (Scale Up/Down)Increase the size of the instance (more CPU, RAM). Has a hardware limit.Upgrade from t2.micro to t2.large. Common for non-distributed systems like databases (RDS, ElastiCache).
Horizontal Scaling (Scale Out/In)Increase the number of instances. No hardware limit.Add more EC2 instances behind a load balancer. Implies a distributed system.

High Availability

Key Point:

Elasticity = the ability to auto-scale based on demand (scale out when load increases, scale in when load decreases). This is a key cloud advantage over traditional infrastructure.

Elastic Load Balancing (ELB) Overview

Load Balancer Types

TypeLayerProtocolKey FeaturesUse Cases
Application Load Balancer (ALB) Layer 7 (Application) HTTP, HTTPS, WebSocket Path-based & host-based routing, fixed hostname, can see client IP (X-Forwarded-For), targets: EC2, ECS, Lambda, IP addresses Web applications, microservices, container-based apps
Network Load Balancer (NLB) Layer 4 (Transport) TCP, UDP, TLS Ultra-low latency (~100ms vs 400ms for ALB), handles millions of requests/sec, static IP / Elastic IP per AZ, targets: EC2, IP addresses, ALB Extreme performance, gaming, IoT, real-time streaming
Gateway Load Balancer (GWLB) Layer 3 (Network) IP Protocol (GENEVE on port 6081) Deploy, scale, and manage 3rd-party network virtual appliances. Single entry/exit for all traffic. Transparent to applications. Firewalls, intrusion detection/prevention systems (IDS/IPS), deep packet inspection, payload manipulation
Exam Tip:

"HTTP/HTTPS traffic routing?" → ALB. "Ultra-low latency, TCP/UDP, static IP?" → NLB. "Network appliances (firewall, IDS)?" → GWLB. The old Classic Load Balancer (CLB) is deprecated — don't pick it on the exam.

Health Checks

Key Point:

Health checks are critical for ensuring high availability. An unhealthy instance is automatically removed from the load balancer's target pool. No manual intervention needed.

Advanced ELB Features

Sticky Sessions (Session Affinity)

Cross-Zone Load Balancing

SSL/TLS Termination

Exam Tip:

"How to manage SSL certificates for your load balancer?" → AWS Certificate Manager (ACM). "How to host multiple HTTPS sites on one ALB?" → SNI (Server Name Indication).

Auto Scaling Groups (ASG)

ASG Configuration

SettingDescription
Launch TemplateDefines instance configuration: AMI, instance type, key pair, security groups, user data, IAM role, EBS volumes
Minimum CapacityMinimum number of instances that must always be running
Desired CapacityNumber of instances you want running (ASG tries to maintain this)
Maximum CapacityMaximum number of instances the ASG can scale to
Key Point:

ASG uses a Launch Template (recommended) or Launch Configuration (legacy) to know what kind of EC2 instances to launch. The ASG respects min/desired/max capacity settings.

ASG Scaling Policies

Policy TypeDescriptionExample
Target Tracking ScalingSet a target metric value and ASG adjusts to maintain it. Simplest to set up."Keep average CPU utilization at 40%"
Simple / Step ScalingAdd/remove instances based on CloudWatch alarm thresholds. Step scaling allows different actions at different thresholds."When CPU > 70%, add 2 instances. When CPU < 30%, remove 1 instance."
Scheduled ScalingScale based on known usage patterns at specific times."Increase min capacity to 10 at 5 PM on Fridays" (for a known traffic spike)
Predictive ScalingUses machine learning to predict future traffic and schedule scaling ahead of time.AWS analyzes historical patterns and pre-provisions instances before demand arrives.

Common Scaling Metrics

Exam Tip:

"Easiest way to maintain CPU at a target value?" → Target Tracking Scaling. "Scale based on known schedule?" → Scheduled Scaling. "ML-based scaling before demand?" → Predictive Scaling. Remember: ASG + ELB = scalable & highly available architecture.

Architecture Summary

A well-architected, scalable, and highly available setup typically includes:

Key Point:

ELB + ASG is the foundational architecture pattern for scalable, fault-tolerant applications on AWS. The load balancer handles traffic distribution, and the ASG handles capacity management.