cloud networking ai_generated true

Connection drops after 350s idle — NAT Gateway idle timeout

ID: cloud/aws-nat-gateway-idle-timeout

Also available as: JSON · Markdown
85%Fix Rate
88%Confidence
4Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
any active

Root Cause

AWS NAT Gateway silently drops idle TCP connections after 350 seconds.

generic

Workarounds

  1. 92% success Enable TCP keepalive with interval under 350 seconds
    sysctl -w net.ipv4.tcp_keepalive_time=120

    Sources: https://docs.aws.amazon.com/vpc/latest/userguide/nat-gateway-troubleshooting.html

  2. 88% success Use VPC endpoints to bypass NAT Gateway entirely
    VPC endpoints route traffic internally; no NAT Gateway involvement

    Sources: https://docs.aws.amazon.com/vpc/latest/privatelink/what-is-privatelink.html

Dead Ends

Common approaches that don't work:

  1. Increase OS TCP timeout beyond 350s 90% fail

    NAT Gateway drops the mapping regardless of OS settings

  2. Use longer connection pool idle timeout 80% fail

    Application-level idle timeout does not prevent NAT Gateway from dropping the mapping