Class ApplicationTargetGroup
Define an Application Target Group.
Inherited Members
Namespace: Amazon.CDK.AWS.ElasticLoadBalancingV2
Assembly: Amazon.CDK.AWS.ElasticLoadBalancingV2.dll
Syntax (csharp)
public class ApplicationTargetGroup : TargetGroupBase, IApplicationTargetGroup, ITargetGroup, IConstruct, IDependable
Syntax (vb)
Public Class ApplicationTargetGroup
Inherits TargetGroupBase
Implements IApplicationTargetGroup, ITargetGroup, IConstruct, IDependable
Remarks
ExampleMetadata: infused
Examples
Vpc vpc;
// Target group with duration-based stickiness with load-balancer generated cookie
var tg1 = new ApplicationTargetGroup(this, "TG1", new ApplicationTargetGroupProps {
TargetType = TargetType.INSTANCE,
Port = 80,
StickinessCookieDuration = Duration.Minutes(5),
Vpc = vpc
});
// Target group with application-based stickiness
var tg2 = new ApplicationTargetGroup(this, "TG2", new ApplicationTargetGroupProps {
TargetType = TargetType.INSTANCE,
Port = 80,
StickinessCookieDuration = Duration.Minutes(5),
StickinessCookieName = "MyDeliciousCookie",
Vpc = vpc
});
Synopsis
Constructors
ApplicationTargetGroup(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
ApplicationTargetGroup(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
ApplicationTargetGroup(Construct, String, IApplicationTargetGroupProps) |
Properties
FirstLoadBalancerFullName | Full name of first load balancer. |
Methods
AddTarget(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. |
Import(Construct, String, ITargetGroupImportProps) | (deprecated) Import an existing target group. |
Metric(String, IMetricOptions) | Return the given named metric for this Application Load Balancer Target Group. |
MetricHealthyHostCount(IMetricOptions) | The number of healthy hosts in the target group. |
MetricHttpCodeTarget(HttpCodeTarget, IMetricOptions) | The number of HTTP 2xx/3xx/4xx/5xx response codes generated by all targets in this target group. |
MetricIpv6RequestCount(IMetricOptions) | The number of IPv6 requests received by the target group. |
MetricRequestCount(IMetricOptions) | The number of requests processed over IPv4 and IPv6. |
MetricRequestCountPerTarget(IMetricOptions) | The average number of requests received by each target in a target group. |
MetricTargetConnectionErrorCount(IMetricOptions) | The number of connections that were not successfully established between the load balancer and target. |
MetricTargetResponseTime(IMetricOptions) | The time elapsed, in seconds, after the request leaves the load balancer until a response from the target is received. |
MetricTargetTLSNegotiationErrorCount(IMetricOptions) | The number of TLS connections initiated by the load balancer that did not establish a session with the target. |
MetricUnhealthyHostCount(IMetricOptions) | 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. |
Validate() | Validate the current construct. |
Constructors
ApplicationTargetGroup(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected ApplicationTargetGroup(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
ApplicationTargetGroup(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected ApplicationTargetGroup(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
ApplicationTargetGroup(Construct, String, IApplicationTargetGroupProps)
public ApplicationTargetGroup(Construct scope, string id, IApplicationTargetGroupProps props = null)
Parameters
- scope Constructs.Construct
- id System.String
- props IApplicationTargetGroupProps
Properties
FirstLoadBalancerFullName
Full name of first load balancer.
public override string FirstLoadBalancerFullName { get; }
Property Value
System.String
Overrides
Methods
AddTarget(IApplicationLoadBalancerTarget[])
Add a load balancing target to this target group.
public virtual void AddTarget(params IApplicationLoadBalancerTarget[] targets)
Parameters
- targets IApplicationLoadBalancerTarget[]
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
- duration Duration
- cookieName System.String
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 Constructs.Construct
- id System.String
- attrs ITargetGroupAttributes
Returns
Import(Construct, String, ITargetGroupImportProps)
(deprecated) Import an existing target group.
public static IApplicationTargetGroup Import(Construct scope, string id, ITargetGroupImportProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props ITargetGroupImportProps
Returns
Remarks
Stability: Deprecated
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 System.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)
The number of healthy hosts in the target group.
public virtual Metric MetricHealthyHostCount(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: Average over 5 minutes
MetricHttpCodeTarget(HttpCodeTarget, IMetricOptions)
The number of HTTP 2xx/3xx/4xx/5xx response codes generated by all targets in this target group.
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
MetricIpv6RequestCount(IMetricOptions)
The number of IPv6 requests received by the target group.
public virtual Metric MetricIpv6RequestCount(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: Sum over 5 minutes
MetricRequestCount(IMetricOptions)
The number of requests processed over IPv4 and IPv6.
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
MetricRequestCountPerTarget(IMetricOptions)
The average number of requests received by each target in a target group.
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
MetricTargetConnectionErrorCount(IMetricOptions)
The number of connections that were not successfully established between the load balancer and target.
public virtual Metric MetricTargetConnectionErrorCount(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: Sum over 5 minutes
MetricTargetResponseTime(IMetricOptions)
The time elapsed, in seconds, after the request leaves the load balancer until a response from the target is received.
public virtual Metric MetricTargetResponseTime(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: Average over 5 minutes
MetricTargetTLSNegotiationErrorCount(IMetricOptions)
The number of TLS connections initiated by the load balancer that did not establish a session with the target.
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
MetricUnhealthyHostCount(IMetricOptions)
The number of unhealthy hosts in the target group.
public virtual Metric MetricUnhealthyHostCount(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: Average over 5 minutes
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 Constructs.IConstruct
Remarks
Don't call this directly. It will be called by listeners.
Validate()
Validate the current construct.
protected override string[] Validate()
Returns
System.String[]
Overrides
Remarks
This method can be implemented by derived constructs in order to perform validation logic. It is called on all constructs before synthesis.