A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.aws.amazon.com/elasticloadbalancing/latest/network/edit-target-group-attributes.html below:

Edit target group attributes for your Network Load Balancer

Edit target group attributes for your Network Load Balancer

After you create a target group for your Network Load Balancer, you can edit its target group attributes.

Client IP preservation

Network Load Balancers can preserve the source IP addresses of clients when routing requests to backend targets. When you disable client IP preservation, the source IP address is the private IP address of the Network Load Balancer.

By default, client IP preservation is enabled (and can't be disabled) for instance and IP type target groups with UDP and TCP_UDP protocols. However, you can enable or disable client IP preservation for TCP and TLS target groups using the preserve_client_ip.enabled target group attribute.

Default settings When client IP preservation is enabled

The following table describes the IP addresses that targets receive when client IP preservation is enabled.

Targets IPv4 client requests IPv6 client requests Instance type (IPv4) Client IPv4 address Load balancer IPv4 address IP type (IPv4) Client IPv4 address Load balancer IPv4 address IP type (IPv6) Load balancer IPv6 address Client IPv6 address When client IP preservation is disabled

The following table describes the IP addresses that targets receive when client IP preservation is disabled.

Targets IPv4 client requests IPv6 client requests Instance type (IPv4) Load balancer IPv4 address Load balancer IPv4 address IP type (IPv4) Load balancer IPv4 address Load balancer IPv4 address IP type (IPv6) Load balancer IPv6 address Load balancer IPv6 address Requirements and considerations
Console
To modify client IP preservation
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. On the navigation pane, under Load Balancing, choose Target Groups.

  3. Choose the name of the target group to open its details page.

  4. On the Attributes tab, choose Edit and find the Traffic configuration pane.

  5. To enable client IP preservation, turn on Preserve client IP addresses. To disable client IP preservation, turn off Preserve client IP addresses.

  6. Choose Save changes.

AWS CLI
To enable client IP preservation

Use the modify-target-group-attributes command with the preserve_client_ip.enabled attribute.

aws elbv2 modify-target-group-attributes \
    --target-group-arn target-group-arn \
    --attributes "Key=preserve_client_ip.enabled,Value=true"
CloudFormation
To enable client IP preservation

Update the AWS::ElasticLoadBalancingV2::TargetGroup resource to include the preserve_client_ip.enabled attribute.

Resources:
  myTargetGroup:
    Type: 'AWS::ElasticLoadBalancingV2::TargetGroup'
    Properties:
      Name: my-target-group
      Protocol: TCP
      Port: 80
      TargetType: ip
      VpcId: !Ref myVPC
      TargetGroupAttributes: 
        - Key: "preserve_client_ip.enabled"
          Value: "true"
Deregistration delay

When a target is deregistered, the load balancer stops creating new connections to the target. The load balancer uses connection draining to ensure that in-flight traffic completes on the existing connections. If the deregistered target stays healthy and an existing connection is not idle, the load balancer can continue to send traffic to the target. To ensure that existing connections are closed, you can do one of the following: enable the target group attribute for connection termination, ensure that the instance is unhealthy before you deregister it, or periodically close client connections.

The initial state of a deregistering target is draining, during which the target will stop receiving new connections. However, the target may still receive connections due to configuration propagation delay. By default, the load balancer changes the state of a deregistering target to unused after 300 seconds. To change the amount of time that the load balancer waits before changing the state of a deregistering target to unused, update the deregistration delay value. We recommend that you specify a value of at least 120 seconds to ensure that requests are completed.

If you enable the target group attribute for connection termination, connections to deregistered targets are closed shortly after the end of the deregistration timeout.

Console
To modify the deregistration delay attributes
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. On the navigation pane, under Load Balancing, choose Target Groups.

  3. Choose the name of the target group to open its details page.

  4. On the Attributes tab, choose Edit.

  5. To change the deregistration timeout, enter a new value for Deregistration delay. To ensure that existing connections are closed after you deregister targets, select Terminate connections on deregistration.

  6. Choose Save changes.

AWS CLI
To modify the deregistration delay attributes

Use the modify-target-group-attributes command with the deregistration_delay.timeout_seconds and deregistration_delay.connection_termination.enabled attributes.

aws elbv2 modify-target-group-attributes \
    --target-group-arn target-group-arn \
    --attributes \
      "Key=deregistration_delay.timeout_seconds,Value=60" \
      "Key=deregistration_delay.connection_termination.enabled,Value=true"
CloudFormation
To modify the deregistration delay attributes

Update the AWS::ElasticLoadBalancingV2::TargetGroup resource to include the deregistration_delay.timeout_seconds and deregistration_delay.connection_termination.enabled attributes.

Resources:
  myTargetGroup:
    Type: 'AWS::ElasticLoadBalancingV2::TargetGroup'
    Properties:
      Name: my-target-group
      Protocol: TCP
      Port: 80
      TargetType: ip
      VpcId: !Ref myVPC
      TargetGroupAttributes: 
        - Key: "deregistration_delay.timeout_seconds"
          Value: "60" 
        - Key: "deregistration_delay.connection_termination.enabled"
          Value: "true"
Proxy protocol

Network Load Balancers use proxy protocol version 2 to send additional connection information such as the source and destination. Proxy protocol version 2 provides a binary encoding of the proxy protocol header. With TCP listeners, the load balancer prepends a proxy protocol header to the TCP data. It does not discard or overwrite any existing data, including any incoming proxy protocol headers sent by the client or any other proxies, load balancers, or servers in the network path. Therefore, it is possible to receive more than one proxy protocol header. Also, if there is another network path to your targets outside of your Network Load Balancer, the first proxy protocol header might not be the one from your Network Load Balancer.

If you specify targets by IP address, the source IP addresses provided to your applications depend on the protocol of the target group as follows:

If you specify targets by instance ID, the source IP addresses provided to your applications are the client IP addresses. However, if you prefer, you can enable proxy protocol and get the client IP addresses from the proxy protocol header.

TLS listeners do not support incoming connections with proxy protocol headers sent by the client or any other proxies.

Health check connections

After you enable proxy protocol, the proxy protocol header is also included in health check connections from the load balancer. However, with health check connections, the client connection information is not sent in the proxy protocol header.

Targets can fail health checks if they can't parse the proxy protocol header. For example, they might return the following error: HTTP 400: Bad request.

VPC endpoint services

For traffic coming from service consumers through a VPC endpoint service, the source IP addresses provided to your applications are the private IP addresses of the load balancer nodes. If your applications need the IP addresses of the service consumers, enable proxy protocol and get them from the proxy protocol header.

The proxy protocol header also includes the ID of the endpoint. This information is encoded using a custom Type-Length-Value (TLV) vector as follows.

Field Length (in octets) Description

Type

1

PP2_TYPE_AWS (0xEA)

Length

2

The length of value

Value

1

PP2_SUBTYPE_AWS_VPCE_ID (0x01)

variable (value length minus 1) The ID of the endpoint

For an example that parses TLV type 0xEA, see https://github.com/aws/elastic-load-balancing-tools/tree/master/proprot.

Enable proxy protocol

Before you enable proxy protocol on a target group, make sure that your applications expect and can parse the proxy protocol v2 header, otherwise, they might fail. For more information, see PROXY protocol versions 1 and 2.

Console
To enable proxy protocol version 2
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. On the navigation pane, under Load Balancing, choose Target Groups.

  3. Choose the name the target group to open its details page.

  4. On the Attributes tab, choose Edit.

  5. On the Edit attributes page, select Proxy protocol v2.

  6. Choose Save changes.

AWS CLI
To enable proxy protocol version 2

Use the modify-target-group-attributes command with the proxy_protocol_v2.enabled attribute.

aws elbv2 modify-target-group-attributes \
    --target-group-arn target-group-arn \
    --attributes "Key=proxy_protocol_v2.enabled,Value=true"
CloudFormation
To enable proxy protocol version 2

Update the AWS::ElasticLoadBalancingV2::TargetGroup resource to include the proxy_protocol_v2.enabled attribute.

Resources:
  myTargetGroup:
    Type: 'AWS::ElasticLoadBalancingV2::TargetGroup'
    Properties:
      Name: my-target-group
      Protocol: TCP
      Port: 80
      TargetType: ip
      VpcId: !Ref myVPC
      TargetGroupAttributes: 
        - Key: "proxy_protocol_v2.enabled"
          Value: "true"
Sticky sessions

Sticky sessions are a mechanism to route client traffic to the same target in a target group. This is useful for servers that maintain state information in order to provide a continuous experience to clients.

Considerations
Console
To enable sticky sessions
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. On the navigation pane, under Load Balancing, choose Target Groups.

  3. Choose the name of the target group to open its details page.

  4. On the Attributes tab, choose Edit.

  5. Under Target selection configuration, turn on Stickiness.

  6. Choose Save changes.

AWS CLI
To enable sticky sessions

Use the modify-target-group-attributes command with the stickiness.enabled attribute.

aws elbv2 modify-target-group-attributes \
    --target-group-arn target-group-arn \
    --attributes "Key=stickiness.enabled,Value=true"
CloudFormation
To enable sticky sessions

Update the AWS::ElasticLoadBalancingV2::TargetGroup resource to include the stickiness.enabled attribute.

Resources:
  myTargetGroup:
    Type: 'AWS::ElasticLoadBalancingV2::TargetGroup'
    Properties:
      Name: my-target-group
      Protocol: TCP
      Port: 80
      TargetType: ip
      VpcId: !Ref myVPC
      TargetGroupAttributes: 
        - Key: "stickiness.enabled"
          Value: "true"
Cross-zone load balancing for target groups

The nodes for your load balancer distribute requests from clients to registered targets. When cross-zone load balancing is on, each load balancer node distributes traffic across the registered targets in all registered Availability Zones. When cross-zone load balancing is off, each load balancer node distributes traffic across only the registered targets in its Availability Zone. This could be used if zonal failure domains are preferred over regional, ensuring that a healthy zone isn't impacted by an unhealthy zone, or for overall latency improvements.

With Network Load Balancers, cross-zone load balancing is disabled by default at the load balancer level, bit you can enable it at any time. For target groups, the default is to use the load balancer setting, but you can override the default by explicitly enabling or disabling cross-zone load balancing at the target group level.

Considerations

For more information about enabling cross-zone load balancing at the load balancer level, see Cross-zone load balancing.

Console
To enable cross-zone load balancing for a target group
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. On the navigation pane, under Load Balancing, select Target Groups.

  3. Select the name of the target group to open its details page.

  4. On the Attributes tab, choose Edit.

  5. On the Edit target group attributes page, select On for Cross-zone load balancing.

  6. Choose Save changes.

AWS CLI
To enable cross-zone load balancing for a target group

Use the modify-target-group-attributes command with the load_balancing.cross_zone.enabled attribute.

aws elbv2 modify-target-group-attributes \
    --target-group-arn target-group-arn \
    --attributes "Key=load_balancing.cross_zone.enabled,Value=true"
CloudFormation
To enable cross-zone load balancing for a target group

Update the AWS::ElasticLoadBalancingV2::TargetGroup resource to include the load_balancing.cross_zone.enabled attribute.

Resources:
  myTargetGroup:
    Type: 'AWS::ElasticLoadBalancingV2::TargetGroup'
    Properties:
      Name: my-target-group
      Protocol: TCP
      Port: 80
      TargetType: ip
      VpcId: !Ref myVPC
      TargetGroupAttributes: 
        - Key: "load_balancing.cross_zone.enabled"
          Value: "true"
Connection termination for unhealthy targets

Connection termination is enabled by default. When the target of a Network Load Balancer fails the configured health checks and is deemed unhealthy, the load balancer terminates established connections and stops routing new connections to the target. With connection termination disabled the target is still considered unhealthy and won't receive new connections, but established connections are kept active, allowing them to gracefully close.

Connection termination for unhealthy targets is configured at the target group level.

Console
To modify the connection termination attribute
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the navigation pane, under Load Balancing, choose Target Groups.

  3. Choose the name of the target group to open its details page.

  4. On the Attributes tab, choose Edit.

  5. Under Target unhealthy state management, choose whether Terminate connections when targets become unhealthy is enabled or disabled.

  6. Choose Save changes.

AWS CLI
To disable the connection termination attribute

Use the modify-target-group-attributes command with the target_health_state.unhealthy.connection_termination.enabled attribute.

aws elbv2 modify-target-group-attributes \
    --target-group-arn target-group-arn \
    --attributes "Key=target_health_state.unhealthy.connection_termination.enabled,Value=false"
CloudFormation
To disable the connection termination attribute

Update the AWS::ElasticLoadBalancingV2::TargetGroup resource to include the target_health_state.unhealthy.connection_termination.enabled attribute.

Resources:
  myTargetGroup:
    Type: 'AWS::ElasticLoadBalancingV2::TargetGroup'
    Properties:
      Name: my-target-group
      Protocol: TCP
      Port: 80
      TargetType: ip
      VpcId: !Ref myVPC
      TargetGroupAttributes: 
        - Key: "target_health_state.unhealthy.connection_termination.enabled"
          Value: "false"
Unhealthy draining interval

Targets in the unhealthy.draining state are considered unhealthy, do not receive new connections, but retain established connections for the configured interval. The unhealthy connection interval determines the amount of time the target remains in the unhealthy.draining state before its state becomes unhealthy. If the target passes health checks during the unhealthy connection interval, its state becomes healthy again. If a deregistration is triggered, the targets state becomes draining and the deregistration delay timeout begins.

Requirement

Connection termination must be disabled before enabling unhealthy draining interval.

Console
To modify the unhealthy draining interval
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the navigation pane, under Load Balancing, choose Target Groups.

  3. Choose the name of the target group to open its details page.

  4. On the Attributes tab, choose Edit.

  5. Under Target unhealthy state management, make sure Terminate connections when targets become unhealthy is turned off.

  6. Enter a value for Unhealthy draining interval.

  7. Choose Save changes.

AWS CLI
To modify the unhealthy draining interval

Use the modify-target-group-attributes command with the target_health_state.unhealthy.draining_interval_seconds attribute.

aws elbv2 modify-target-group-attributes \
    --target-group-arn target-group-arn \
    --attributes "Key=target_health_state.unhealthy.draining_interval_seconds,Value=60"
CloudFormation
To modify the unhealthy draining interval

Update the AWS::ElasticLoadBalancingV2::TargetGroup resource to include the target_health_state.unhealthy.draining_interval_seconds attribute.

Resources:
  myTargetGroup:
    Type: 'AWS::ElasticLoadBalancingV2::TargetGroup'
    Properties:
      Name: my-target-group
      Protocol: TCP
      Port: 80
      TargetType: ip
      VpcId: !Ref myVPC
      TargetGroupAttributes: 
        - Key: "target_health_state.unhealthy.draining_interval_seconds"
          Value: "60"

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4