# NetworkTargetGroupProps

Properties for a new Network Target Group.

Extends: NetworkTargetGroupProps
Extends: BaseTargetGroupProps
Used as props by: NetworkTargetGroup

- Source: [`aws-elasticloadbalancingv2/lib/nlb/network-target-group.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-target-group.ts#L21)
- Type last changed: v2.31.0 · 6 Jul 2022

## Example

```ts
declare const vpc: ec2.Vpc;

const ipv4ApplicationTargetGroup = new elbv2.ApplicationTargetGroup(this, 'IPv4ApplicationTargetGroup', {
  vpc,
  port: 80,
  targetType: elbv2.TargetType.INSTANCE,
  ipAddressType: elbv2.TargetGroupIpAddressType.IPV4,
});

const ipv6ApplicationTargetGroup = new elbv2.ApplicationTargetGroup(this, 'Ipv6ApplicationTargetGroup', {
  vpc,
  port: 80,
  targetType: elbv2.TargetType.INSTANCE,
  ipAddressType: elbv2.TargetGroupIpAddressType.IPV6,
});

const ipv4NetworkTargetGroup = new elbv2.NetworkTargetGroup(this, 'IPv4NetworkTargetGroup', {
  vpc,
  port: 80,
  targetType: elbv2.TargetType.INSTANCE,
  ipAddressType: elbv2.TargetGroupIpAddressType.IPV4,
});

const ipv6NetworkTargetGroup = new elbv2.NetworkTargetGroup(this, 'Ipv6NetworkTargetGroup', {
  vpc,
  port: 80,
  targetType: elbv2.TargetType.INSTANCE,
  ipAddressType: elbv2.TargetGroupIpAddressType.IPV6,
});
```

## Properties

- `connectionTermination`: boolean = false — Indicates whether the load balancer terminates connections at the end of the deregistration timeout.

- `crossZoneEnabled`: boolean — Indicates whether cross zone load balancing is enabled.

  **Default:** use load balancer configuration

- `deregistrationDelay`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = 300 — The amount of time for Elastic Load Balancing to wait before deregistering a target.

  The range is 0-3600 seconds.

- `healthCheck`: [HealthCheck](/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.HealthCheck.html) — Health check configuration.

  **Default:** The default value for each property in this configuration varies depending on the target.

- `ipAddressType`: [TargetGroupIpAddressType](/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.TargetGroupIpAddressType.html) — The type of IP addresses of the targets registered with the target group.

  **Default:** undefined - ELB defaults to IPv4

- `port`: number (required) — The port on which the target receives traffic.

- `preserveClientIp`: boolean — Indicates whether client IP preservation is enabled.

  **Default:** false if the target group type is IP address and the target group protocol is TCP or TLS. Otherwise, true.

- `protocol`: [Protocol](/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.Protocol.html) = TCP — Protocol for target group, expects TCP, TLS, UDP, or TCP_UDP.

- `proxyProtocolV2`: boolean = false — Indicates whether Proxy Protocol version 2 is enabled.

- `targetGroupHealth`: [TargetGroupHealth](/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.TargetGroupHealth.html) — Configuring target group health.

  **Default:** use default configuration

- `targetGroupName`: string — The name of the target group.

  **Default:** Automatically generated.

  This name must be unique per region per account, can have a maximum of
  32 characters, must contain only alphanumeric characters or hyphens, and
  must not begin or end with a hyphen.

- `targets`: [INetworkLoadBalancerTarget](/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.INetworkLoadBalancerTarget.html)[] — The targets to add to this target group.

  **Default:** No targets.

  Can be `Instance`, `IPAddress`, or any self-registering load balancing
  target. If you use either `Instance` or `IPAddress` as targets, all
  target must be of the same type.

- `targetType`: [TargetType](/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.TargetType.html) — The type of targets registered to this TargetGroup, either IP or Instance.

  **Default:** Determined automatically.

  All targets registered into the group must be of this type. If you
  register targets to the TargetGroup in the CDK app, the TargetType is
  determined automatically.

- `vpc`: [IVpc](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) = undefined — The virtual private cloud (VPC).

  only if `TargetType` is `Ip` or `InstanceId`
