interface AddNetworkTargetsProps
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.ElasticLoadBalancingV2.AddNetworkTargetsProps |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awselasticloadbalancingv2#AddNetworkTargetsProps |
Java | software.amazon.awscdk.services.elasticloadbalancingv2.AddNetworkTargetsProps |
Python | aws_cdk.aws_elasticloadbalancingv2.AddNetworkTargetsProps |
TypeScript (source) | aws-cdk-lib » aws_elasticloadbalancingv2 » AddNetworkTargetsProps |
Properties for adding new network targets to a listener.
Example
declare const vpc: ec2.Vpc;
declare const asg: autoscaling.AutoScalingGroup;
// Create the load balancer in a VPC. 'internetFacing' is 'false'
// by default, which creates an internal load balancer.
const lb = new elbv2.NetworkLoadBalancer(this, 'LB', {
vpc,
internetFacing: true,
});
// Add a listener on a particular port.
const listener = lb.addListener('Listener', {
port: 443,
});
// Add targets on a particular port.
listener.addTargets('AppFleet', {
port: 443,
targets: [asg]
});
Properties
| Name | Type | Description |
|---|---|---|
| port | number | The port on which the target receives traffic. |
| deregistration | Duration | The amount of time for Elastic Load Balancing to wait before deregistering a target. |
| health | Health | Health check configuration. |
| preserve | boolean | Indicates whether client IP preservation is enabled. |
| protocol? | Protocol | Protocol for target group, expects TCP, TLS, UDP, or TCP_UDP. |
| proxy | boolean | Indicates whether Proxy Protocol version 2 is enabled. |
| target | string | The name of the target group. |
| targets? | INetwork[] | The targets to add to this target group. |
port
Type:
number
The port on which the target receives traffic.
deregistrationDelay?
Type:
Duration
(optional, default: Duration.minutes(5))
The amount of time for Elastic Load Balancing to wait before deregistering a target.
The range is 0-3600 seconds.
healthCheck?
Type:
Health
(optional, default: The default value for each property in this configuration varies depending on the target.)
Health check configuration.
preserveClientIp?
Type:
boolean
(optional, default: false if the target group type is IP address and the
target group protocol is TCP or TLS. Otherwise, true.)
Indicates whether client IP preservation is enabled.
protocol?
Type:
Protocol
(optional, default: inherits the protocol of the listener)
Protocol for target group, expects TCP, TLS, UDP, or TCP_UDP.
proxyProtocolV2?
Type:
boolean
(optional, default: false)
Indicates whether Proxy Protocol version 2 is enabled.
targetGroupName?
Type:
string
(optional, default: Automatically generated)
The name of the target group.
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?
Type:
INetwork[]
(optional)
The targets to add to this target group.
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.

.NET
Go
Java
Python
TypeScript (