更新网络负载均衡器侦听器的 TCP 空闲超时
对于通过网络负载均衡器发出的每个 TCP 请求,都将跟踪该连接的状态。如果客户端或目标通过连接发送数据的间隔超过空闲超时期限,则连接将关闭。
注意事项
-
TCP 流量的默认空闲超时值为 350 秒。
-
TLS 侦听器的连接空闲超时为 350 秒,且无法修改。
- Console
-
要更新 TCP 空闲超时
通过以下网址打开 Amazon EC2 控制台:https://console.aws.amazon.com/ec2/
。 -
在导航窗格中的负载平衡下,选择负载均衡器。
-
选中网络负载均衡器对应的复选框。
-
在侦听器选项卡上,选中 TCP 侦听器的复选框,然后依次选择操作、查看侦听器详细信息。
-
在侦听器详细信息页面的属性选项卡中,选择编辑。如果监听器使用 TCP 以外的协议,则此选项卡将不可用。
-
输入 TCP 空闲超时值,范围为 60 至 6000 秒。
-
选择保存更改。
- AWS CLI
-
要更新 TCP 空闲超时
使用带
tcp.idle_timeout.seconds属性的 modify-listener-attributes 命令。aws elbv2 modify-listener-attributes \ --listener-arnlistener-arn\ --attributes Key=tcp.idle_timeout.seconds,Value=500下面是示例输出。
{ "Attributes": [ { "Key": "tcp.idle_timeout.seconds", "Value": "500" } ] } - CloudFormation
-
要更新 TCP 空闲超时
更新 AWS::ElasticLoadBalancingV2::Listener 资源,以包含
tcp.idle_timeout.seconds侦听器属性。Resources: myTCPListener: Type: 'AWS::ElasticLoadBalancingV2::Listener' Properties: LoadBalancerArn: !Ref myLoadBalancer Protocol: TCP Port: 80 DefaultActions: - Type: forward TargetGroupArn: !Ref myTargetGroup ListenerAttributes: - Key: "tcp.idle_timeout.seconds" Value: "500"
更新侦听器
更新 TLS 侦听器