After migrating EC2 instances to private subnets and routing internet traffic via a NAT gateway, long-running database queries to a public third-party database complete on the database side after 7 minutes but the client never receives responses. Which configuration change should the engineer make to resolve this?
Choose an answer
Tap an option to check your answer.
Correct answer: Enable TCP keepalive on the client EC2 instances with a value of less than 300 seconds..
Why this is the answer
The default TCP connection timeout for NAT Gateways is 350 seconds (5 minutes and 50 seconds). Since the database queries complete after 7 minutes (420 seconds), the NAT Gateway is timing out the connection before the response can be sent back to the client. Enabling TCP keepalive on the client EC2 instances with a value less than 350 seconds will send periodic packets, keeping the connection active and preventing the NAT Gateway from closing it prematurely. Configuring the NAT Gateway timeout is not an option as it's a fixed AWS service limit. Enabling enhanced networking improves network performance but doesn't address connection timeouts. Closing idle TCP connections would exacerbate the problem by terminating connections even faster.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed