Q: What is an API Gateway, and how does it differ from a standard Load Balancer?
A standard Load Balancer (like a Network Load Balancer) primarily operates at Layer 4, simply forwarding raw TCP packets to backend IPs.
Want to master this scenario in a live sandbox? The Linux Foundation's Certified System Administrator (LFCS) & SRE Track covers this exact problem with hands-on terminal drills.
🛠️ Production Runbook & Step-by-Step Resolution
Direct Answer: "When an interviewer asks about this scenario, I explain how we balanced incident response with long-term prevention. The interviewer is testing: OSI Layer 7 routing, API management, authentication offloading.. I structure my answer around systematic triage first, root cause analysis second, and permanent remediation third."
Production Solution & Architecture
A standard Load Balancer (like a Network Load Balancer) primarily operates at Layer 4, simply forwarding raw TCP packets to backend IPs. An API Gateway operates at Layer 7 and is specifically designed to manage API logic. While it performs load balancing, its primary job is routing HTTP requests based on URL paths (/users goes to Service A, /billing to Service B), handling rate limiting, request validation, payload transformation, and acting as a centralized authentication layer (e.g., verifying JWT tokens) before traffic ever reaches the backend microservices.
- Immediate Triage: A standard Load Balancer (like a Network Load Balancer) primarily operates at Layer 4, simply f
- Run targeted verification commands before modifying configuration.
- Automate permanent guardrails (CI check, alerts, IaC policy) to prevent recurrence.
Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:
- Confusing ALB 502 Bad Gateway (target connection reset) with 504 Gateway Timeout (upstream response timeout) when configuring General Gateway differ 502 indicates the backend target closed the TCP connection prematurely or returned malformed HTTP, whereas 504 means the target failed to respond before idle timeout.
- Setting target deregistration delay to zero instead of allowing connection draining when configuring General Gateway differ Instant target deregistration severs in-flight HTTP requests during auto-scaling scale-in or rolling deployments, causing immediate user-facing drops.
-
Failing to query CloudWatch ELB metrics (
HTTPCode_ELB_5XXvsHTTPCode_Target_5XX) during load balancer outages when configuring General Gateway differ Comparing load balancer generated errors against target generated errors immediately isolates whether the issue lies in the proxy tier or application runtime. - Overlooking Security Group rules on backend EC2/ECS instances that block health check traffic from the ALB when configuring General Gateway differ Target instances must explicitly permit inbound HTTP/HTTPS traffic from the ALB security group on the configured container/application port.