AWS Certified Solutions Architect: ASG & ELB

In the AWS ecosystem, achieving High Availability (HA) and Fault Tolerance is impossible without mastering Elastic Load Balancing (ELB) and Amazon EC2 Auto Scaling. Together, they ensure your application can handle varying traffic loads while maintaining a seamless user experience.

The “Busy Restaurant” Analogy

Imagine a popular restaurant. The Elastic Load Balancer is the Host at the front door; they greet every guest and direct them to an available table so no single waiter is overwhelmed. Auto Scaling is the Restaurant Manager; when they see a line forming out the door, they call in more waiters (Scale Out). When the lunch rush ends and the restaurant is empty, they send waiters home to save on labor costs (Scale In).

Core Concepts & Well-Architected Framework

  • Reliability: ELB performs health checks. If an instance fails, the ELB stops sending traffic to it, and ASG replaces it automatically.
  • Performance Efficiency: ASG uses Dynamic Scaling policies (like Target Tracking) to ensure you have exactly the right amount of compute power based on metrics like CPU utilization.
  • Cost Optimization: By scaling in during low-demand periods, you avoid paying for idle EC2 resources.

Service Comparison: Choosing Your Balancer

Feature Application LB (ALB) Network LB (NLB) Gateway LB (GWLB)
OSI Layer Layer 7 (HTTP/HTTPS) Layer 4 (TCP/UDP/TLS) Layer 3 (IP Packets)
Best For Microservices & Containers Ultra-low latency / Gaming Third-party Firewalls/IDS
Routing Path, Host, Query String IP, Port Transparent Inspection
Static IP No (Uses DNS Name) Yes (Elastic IP per AZ) No

Scenario-Based Decision Matrix

If the requirement is…

  • …routing based on URL path (e.g., /api vs /images): Use ALB.
  • …handling millions of requests per second with volatile patterns: Use NLB.
  • …deploying a fleet of virtual appliances (Firewalls): Use GWLB.
  • …ensuring minimum 2 instances are always running: Set ASG Desired Capacity to 2.
  • …preventing “thrashing” (rapid scaling up/down): Increase ASG Cooldown Period.

Exam Tips: Golden Nuggets

  • Cross-Zone Load Balancing: Always enabled by default for ALB; disabled by default for NLB. It ensures traffic is distributed evenly across all instances in all enabled AZs.
  • Termination Policies: ASG typically deletes the instance in the AZ with the most instances first, selecting the one with the oldest Launch Configuration.
  • Health Checks: If using ASG with ELB, ensure the ASG uses “ELB Health Checks” instead of just “EC2 Health Checks” to catch 404/5xx application errors.
  • Pre-Warming: ALB needs time to scale to sudden spikes; NLB does not (it handles spikes instantly). For extreme launches, contact AWS to “pre-warm” your ALB.

The Elastic Architecture Flow

Users ELB (ALB) Auto Scaling Group Instance A (Healthy) Instance B (Healthy) Instance C (Scaling Out…)

🚀 Key Services

Target Groups: Logical grouping of resources (EC2, Lambda, IP) that ELB routes to.

Launch Templates: The “blueprint” for ASG (AMI ID, Instance Type, Key Pair).

Scaling Policies: Predictable (Scheduled) vs Reactive (Target Tracking).

⚠️ Common Pitfalls

Sticky Sessions: Can cause uneven load distribution if one client sends massive traffic.

Grace Period: Setting it too short might kill instances before they finish booting.

AZ Imbalance: ASG always tries to rebalance across AZs, which might trigger unexpected terminations.

💡 Quick Patterns

Internet-Facing: ELB in Public Subnet, EC2s in Private Subnet (Security Best Practice).

Internal ELB: Used for communication between app tiers (e.g., Web tier to App tier).

Multi-Region: ELB/ASG are Regional. Use Route 53 to balance between regions.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top