Class ApplicationTargetGroup

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.services.elasticloadbalancingv2.TargetGroupBase
software.amazon.awscdk.services.elasticloadbalancingv2.ApplicationTargetGroup
All Implemented Interfaces:
IApplicationTargetGroup, ITargetGroup, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2025-01-15T21:09:19.174Z") @Stability(Stable) public class ApplicationTargetGroup extends TargetGroupBase implements IApplicationTargetGroup
Define an Application Target Group.

Example:

 ApplicationLoadBalancer alb;
 ApplicationListener listener = alb.addListener("Listener", BaseApplicationListenerProps.builder().port(80).build());
 ApplicationTargetGroup targetGroup = listener.addTargets("Fleet", AddApplicationTargetsProps.builder().port(80).build());
 ServerDeploymentGroup deploymentGroup = ServerDeploymentGroup.Builder.create(this, "DeploymentGroup")
         .loadBalancer(LoadBalancer.application(targetGroup))
         .build();
 
  • 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.
    • addTarget

      @Stability(Stable) public void addTarget(@NotNull @NotNull IApplicationLoadBalancerTarget... targets)
      Add a load balancing target to this target group.

      Specified by:
      addTarget in 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 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

      @Stability(Stable) public void enableCookieStickiness(@NotNull Duration duration)
      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

      @Stability(Stable) @NotNull public Metric metric(@NotNull String metricName)
      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

      @Stability(Deprecated) @Deprecated @NotNull public Metric metricHealthyHostCount(@Nullable MetricOptions props)
      Deprecated.
      Use ApplicationTargetGroup.metrics.healthyHostCount instead
      (deprecated) The number of healthy hosts in the target group.

      Default: Average over 5 minutes

      Parameters:
      props -
    • metricHealthyHostCount

      @Stability(Deprecated) @Deprecated @NotNull public Metric metricHealthyHostCount()
      Deprecated.
      Use ApplicationTargetGroup.metrics.healthyHostCount instead
      (deprecated) The number of healthy hosts in the target group.

      Default: Average over 5 minutes

    • metricHttpCodeTarget

      @Stability(Deprecated) @Deprecated @NotNull public Metric metricHttpCodeTarget(@NotNull HttpCodeTarget code, @Nullable MetricOptions props)
      Deprecated.
      Use ApplicationTargetGroup.metrics.httpCodeTarget instead
      (deprecated) 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

      @Stability(Deprecated) @Deprecated @NotNull public Metric metricHttpCodeTarget(@NotNull HttpCodeTarget code)
      Deprecated.
      Use ApplicationTargetGroup.metrics.httpCodeTarget instead
      (deprecated) 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

      @Stability(Deprecated) @Deprecated @NotNull public Metric metricIpv6RequestCount(@Nullable MetricOptions props)
      Deprecated.
      Use ApplicationTargetGroup.metrics.ipv6RequestCount instead
      (deprecated) The number of IPv6 requests received by the target group.

      Default: Sum over 5 minutes

      Parameters:
      props -
    • metricIpv6RequestCount

      @Stability(Deprecated) @Deprecated @NotNull public Metric metricIpv6RequestCount()
      Deprecated.
      Use ApplicationTargetGroup.metrics.ipv6RequestCount instead
      (deprecated) The number of IPv6 requests received by the target group.

      Default: Sum over 5 minutes

    • metricRequestCount

      @Stability(Deprecated) @Deprecated @NotNull public Metric metricRequestCount(@Nullable MetricOptions props)
      Deprecated.
      Use ApplicationTargetGroup.metrics.requestCount instead
      (deprecated) 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

      @Stability(Deprecated) @Deprecated @NotNull public Metric metricRequestCount()
      Deprecated.
      Use ApplicationTargetGroup.metrics.requestCount instead
      (deprecated) 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(Deprecated) @Deprecated @NotNull public Metric metricRequestCountPerTarget(@Nullable MetricOptions props)
      Deprecated.
      Use ApplicationTargetGroup.metrics.requestCountPerTarget instead
      (deprecated) 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

      @Stability(Deprecated) @Deprecated @NotNull public Metric metricRequestCountPerTarget()
      Deprecated.
      Use ApplicationTargetGroup.metrics.requestCountPerTarget instead
      (deprecated) 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(Deprecated) @Deprecated @NotNull public Metric metricTargetConnectionErrorCount(@Nullable MetricOptions props)
      Deprecated.
      Use ApplicationTargetGroup.metrics.targetConnectionErrorCount instead
      (deprecated) The number of connections that were not successfully established between the load balancer and target.

      Default: Sum over 5 minutes

      Parameters:
      props -
    • metricTargetConnectionErrorCount

      @Stability(Deprecated) @Deprecated @NotNull public Metric metricTargetConnectionErrorCount()
      Deprecated.
      Use ApplicationTargetGroup.metrics.targetConnectionErrorCount instead
      (deprecated) The number of connections that were not successfully established between the load balancer and target.

      Default: Sum over 5 minutes

    • metricTargetResponseTime

      @Stability(Deprecated) @Deprecated @NotNull public Metric metricTargetResponseTime(@Nullable MetricOptions props)
      Deprecated.
      Use ApplicationTargetGroup.metrics.targetResponseTime instead
      (deprecated) 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

      @Stability(Deprecated) @Deprecated @NotNull public Metric metricTargetResponseTime()
      Deprecated.
      Use ApplicationTargetGroup.metrics.targetResponseTime instead
      (deprecated) 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(Deprecated) @Deprecated @NotNull public Metric metricTargetTLSNegotiationErrorCount(@Nullable MetricOptions props)
      Deprecated.
      Use ApplicationTargetGroup.metrics.tlsNegotiationErrorCount instead
      (deprecated) 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

      @Stability(Deprecated) @Deprecated @NotNull public Metric metricTargetTLSNegotiationErrorCount()
      Deprecated.
      Use ApplicationTargetGroup.metrics.tlsNegotiationErrorCount instead
      (deprecated) 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

      @Stability(Deprecated) @Deprecated @NotNull public Metric metricUnhealthyHostCount(@Nullable MetricOptions props)
      Deprecated.
      Use ApplicationTargetGroup.metrics.unhealthyHostCount instead
      (deprecated) The number of unhealthy hosts in the target group.

      Default: Average over 5 minutes

      Parameters:
      props -
    • metricUnhealthyHostCount

      @Stability(Deprecated) @Deprecated @NotNull public Metric metricUnhealthyHostCount()
      Deprecated.
      Use ApplicationTargetGroup.metrics.unhealthyHostCount instead
      (deprecated) 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 interface IApplicationTargetGroup
      Parameters:
      connectable - This parameter is required.
      portRange -
    • registerConnectable

      @Stability(Stable) public void registerConnectable(@NotNull IConnectable connectable)
      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 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:
      registerListener in interface IApplicationTargetGroup
      Parameters:
      listener - This parameter is required.
      associatingConstruct -
    • registerListener

      @Stability(Stable) public void registerListener(@NotNull IApplicationListener listener)
      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 interface IApplicationTargetGroup
      Parameters:
      listener - This parameter is required.
    • validateTargetGroup

      @Stability(Stable) @NotNull protected List<String> validateTargetGroup()
      Overrides:
      validateTargetGroup in class TargetGroupBase
    • getFirstLoadBalancerFullName

      @Stability(Stable) @NotNull public String getFirstLoadBalancerFullName()
      Full name of first load balancer.
      Specified by:
      getFirstLoadBalancerFullName in class TargetGroupBase
    • getMetrics

      @Stability(Stable) @NotNull public IApplicationTargetGroupMetrics getMetrics()
      All metrics available for this target group.
      Specified by:
      getMetrics in interface IApplicationTargetGroup