Peak traffic on AWS hits limits you didn't set yourself: the ALB idle timeout, Lambda concurrency, NAT gateway ports and database connections from Lambda. These recipes show the error each limit throws and the setting that moves it. Start with Fix ALB 502 Bad Gateway and 504 Gateway Timeout.
- Fix ALB 502 Bad Gateway and 504 Gateway Timeout
Set each target's keep-alive above the ALB idle timeout and keep slow requests under it, so the load balancer stops answering peak traffic with 502 and 504.
- Fix Lambda TooManyRequestsException Rate Exceeded
Size Lambda concurrency from peak traffic and split it with reserved and provisioned concurrency, so critical functions stop throttling when traffic spikes.
- NAT Gateway ErrorPortAllocation and Port Exhaustion
Alert on ErrorPortAllocation and the signals that come before it, so you catch NAT gateway port exhaustion before outbound calls fail at peak.
- Fix Lambda RDS Too Many Connections with RDS Proxy
Put RDS Proxy between Lambda and RDS and cap concurrency to the proxy's pool, so a spike waits in a short queue instead of exhausting database connections.