Skip to content
v2.278.0

NetworkTargetGroupProps Struct ​

Properties for a new Network Target Group.

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,
});
python
# vpc: ec2.Vpc


ipv4_application_target_group = elbv2.ApplicationTargetGroup(self, "IPv4ApplicationTargetGroup",
    vpc=vpc,
    port=80,
    target_type=elbv2.TargetType.INSTANCE,
    ip_address_type=elbv2.TargetGroupIpAddressType.IPV4
)

ipv6_application_target_group = elbv2.ApplicationTargetGroup(self, "Ipv6ApplicationTargetGroup",
    vpc=vpc,
    port=80,
    target_type=elbv2.TargetType.INSTANCE,
    ip_address_type=elbv2.TargetGroupIpAddressType.IPV6
)

ipv4_network_target_group = elbv2.NetworkTargetGroup(self, "IPv4NetworkTargetGroup",
    vpc=vpc,
    port=80,
    target_type=elbv2.TargetType.INSTANCE,
    ip_address_type=elbv2.TargetGroupIpAddressType.IPV4
)

ipv6_network_target_group = elbv2.NetworkTargetGroup(self, "Ipv6NetworkTargetGroup",
    vpc=vpc,
    port=80,
    target_type=elbv2.TargetType.INSTANCE,
    ip_address_type=elbv2.TargetGroupIpAddressType.IPV6
)
java
Vpc vpc;


ApplicationTargetGroup ipv4ApplicationTargetGroup = ApplicationTargetGroup.Builder.create(this, "IPv4ApplicationTargetGroup")
        .vpc(vpc)
        .port(80)
        .targetType(TargetType.INSTANCE)
        .ipAddressType(TargetGroupIpAddressType.IPV4)
        .build();

ApplicationTargetGroup ipv6ApplicationTargetGroup = ApplicationTargetGroup.Builder.create(this, "Ipv6ApplicationTargetGroup")
        .vpc(vpc)
        .port(80)
        .targetType(TargetType.INSTANCE)
        .ipAddressType(TargetGroupIpAddressType.IPV6)
        .build();

NetworkTargetGroup ipv4NetworkTargetGroup = NetworkTargetGroup.Builder.create(this, "IPv4NetworkTargetGroup")
        .vpc(vpc)
        .port(80)
        .targetType(TargetType.INSTANCE)
        .ipAddressType(TargetGroupIpAddressType.IPV4)
        .build();

NetworkTargetGroup ipv6NetworkTargetGroup = NetworkTargetGroup.Builder.create(this, "Ipv6NetworkTargetGroup")
        .vpc(vpc)
        .port(80)
        .targetType(TargetType.INSTANCE)
        .ipAddressType(TargetGroupIpAddressType.IPV6)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
Vpc vpc;


var ipv4ApplicationTargetGroup = new ApplicationTargetGroup(this, "IPv4ApplicationTargetGroup", new ApplicationTargetGroupProps {
    Vpc = vpc,
    Port = 80,
    TargetType = TargetType.INSTANCE,
    IpAddressType = TargetGroupIpAddressType.IPV4
});

var ipv6ApplicationTargetGroup = new ApplicationTargetGroup(this, "Ipv6ApplicationTargetGroup", new ApplicationTargetGroupProps {
    Vpc = vpc,
    Port = 80,
    TargetType = TargetType.INSTANCE,
    IpAddressType = TargetGroupIpAddressType.IPV6
});

var ipv4NetworkTargetGroup = new NetworkTargetGroup(this, "IPv4NetworkTargetGroup", new NetworkTargetGroupProps {
    Vpc = vpc,
    Port = 80,
    TargetType = TargetType.INSTANCE,
    IpAddressType = TargetGroupIpAddressType.IPV4
});

var ipv6NetworkTargetGroup = new NetworkTargetGroup(this, "Ipv6NetworkTargetGroup", new NetworkTargetGroupProps {
    Vpc = vpc,
    Port = 80,
    TargetType = TargetType.INSTANCE,
    IpAddressType = TargetGroupIpAddressType.IPV6
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var vpc Vpc


ipv4ApplicationTargetGroup := elbv2.NewApplicationTargetGroup(this, jsii.String("IPv4ApplicationTargetGroup"), &ApplicationTargetGroupProps{
	Vpc: Vpc,
	Port: jsii.Number(80),
	TargetType: elbv2.TargetType_INSTANCE,
	IpAddressType: elbv2.TargetGroupIpAddressType_IPV4,
})

ipv6ApplicationTargetGroup := elbv2.NewApplicationTargetGroup(this, jsii.String("Ipv6ApplicationTargetGroup"), &ApplicationTargetGroupProps{
	Vpc: Vpc,
	Port: jsii.Number(80),
	TargetType: elbv2.TargetType_INSTANCE,
	IpAddressType: elbv2.TargetGroupIpAddressType_IPV6,
})

ipv4NetworkTargetGroup := elbv2.NewNetworkTargetGroup(this, jsii.String("IPv4NetworkTargetGroup"), &NetworkTargetGroupProps{
	Vpc: Vpc,
	Port: jsii.Number(80),
	TargetType: elbv2.TargetType_INSTANCE,
	IpAddressType: elbv2.TargetGroupIpAddressType_IPV4,
})

ipv6NetworkTargetGroup := elbv2.NewNetworkTargetGroup(this, jsii.String("Ipv6NetworkTargetGroup"), &NetworkTargetGroupProps{
	Vpc: Vpc,
	Port: jsii.Number(80),
	TargetType: elbv2.TargetType_INSTANCE,
	IpAddressType: elbv2.TargetGroupIpAddressType_IPV6,
})

Properties ​

connectionTerminationoptionalbooleanconnection_terminationoptionalboolconnectionTerminationoptionalBooleanConnectionTerminationoptionalboolConnectionTerminationoptional*bool = false #
Indicates whether the load balancer terminates connections at the end of the deregistration timeout.
crossZoneEnabledoptionalbooleancross_zone_enabledoptionalboolcrossZoneEnabledoptionalBooleanCrossZoneEnabledoptionalboolCrossZoneEnabledoptional*bool #
Indicates whether cross zone load balancing is enabled.

Default: use load balancer configuration

deregistrationDelayoptionalDurationderegistration_delayoptionalDurationderegistrationDelayoptionalDurationDeregistrationDelayoptionalDurationDeregistrationDelayoptionalDuration = 300 #
The amount of time for Elastic Load Balancing to wait before deregistering a target.

The range is 0-3600 seconds.

healthCheckoptionalHealthCheckhealth_checkoptionalHealthCheckhealthCheckoptionalHealthCheckHealthCheckoptionalHealthCheckHealthCheckoptionalHealthCheck #
Health check configuration.

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

ipAddressTypeoptionalTargetGroupIpAddressTypeip_address_typeoptionalTargetGroupIpAddressTypeipAddressTypeoptionalTargetGroupIpAddressTypeIpAddressTypeoptionalTargetGroupIpAddressTypeIpAddressTypeoptionalTargetGroupIpAddressType #
The type of IP addresses of the targets registered with the target group.

Default: undefined - ELB defaults to IPv4

portnumberportint | floatportNumberPortdoublePort*float64 required #
The port on which the target receives traffic.
preserveClientIpoptionalbooleanpreserve_client_ipoptionalboolpreserveClientIpoptionalBooleanPreserveClientIpoptionalboolPreserveClientIpoptional*bool #
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.

protocoloptionalProtocolprotocoloptionalProtocolprotocoloptionalProtocolProtocoloptionalProtocolProtocoloptionalProtocol = TCP #
Protocol for target group, expects TCP, TLS, UDP, or TCP_UDP.
proxyProtocolV2optionalbooleanproxy_protocol_v2optionalboolproxyProtocolV2optionalBooleanProxyProtocolV2optionalboolProxyProtocolV2optional*bool = false #
Indicates whether Proxy Protocol version 2 is enabled.
targetGroupHealthoptionalTargetGroupHealthtarget_group_healthoptionalTargetGroupHealthtargetGroupHealthoptionalTargetGroupHealthTargetGroupHealthoptionalTargetGroupHealthTargetGroupHealthoptionalTargetGroupHealth #
Configuring target group health.

Default: use default configuration

targetGroupNameoptionalstringtarget_group_nameoptionalstrtargetGroupNameoptionalStringTargetGroupNameoptionalstringTargetGroupNameoptional*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.

targetsoptionalINetworkLoadBalancerTarget[]targetsoptionaltyping.List[INetworkLoadBalancerTarget]targetsoptionalList<INetworkLoadBalancerTarget>TargetsoptionalINetworkLoadBalancerTarget[]Targetsoptional*[]INetworkLoadBalancerTarget #
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.

targetTypeoptionalTargetTypetarget_typeoptionalTargetTypetargetTypeoptionalTargetTypeTargetTypeoptionalTargetTypeTargetTypeoptionalTargetType #
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.

vpcoptionalIVpcvpcoptionalIVpcvpcoptionalIVpcVpcoptionalIVpcVpcoptionalIVpc = undefined #
The virtual private cloud (VPC).

only if TargetType is Ip or InstanceId