在 CloudFormation 中为 AWS Load Balancer v2 配置连接耗尽

Configure Connection Draining for AWS Load Balancer v2 in CloudFormation

This blog post (here specifically) 详细说明了如何使用 AWS::ElasticLoadBalancing::LoadBalancer 类型为 'classic' 版本 1 负载均衡器配置连接耗尽,如下所示:

"ElasticLoadBalancer": {
  "Type": "AWS::ElasticLoadBalancing::LoadBalancer",
  "Properties": {
    "ConnectionDrainingPolicy": {
      "Enabled": "true",
      "Timeout": "300"
    },
    ...
  }
}

如何使用类型为 AWS::ElasticLoadBalancingV2::LoadBalancer 的版本 2 负载平衡器执行此操作?

我最好的猜测来自 the documentation is that I should use LoadBalancerAttributes, but I can't find anything related to connection draining in the list of attributes here

在 Application Load Balancer(ELB V2) 中,它使用 TargetGroups and TargetGroupAttributes 配置,称为取消注册延迟,而不是连接耗尽。

deregistration_delay.timeout_seconds - The amount time for Elastic Load Balancing to wait before changing the state of a deregistering target from draining to unused. The range is 0-3600 seconds. The default value is 300 seconds.

   TargetGroup:
      Type: AWS::ElasticLoadBalancingV2::TargetGroup
      Properties:
        TargetGroupAttributes:
        - Key: deregistration_delay.timeout_seconds
          Value: '20'