Class ApplicationTargetGroup
- All Implemented Interfaces:
- IConstruct,- IDependable,- IApplicationTargetGroup,- ITargetGroup,- software.amazon.jsii.JsiiSerializable,- software.constructs.IConstruct
Example:
 Vpc vpc;
 // Target group with duration-based stickiness with load-balancer generated cookie
 ApplicationTargetGroup tg1 = ApplicationTargetGroup.Builder.create(this, "TG1")
         .targetType(TargetType.INSTANCE)
         .port(80)
         .stickinessCookieDuration(Duration.minutes(5))
         .vpc(vpc)
         .build();
 // Target group with application-based stickiness
 ApplicationTargetGroup tg2 = ApplicationTargetGroup.Builder.create(this, "TG2")
         .targetType(TargetType.INSTANCE)
         .port(80)
         .stickinessCookieDuration(Duration.minutes(5))
         .stickinessCookieName("MyDeliciousCookie")
         .vpc(vpc)
         .build();
 - 
Nested Class SummaryNested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObjectsoftware.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.services.elasticloadbalancingv2.IApplicationTargetGroupIApplicationTargetGroup.Jsii$Default, IApplicationTargetGroup.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstructIConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.constructs.IConstructsoftware.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.elasticloadbalancingv2.ITargetGroupITargetGroup.Jsii$Default
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedApplicationTargetGroup(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedApplicationTargetGroup(software.amazon.jsii.JsiiObjectRef objRef) ApplicationTargetGroup(software.constructs.Construct scope, String id) ApplicationTargetGroup(software.constructs.Construct scope, String id, ApplicationTargetGroupProps props) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddTarget(@NotNull IApplicationLoadBalancerTarget... targets) Add a load balancing target to this target group.static IApplicationTargetGroupdoImport(software.constructs.Construct scope, String id, TargetGroupImportProps props) Deprecated.voidenableCookieStickiness(Duration duration) Enable sticky routing via a cookie to members of this target group.voidenableCookieStickiness(Duration duration, String cookieName) Enable sticky routing via a cookie to members of this target group.static IApplicationTargetGroupfromTargetGroupAttributes(software.constructs.Construct scope, String id, TargetGroupAttributes attrs) Import an existing target group.Full name of first load balancer.Return the given named metric for this Application Load Balancer Target Group.metric(String metricName, MetricOptions props) Return the given named metric for this Application Load Balancer Target Group.The number of healthy hosts in the target group.The number of healthy hosts in the target group.The number of HTTP 2xx/3xx/4xx/5xx response codes generated by all targets in this target group.metricHttpCodeTarget(HttpCodeTarget code, MetricOptions props) The number of HTTP 2xx/3xx/4xx/5xx response codes generated by all targets in this target group.The number of IPv6 requests received by the target group.The number of IPv6 requests received by the target group.The number of requests processed over IPv4 and IPv6.metricRequestCount(MetricOptions props) The number of requests processed over IPv4 and IPv6.The average number of requests received by each target in a target group.The average number of requests received by each target in a target group.The number of connections that were not successfully established between the load balancer and target.The number of connections that were not successfully established between the load balancer and target.The time elapsed, in seconds, after the request leaves the load balancer until a response from the target is received.The time elapsed, in seconds, after the request leaves the load balancer until a response from the target is received.The number of TLS connections initiated by the load balancer that did not establish a session with the target.The number of TLS connections initiated by the load balancer that did not establish a session with the target.The number of unhealthy hosts in the target group.The number of unhealthy hosts in the target group.voidregisterConnectable(IConnectable connectable) Register a connectable as a member of this target group.voidregisterConnectable(IConnectable connectable, Port portRange) Register a connectable as a member of this target group.voidregisterListener(IApplicationListener listener) Register a listener that is load balancing to this target group.voidregisterListener(IApplicationListener listener, software.constructs.IConstruct associatingConstruct) Register a listener that is load balancing to this target group.validate()Validate the current construct.Methods inherited from class software.amazon.awscdk.services.elasticloadbalancingv2.TargetGroupBaseaddLoadBalancerTarget, configureHealthCheck, getDefaultPort, getHealthCheck, getLoadBalancerArns, getLoadBalancerAttached, getLoadBalancerAttachedDependencies, getTargetGroupArn, getTargetGroupFullName, getTargetGroupLoadBalancerArns, getTargetGroupName, getTargetType, setAttribute, setAttribute, setHealthCheck, setTargetTypeMethods inherited from class software.amazon.awscdk.core.ConstructgetNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesizeMethods inherited from class software.constructs.ConstructtoStringMethods inherited from class software.amazon.jsii.JsiiObjectjsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.amazon.awscdk.core.IConstructgetNodeMethods inherited from interface software.amazon.awscdk.services.elasticloadbalancingv2.ITargetGroupgetLoadBalancerArns, getLoadBalancerAttached, getTargetGroupArn, getTargetGroupNameMethods inherited from interface software.amazon.jsii.JsiiSerializable$jsii$toJson
- 
Constructor Details- 
ApplicationTargetGroupprotected ApplicationTargetGroup(software.amazon.jsii.JsiiObjectRef objRef) 
- 
ApplicationTargetGroupprotected ApplicationTargetGroup(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) 
- 
ApplicationTargetGroup@Stability(Stable) public ApplicationTargetGroup(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable ApplicationTargetGroupProps props) - Parameters:
- scope- This parameter is required.
- id- This parameter is required.
- props-
 
- 
ApplicationTargetGroup@Stability(Stable) public ApplicationTargetGroup(@NotNull software.constructs.Construct scope, @NotNull String id) - Parameters:
- scope- This parameter is required.
- id- This parameter is required.
 
 
- 
- 
Method Details- 
fromTargetGroupAttributes@Stability(Stable) @NotNull public static IApplicationTargetGroup 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.
 
- 
doImport@Stability(Deprecated) @Deprecated @NotNull public static IApplicationTargetGroup doImport(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull TargetGroupImportProps props) Deprecated.UsefromTargetGroupAttributesinstead(deprecated) Import an existing target group.- Parameters:
- scope- This parameter is required.
- id- This parameter is required.
- props- This parameter is required.
 
- 
addTarget@Stability(Stable) public void addTarget(@NotNull @NotNull IApplicationLoadBalancerTarget... targets) Add a load balancing target to this target group.- Specified by:
- addTargetin interface- IApplicationTargetGroup
- Parameters:
- targets- This parameter is required.
 
- 
enableCookieStickiness@Stability(Stable) public void enableCookieStickiness(@NotNull Duration duration, @Nullable String cookieName) Enable sticky routing via a cookie to members of this target group.Note: If the cookieNameparameter is set, application-based stickiness will be applied, otherwise it defaults to duration-based stickiness attributes (lb_cookie).- Parameters:
- duration- This parameter is required.
- cookieName-
- See Also:
 
- 
enableCookieStickinessEnable sticky routing via a cookie to members of this target group.Note: If the cookieNameparameter is set, application-based stickiness will be applied, otherwise it defaults to duration-based stickiness attributes (lb_cookie).- Parameters:
- duration- This parameter is required.
- See Also:
 
- 
metric@Stability(Stable) @NotNull public Metric metric(@NotNull String metricName, @Nullable MetricOptions props) Return the given named metric for this Application Load Balancer Target Group.Returns the metric for this target group from the point of view of the first load balancer load balancing to it. If you have multiple load balancers load sending traffic to the same target group, you will have to override the dimensions on this metric. Default: Average over 5 minutes - Parameters:
- metricName- This parameter is required.
- props-
 
- 
metricReturn the given named metric for this Application Load Balancer Target Group.Returns the metric for this target group from the point of view of the first load balancer load balancing to it. If you have multiple load balancers load sending traffic to the same target group, you will have to override the dimensions on this metric. Default: Average over 5 minutes - Parameters:
- metricName- This parameter is required.
 
- 
metricHealthyHostCountThe number of healthy hosts in the target group.Default: Average over 5 minutes - Parameters:
- props-
 
- 
metricHealthyHostCountThe number of healthy hosts in the target group.Default: Average over 5 minutes 
- 
metricHttpCodeTarget@Stability(Stable) @NotNull public Metric metricHttpCodeTarget(@NotNull HttpCodeTarget code, @Nullable MetricOptions props) The number of HTTP 2xx/3xx/4xx/5xx response codes generated by all targets in this target group.This does not include any response codes generated by the load balancer. Default: Sum over 5 minutes - Parameters:
- code- This parameter is required.
- props-
 
- 
metricHttpCodeTargetThe number of HTTP 2xx/3xx/4xx/5xx response codes generated by all targets in this target group.This does not include any response codes generated by the load balancer. Default: Sum over 5 minutes - Parameters:
- code- This parameter is required.
 
- 
metricIpv6RequestCountThe number of IPv6 requests received by the target group.Default: Sum over 5 minutes - Parameters:
- props-
 
- 
metricIpv6RequestCountThe number of IPv6 requests received by the target group.Default: Sum over 5 minutes 
- 
metricRequestCountThe number of requests processed over IPv4 and IPv6.This count includes only the requests with a response generated by a target of the load balancer. Default: Sum over 5 minutes - Parameters:
- props-
 
- 
metricRequestCountThe number of requests processed over IPv4 and IPv6.This count includes only the requests with a response generated by a target of the load balancer. Default: Sum over 5 minutes 
- 
metricRequestCountPerTarget@Stability(Stable) @NotNull public Metric metricRequestCountPerTarget(@Nullable MetricOptions props) The average number of requests received by each target in a target group.The only valid statistic is Sum. Note that this represents the average not the sum. Default: Sum over 5 minutes - Parameters:
- props-
 
- 
metricRequestCountPerTargetThe average number of requests received by each target in a target group.The only valid statistic is Sum. Note that this represents the average not the sum. Default: Sum over 5 minutes 
- 
metricTargetConnectionErrorCount@Stability(Stable) @NotNull public Metric metricTargetConnectionErrorCount(@Nullable MetricOptions props) The number of connections that were not successfully established between the load balancer and target.Default: Sum over 5 minutes - Parameters:
- props-
 
- 
metricTargetConnectionErrorCountThe number of connections that were not successfully established between the load balancer and target.Default: Sum over 5 minutes 
- 
metricTargetResponseTimeThe time elapsed, in seconds, after the request leaves the load balancer until a response from the target is received.Default: Average over 5 minutes - Parameters:
- props-
 
- 
metricTargetResponseTimeThe time elapsed, in seconds, after the request leaves the load balancer until a response from the target is received.Default: Average over 5 minutes 
- 
metricTargetTLSNegotiationErrorCount@Stability(Stable) @NotNull public Metric metricTargetTLSNegotiationErrorCount(@Nullable MetricOptions props) The number of TLS connections initiated by the load balancer that did not establish a session with the target.Possible causes include a mismatch of ciphers or protocols. Default: Sum over 5 minutes - Parameters:
- props-
 
- 
metricTargetTLSNegotiationErrorCountThe number of TLS connections initiated by the load balancer that did not establish a session with the target.Possible causes include a mismatch of ciphers or protocols. Default: Sum over 5 minutes 
- 
metricUnhealthyHostCountThe number of unhealthy hosts in the target group.Default: Average over 5 minutes - Parameters:
- props-
 
- 
metricUnhealthyHostCountThe number of unhealthy hosts in the target group.Default: Average over 5 minutes 
- 
registerConnectable@Stability(Stable) public void registerConnectable(@NotNull IConnectable connectable, @Nullable Port portRange) Register a connectable as a member of this target group.Don't call this directly. It will be called by load balancing targets. - Specified by:
- registerConnectablein interface- IApplicationTargetGroup
- Parameters:
- connectable- This parameter is required.
- portRange-
 
- 
registerConnectableRegister a connectable as a member of this target group.Don't call this directly. It will be called by load balancing targets. - Specified by:
- registerConnectablein interface- IApplicationTargetGroup
- Parameters:
- connectable- This parameter is required.
 
- 
registerListener@Stability(Stable) public void registerListener(@NotNull IApplicationListener listener, @Nullable software.constructs.IConstruct associatingConstruct) 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 interface- IApplicationTargetGroup
- Parameters:
- listener- This parameter is required.
- associatingConstruct-
 
- 
registerListenerRegister a listener that is load balancing to this target group.Don't call this directly. It will be called by listeners. - Specified by:
- registerListenerin interface- IApplicationTargetGroup
- Parameters:
- listener- This parameter is required.
 
- 
validateValidate the current construct.This method can be implemented by derived constructs in order to perform validation logic. It is called on all constructs before synthesis. - Overrides:
- validatein class- TargetGroupBase
- Returns:
- An array of validation error messages, or an empty array if the construct is valid.
 
- 
getFirstLoadBalancerFullNameFull name of first load balancer.- Specified by:
- getFirstLoadBalancerFullNamein class- TargetGroupBase
 
 
- 
fromTargetGroupAttributesinstead