Class ApplicationTargetGroup
Define an Application Target Group.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.ElasticLoadBalancingV2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class ApplicationTargetGroup : TargetGroupBase, IApplicationTargetGroup, ITargetGroup, ITargetGroupRef, IConstruct, IDependable, IEnvironmentAware
Syntax (vb)
Public Class ApplicationTargetGroup Inherits TargetGroupBase Implements IApplicationTargetGroup, ITargetGroup, ITargetGroupRef, IConstruct, IDependable, IEnvironmentAware
Remarks
ExampleMetadata: infused
Examples
ApplicationLoadBalancer alb;
var listener = alb.AddListener("Listener", new BaseApplicationListenerProps { Port = 80 });
var targetGroup = listener.AddTargets("Fleet", new AddApplicationTargetsProps { Port = 80 });
var deploymentGroup = new ServerDeploymentGroup(this, "DeploymentGroup", new ServerDeploymentGroupProps {
LoadBalancer = LoadBalancer.Application(targetGroup)
});
Synopsis
Constructors
| ApplicationTargetGroup(Construct, string, IApplicationTargetGroupProps?) | Define an Application Target Group. |
Properties
| FirstLoadBalancerFullName | Full name of first load balancer. |
| Metrics | All metrics available for this target group. |
| PROPERTY_INJECTION_ID | Uniquely identifies this class. |
Methods
| AddTarget(params IApplicationLoadBalancerTarget[]) | Add a load balancing target to this target group. |
| EnableCookieStickiness(Duration, string?) | Enable sticky routing via a cookie to members of this target group. |
| FromTargetGroupAttributes(Construct, string, ITargetGroupAttributes) | Import an existing target group. |
| Metric(string, IMetricOptions?) | Return the given named metric for this Application Load Balancer Target Group. |
| MetricHealthyHostCount(IMetricOptions?) | (deprecated) The number of healthy hosts in the target group. |
| MetricHttpCodeTarget(HttpCodeTarget, IMetricOptions?) | (deprecated) The number of HTTP 2xx/3xx/4xx/5xx response codes generated by all targets in this target group. |
| MetricIpv6RequestCount(IMetricOptions?) | (deprecated) The number of IPv6 requests received by the target group. |
| MetricRequestCount(IMetricOptions?) | (deprecated) The number of requests processed over IPv4 and IPv6. |
| MetricRequestCountPerTarget(IMetricOptions?) | (deprecated) The average number of requests received by each target in a target group. |
| MetricTargetConnectionErrorCount(IMetricOptions?) | (deprecated) The number of connections that were not successfully established between the load balancer and target. |
| MetricTargetResponseTime(IMetricOptions?) | (deprecated) The time elapsed, in seconds, after the request leaves the load balancer until a response from the target is received. |
| MetricTargetTLSNegotiationErrorCount(IMetricOptions?) | (deprecated) The number of TLS connections initiated by the load balancer that did not establish a session with the target. |
| MetricUnhealthyHostCount(IMetricOptions?) | (deprecated) The number of unhealthy hosts in the target group. |
| RegisterConnectable(IConnectable, Port?) | Register a connectable as a member of this target group. |
| RegisterListener(IApplicationListener, IConstruct?) | Register a listener that is load balancing to this target group. |
| ValidateTargetGroup() | Define an Application Target Group. |
Constructors
ApplicationTargetGroup(Construct, string, IApplicationTargetGroupProps?)
Define an Application Target Group.
public ApplicationTargetGroup(Construct scope, string id, IApplicationTargetGroupProps? props = null)
Parameters
- scope Construct
- id string
- props IApplicationTargetGroupProps
Remarks
ExampleMetadata: infused
Examples
ApplicationLoadBalancer alb;
var listener = alb.AddListener("Listener", new BaseApplicationListenerProps { Port = 80 });
var targetGroup = listener.AddTargets("Fleet", new AddApplicationTargetsProps { Port = 80 });
var deploymentGroup = new ServerDeploymentGroup(this, "DeploymentGroup", new ServerDeploymentGroupProps {
LoadBalancer = LoadBalancer.Application(targetGroup)
});
Properties
FirstLoadBalancerFullName
Full name of first load balancer.
public override string FirstLoadBalancerFullName { get; }
Property Value
Overrides
Remarks
ExampleMetadata: infused
Metrics
All metrics available for this target group.
public virtual IApplicationTargetGroupMetrics Metrics { get; }
Property Value
IApplicationTargetGroupMetrics
Remarks
ExampleMetadata: infused
PROPERTY_INJECTION_ID
Uniquely identifies this class.
public static string PROPERTY_INJECTION_ID { get; }
Property Value
Remarks
ExampleMetadata: infused
Methods
AddTarget(params IApplicationLoadBalancerTarget[])
Add a load balancing target to this target group.
public virtual void AddTarget(params IApplicationLoadBalancerTarget[] targets)
Parameters
- targets IApplicationLoadBalancerTarget[]
Remarks
ExampleMetadata: infused
EnableCookieStickiness(Duration, string?)
Enable sticky routing via a cookie to members of this target group.
public virtual void EnableCookieStickiness(Duration duration, string? cookieName = null)
Parameters
Remarks
Note: If the cookieName parameter is set, application-based stickiness will be applied,
otherwise it defaults to duration-based stickiness attributes (lb_cookie).
See: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/sticky-sessions.html
FromTargetGroupAttributes(Construct, string, ITargetGroupAttributes)
Import an existing target group.
public static IApplicationTargetGroup FromTargetGroupAttributes(Construct scope, string id, ITargetGroupAttributes attrs)
Parameters
- scope Construct
- id string
- attrs ITargetGroupAttributes
Returns
Remarks
ExampleMetadata: infused
Metric(string, IMetricOptions?)
Return the given named metric for this Application Load Balancer Target Group.
public virtual Metric Metric(string metricName, IMetricOptions? props = null)
Parameters
- metricName string
- props IMetricOptions
Returns
Remarks
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
MetricHealthyHostCount(IMetricOptions?)
(deprecated) The number of healthy hosts in the target group.
[Obsolete("Use ``ApplicationTargetGroup.metrics.healthyHostCount`` instead")]
public virtual Metric MetricHealthyHostCount(IMetricOptions? props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: Average over 5 minutes
Stability: Deprecated
MetricHttpCodeTarget(HttpCodeTarget, IMetricOptions?)
(deprecated) The number of HTTP 2xx/3xx/4xx/5xx response codes generated by all targets in this target group.
[Obsolete("Use ``ApplicationTargetGroup.metrics.httpCodeTarget`` instead")]
public virtual Metric MetricHttpCodeTarget(HttpCodeTarget code, IMetricOptions? props = null)
Parameters
- code HttpCodeTarget
- props IMetricOptions
Returns
Remarks
This does not include any response codes generated by the load balancer.
Default: Sum over 5 minutes
Stability: Deprecated
MetricIpv6RequestCount(IMetricOptions?)
(deprecated) The number of IPv6 requests received by the target group.
[Obsolete("Use ``ApplicationTargetGroup.metrics.ipv6RequestCount`` instead")]
public virtual Metric MetricIpv6RequestCount(IMetricOptions? props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: Sum over 5 minutes
Stability: Deprecated
MetricRequestCount(IMetricOptions?)
(deprecated) The number of requests processed over IPv4 and IPv6.
[Obsolete("Use ``ApplicationTargetGroup.metrics.requestCount`` instead")]
public virtual Metric MetricRequestCount(IMetricOptions? props = null)
Parameters
- props IMetricOptions
Returns
Remarks
This count includes only the requests with a response generated by a target of the load balancer.
Default: Sum over 5 minutes
Stability: Deprecated
MetricRequestCountPerTarget(IMetricOptions?)
(deprecated) The average number of requests received by each target in a target group.
[Obsolete("Use `ApplicationTargetGroup.metrics.requestCountPerTarget` instead")]
public virtual Metric MetricRequestCountPerTarget(IMetricOptions? props = null)
Parameters
- props IMetricOptions
Returns
Remarks
The only valid statistic is Sum. Note that this represents the average not the sum.
Default: Sum over 5 minutes
Stability: Deprecated
MetricTargetConnectionErrorCount(IMetricOptions?)
(deprecated) The number of connections that were not successfully established between the load balancer and target.
[Obsolete("Use ``ApplicationTargetGroup.metrics.targetConnectionErrorCount`` instead")]
public virtual Metric MetricTargetConnectionErrorCount(IMetricOptions? props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: Sum over 5 minutes
Stability: Deprecated
MetricTargetResponseTime(IMetricOptions?)
(deprecated) The time elapsed, in seconds, after the request leaves the load balancer until a response from the target is received.
[Obsolete("Use ``ApplicationTargetGroup.metrics.targetResponseTime`` instead")]
public virtual Metric MetricTargetResponseTime(IMetricOptions? props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: Average over 5 minutes
Stability: Deprecated
MetricTargetTLSNegotiationErrorCount(IMetricOptions?)
(deprecated) The number of TLS connections initiated by the load balancer that did not establish a session with the target.
[Obsolete("Use ``ApplicationTargetGroup.metrics.tlsNegotiationErrorCount`` instead")]
public virtual Metric MetricTargetTLSNegotiationErrorCount(IMetricOptions? props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Possible causes include a mismatch of ciphers or protocols.
Default: Sum over 5 minutes
Stability: Deprecated
MetricUnhealthyHostCount(IMetricOptions?)
(deprecated) The number of unhealthy hosts in the target group.
[Obsolete("Use ``ApplicationTargetGroup.metrics.unhealthyHostCount`` instead")]
public virtual Metric MetricUnhealthyHostCount(IMetricOptions? props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: Average over 5 minutes
Stability: Deprecated
RegisterConnectable(IConnectable, Port?)
Register a connectable as a member of this target group.
public virtual void RegisterConnectable(IConnectable connectable, Port? portRange = null)
Parameters
- connectable IConnectable
- portRange Port
Remarks
Don't call this directly. It will be called by load balancing targets.
RegisterListener(IApplicationListener, IConstruct?)
Register a listener that is load balancing to this target group.
public virtual void RegisterListener(IApplicationListener listener, IConstruct? associatingConstruct = null)
Parameters
- listener IApplicationListener
- associatingConstruct IConstruct
Remarks
Don't call this directly. It will be called by listeners.
ValidateTargetGroup()
Define an Application Target Group.
protected override string[] ValidateTargetGroup()
Returns
string[]
Overrides
Remarks
ExampleMetadata: infused