# AWS Public Endpoint 340-second idle timeout

Use this topic only for TiDB Cloud Starter or Essential instances hosted on AWS
when the customer connects through a Public Endpoint and the connection is
terminated at approximately five minutes of connection idleness.

- The official Starter/Essential limitations document states that AWS Global
  Accelerator imposes a 340-second idle timeout on AWS Public Endpoint
  connections. It also states that TCP keep-alive packets cannot keep that
  connection open for the same reason.
- A query that runs longer than five minutes is not automatically affected: the
  relevant condition is an otherwise idle Public Endpoint connection. Match the
  endpoint type, cloud, plan, and observed termination timing before applying
  this explanation.
- Changing TiDB `@@max_execution_time` does not change the AWS Global
  Accelerator connection idle timeout. That variable controls TiDB statement
  execution; it is not a network-connection lifetime setting.
- For a long-running workload that must avoid this Public Endpoint boundary,
  use a Private Endpoint backed by AWS PrivateLink and run the SQL client or its
  controlled relay from the applicable VPC/private path. Do not claim that
  enabling TCP keep-alive fixes the AWS Public Endpoint limit.
- If the instance is not Starter/Essential on AWS, does not use a Public
  Endpoint, or disconnects at a materially different duration, do not force the
  340-second explanation. Check the client's statement/query timeout, TiDB
  `@@max_execution_time`, and an actual connection/runtime incident separately.
- This is a direct product-capability answer. Query tuning can be offered only
  as optional follow-up when the customer also wants the statement to finish
  faster; it is not the fix for the Public Endpoint connection boundary.

Official references:

- https://docs.pingcap.com/tidbcloud/serverless-limitations/
- https://docs.pingcap.com/tidbcloud/set-up-private-endpoint-connections-serverless/
