Class NetworkTargetGroup
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.services.elasticloadbalancingv2.TargetGroupBase
software.amazon.awscdk.services.elasticloadbalancingv2.NetworkTargetGroup
- All Implemented Interfaces:
INetworkTargetGroup,ITargetGroup,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.120.0 (build 192dc88)",
date="2025-12-12T17:54:13.562Z")
@Stability(Stable)
public class NetworkTargetGroup
extends TargetGroupBase
implements INetworkTargetGroup
Define a Network Target Group.
Example:
import software.amazon.awscdk.services.elasticloadbalancing.*;
import software.amazon.awscdk.services.elasticloadbalancingv2.*;
LoadBalancer clb;
ApplicationLoadBalancer alb;
NetworkLoadBalancer nlb;
ApplicationListener albListener = alb.addListener("ALBListener", BaseApplicationListenerProps.builder().port(80).build());
ApplicationTargetGroup albTargetGroup = albListener.addTargets("ALBFleet", AddApplicationTargetsProps.builder().port(80).build());
NetworkListener nlbListener = nlb.addListener("NLBListener", BaseNetworkListenerProps.builder().port(80).build());
NetworkTargetGroup nlbTargetGroup = nlbListener.addTargets("NLBFleet", AddNetworkTargetsProps.builder().port(80).build());
ServerDeploymentGroup deploymentGroup = ServerDeploymentGroup.Builder.create(this, "DeploymentGroup")
.loadBalancers(List.of(LoadBalancer.classic(clb), LoadBalancer.application(albTargetGroup), LoadBalancer.network(nlbTargetGroup)))
.build();
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.elasticloadbalancingv2.INetworkTargetGroup
INetworkTargetGroup.Jsii$Default, INetworkTargetGroup.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.services.elasticloadbalancingv2.ITargetGroup
ITargetGroup.Jsii$Default -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNetworkTargetGroup(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedNetworkTargetGroup(software.amazon.jsii.JsiiObjectRef objRef) NetworkTargetGroup(software.constructs.Construct scope, String id, NetworkTargetGroupProps props) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTarget(INetworkLoadBalancerTarget... targets) Add a load balancing target to this target group.static INetworkTargetGroupfromTargetGroupAttributes(software.constructs.Construct scope, String id, TargetGroupAttributes attrs) Import an existing target group.Full name of first load balancer.All metrics available for this target group.Deprecated.Deprecated.UseNetworkTargetGroup.metrics.healthyHostCountinsteadDeprecated.UseNetworkTargetGroup.metrics.healthyHostCountinsteadDeprecated.UseNetworkTargetGroup.metrics.healthyHostCountinsteadvoidregisterListener(INetworkListener listener) Register a listener that is load balancing to this target group.Methods inherited from class software.amazon.awscdk.services.elasticloadbalancingv2.TargetGroupBase
addLoadBalancerTarget, configureHealthCheck, getDefaultPort, getHealthCheck, getLoadBalancerArns, getLoadBalancerAttached, getLoadBalancerAttachedDependencies, getTargetGroupArn, getTargetGroupFullName, getTargetGroupLoadBalancerArns, getTargetGroupName, getTargetType, setAttribute, setAttribute, setHealthCheck, setTargetType, validateHealthCheckMethods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.services.elasticloadbalancingv2.ITargetGroup
getLoadBalancerArns, getLoadBalancerAttached, getTargetGroupArn, getTargetGroupNameMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
Constructor Details
-
NetworkTargetGroup
protected NetworkTargetGroup(software.amazon.jsii.JsiiObjectRef objRef) -
NetworkTargetGroup
protected NetworkTargetGroup(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
NetworkTargetGroup
@Stability(Stable) public NetworkTargetGroup(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull NetworkTargetGroupProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-
-
Method Details
-
fromTargetGroupAttributes
@Stability(Stable) @NotNull public static INetworkTargetGroup fromTargetGroupAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull TargetGroupAttributes attrs) Import an existing target group.- Parameters:
scope- This parameter is required.id- This parameter is required.attrs- This parameter is required.
-
addTarget
Add a load balancing target to this target group.- Specified by:
addTargetin interfaceINetworkTargetGroup- Parameters:
targets- This parameter is required.
-
metricHealthyHostCount
@Stability(Deprecated) @Deprecated @NotNull public Metric metricHealthyHostCount(@Nullable MetricOptions props) Deprecated.UseNetworkTargetGroup.metrics.healthyHostCountinstead(deprecated) The number of targets that are considered healthy.Default: Average over 5 minutes
- Parameters:
props-
-
metricHealthyHostCount
Deprecated.UseNetworkTargetGroup.metrics.healthyHostCountinstead(deprecated) The number of targets that are considered healthy.Default: Average over 5 minutes
-
metricUnHealthyHostCount
@Stability(Deprecated) @Deprecated @NotNull public Metric metricUnHealthyHostCount(@Nullable MetricOptions props) Deprecated.UseNetworkTargetGroup.metrics.healthyHostCountinstead(deprecated) The number of targets that are considered unhealthy.Default: Average over 5 minutes
- Parameters:
props-
-
metricUnHealthyHostCount
Deprecated.UseNetworkTargetGroup.metrics.healthyHostCountinstead(deprecated) The number of targets that are considered unhealthy.Default: Average over 5 minutes
-
registerListener
Register a listener that is load balancing to this target group.Don't call this directly. It will be called by listeners.
- Specified by:
registerListenerin interfaceINetworkTargetGroup- Parameters:
listener- This parameter is required.
-
validateTargetGroup
- Overrides:
validateTargetGroupin classTargetGroupBase
-
getFirstLoadBalancerFullName
Full name of first load balancer.- Specified by:
getFirstLoadBalancerFullNamein classTargetGroupBase
-
getMetrics
All metrics available for this target group.- Specified by:
getMetricsin interfaceINetworkTargetGroup
-
NetworkTargetGroup.metrics.healthyHostCountinstead