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 Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.elasticloadbalancingv2.IApplicationTargetGroup
IApplicationTargetGroup.Jsii$Default, IApplicationTargetGroup.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.elasticloadbalancingv2.ITargetGroup
ITargetGroup.Jsii$Default
-
Constructor Summary
ModifierConstructorDescriptionprotected
ApplicationTargetGroup
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
ApplicationTargetGroup
(software.amazon.jsii.JsiiObjectRef objRef) ApplicationTargetGroup
(software.constructs.Construct scope, String id) ApplicationTargetGroup
(software.constructs.Construct scope, String id, ApplicationTargetGroupProps props) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTarget
(@NotNull IApplicationLoadBalancerTarget... targets) Add a load balancing target to this target group.static IApplicationTargetGroup
doImport
(software.constructs.Construct scope, String id, TargetGroupImportProps props) Deprecated.void
enableCookieStickiness
(Duration duration) Enable sticky routing via a cookie to members of this target group.void
enableCookieStickiness
(Duration duration, String cookieName) Enable sticky routing via a cookie to members of this target group.static IApplicationTargetGroup
fromTargetGroupAttributes
(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.void
registerConnectable
(IConnectable connectable) Register a connectable as a member of this target group.void
registerConnectable
(IConnectable connectable, Port portRange) Register a connectable as a member of this target group.void
registerListener
(IApplicationListener listener) Register a listener that is load balancing to this target group.void
registerListener
(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.TargetGroupBase
addLoadBalancerTarget, configureHealthCheck, getDefaultPort, getHealthCheck, getLoadBalancerArns, getLoadBalancerAttached, getLoadBalancerAttachedDependencies, getTargetGroupArn, getTargetGroupFullName, getTargetGroupLoadBalancerArns, getTargetGroupName, getTargetType, setAttribute, setAttribute, setHealthCheck, setTargetType
Methods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize
Methods inherited from class software.constructs.Construct
toString
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.awscdk.core.IConstruct
getNode
Methods inherited from interface software.amazon.awscdk.services.elasticloadbalancingv2.ITargetGroup
getLoadBalancerArns, getLoadBalancerAttached, getTargetGroupArn, getTargetGroupName
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
ApplicationTargetGroup
protected ApplicationTargetGroup(software.amazon.jsii.JsiiObjectRef objRef) -
ApplicationTargetGroup
protected 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.UsefromTargetGroupAttributes
instead(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:
addTarget
in interfaceIApplicationTargetGroup
- 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
cookieName
parameter 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:
-
enableCookieStickiness
Enable sticky routing via a cookie to members of this target group.Note: If the
cookieName
parameter 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
-
-
metric
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.
-
metricHealthyHostCount
The number of healthy hosts in the target group.Default: Average over 5 minutes
- Parameters:
props
-
-
metricHealthyHostCount
The 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
-
-
metricHttpCodeTarget
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.
-
metricIpv6RequestCount
The number of IPv6 requests received by the target group.Default: Sum over 5 minutes
- Parameters:
props
-
-
metricIpv6RequestCount
The number of IPv6 requests received by the target group.Default: Sum over 5 minutes
-
metricRequestCount
The 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
-
-
metricRequestCount
The 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
-
-
metricRequestCountPerTarget
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
-
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
-
-
metricTargetConnectionErrorCount
The number of connections that were not successfully established between the load balancer and target.Default: Sum over 5 minutes
-
metricTargetResponseTime
The 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
-
-
metricTargetResponseTime
The 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
-
-
metricTargetTLSNegotiationErrorCount
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
-
metricUnhealthyHostCount
The number of unhealthy hosts in the target group.Default: Average over 5 minutes
- Parameters:
props
-
-
metricUnhealthyHostCount
The 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:
registerConnectable
in interfaceIApplicationTargetGroup
- Parameters:
connectable
- This parameter is required.portRange
-
-
registerConnectable
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:
registerConnectable
in interfaceIApplicationTargetGroup
- 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:
registerListener
in interfaceIApplicationTargetGroup
- Parameters:
listener
- This parameter is required.associatingConstruct
-
-
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:
registerListener
in interfaceIApplicationTargetGroup
- Parameters:
listener
- This parameter is required.
-
validate
Validate 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:
validate
in classTargetGroupBase
- Returns:
- An array of validation error messages, or an empty array if the construct is valid.
-
getFirstLoadBalancerFullName
Full name of first load balancer.- Specified by:
getFirstLoadBalancerFullName
in classTargetGroupBase
-
fromTargetGroupAttributes
instead