Class ApplicationTargetGroup

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

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:44.210Z") @Stability(Stable) public class ApplicationTargetGroup extends TargetGroupBase implements IApplicationTargetGroup
Define an Application Target Group.

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();
 
  • 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.
      Use fromTargetGroupAttributes 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 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(Stable) @NotNull public Metric metricHealthyHostCount(@Nullable MetricOptions props)
      The number of healthy hosts in the target group.

      Default: Average over 5 minutes

      Parameters:
      props -
    • metricHealthyHostCount

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

      @Stability(Stable) @NotNull public Metric metricHttpCodeTarget(@NotNull HttpCodeTarget code)
      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(Stable) @NotNull public Metric metricIpv6RequestCount(@Nullable MetricOptions props)
      The number of IPv6 requests received by the target group.

      Default: Sum over 5 minutes

      Parameters:
      props -
    • metricIpv6RequestCount

      @Stability(Stable) @NotNull public Metric metricIpv6RequestCount()
      The number of IPv6 requests received by the target group.

      Default: Sum over 5 minutes

    • metricRequestCount

      @Stability(Stable) @NotNull public Metric metricRequestCount(@Nullable MetricOptions props)
      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(Stable) @NotNull public Metric 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

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

      @Stability(Stable) @NotNull public Metric metricTargetConnectionErrorCount()
      The number of connections that were not successfully established between the load balancer and target.

      Default: Sum over 5 minutes

    • metricTargetResponseTime

      @Stability(Stable) @NotNull public Metric metricTargetResponseTime(@Nullable MetricOptions props)
      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(Stable) @NotNull public Metric 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

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

      @Stability(Stable) @NotNull public Metric metricUnhealthyHostCount(@Nullable MetricOptions props)
      The number of unhealthy hosts in the target group.

      Default: Average over 5 minutes

      Parameters:
      props -
    • metricUnhealthyHostCount

      @Stability(Stable) @NotNull public Metric 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 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.
    • validate

      @Stability(Stable) @NotNull protected List<String> 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 class TargetGroupBase
      Returns:
      An array of validation error messages, or an empty array if the construct is valid.
    • getFirstLoadBalancerFullName

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