Class AddApplicationTargetsProps
Properties for adding new targets to a listener.
Inheritance
Namespace: Amazon.CDK.AWS.ElasticLoadBalancingV2
Assembly: Amazon.CDK.AWS.ElasticLoadBalancingV2.dll
Syntax (csharp)
public class AddApplicationTargetsProps : Object, IAddApplicationTargetsProps, IAddRuleProps
Syntax (vb)
Public Class AddApplicationTargetsProps
Inherits Object
Implements IAddApplicationTargetsProps, IAddRuleProps
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.AutoScaling;
AutoScalingGroup asg;
Vpc vpc;
// Create the load balancer in a VPC. 'internetFacing' is 'false'
// by default, which creates an internal load balancer.
var lb = new ApplicationLoadBalancer(this, "LB", new ApplicationLoadBalancerProps {
Vpc = vpc,
InternetFacing = true
});
// Add a listener and open up the load balancer's security group
// to the world.
var listener = lb.AddListener("Listener", new BaseApplicationListenerProps {
Port = 80,
// 'open: true' is the default, you can leave it out if you want. Set it
// to 'false' and use `listener.connections` if you want to be selective
// about who can access the load balancer.
Open = true
});
// Create an AutoScaling group and add it as a load balancing
// target to the listener.
listener.AddTargets("ApplicationFleet", new AddApplicationTargetsProps {
Port = 8080,
Targets = new [] { asg }
});
Synopsis
Constructors
AddApplicationTargetsProps() |
Properties
Conditions | Rule applies if matches the conditions. |
DeregistrationDelay | The amount of time for Elastic Load Balancing to wait before deregistering a target. |
HealthCheck | Health check configuration. |
HostHeader | (deprecated) Rule applies if the requested host matches the indicated host. |
LoadBalancingAlgorithmType | The load balancing algorithm to select targets for routing requests. |
PathPattern | (deprecated) Rule applies if the requested path matches the given path pattern. |
PathPatterns | (deprecated) Rule applies if the requested path matches any of the given patterns. |
Port | The port on which the listener listens for requests. |
Priority | Priority of this target group. |
Protocol | The protocol to use. |
ProtocolVersion | The protocol version to use. |
SlowStart | The time period during which the load balancer sends a newly registered target a linearly increasing share of the traffic to the target group. |
StickinessCookieDuration | The stickiness cookie expiration period. |
StickinessCookieName | The name of an application-based stickiness cookie. |
TargetGroupName | The name of the target group. |
Targets | The targets to add to this target group. |
Constructors
AddApplicationTargetsProps()
public AddApplicationTargetsProps()
Properties
Conditions
Rule applies if matches the conditions.
public ListenerCondition[] Conditions { get; set; }
Property Value
Remarks
Default: - No conditions.
See: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html
DeregistrationDelay
The amount of time for Elastic Load Balancing to wait before deregistering a target.
public Duration DeregistrationDelay { get; set; }
Property Value
Remarks
The range is 0-3600 seconds.
Default: Duration.minutes(5)
HealthCheck
Health check configuration.
public IHealthCheck HealthCheck { get; set; }
Property Value
Remarks
Default: - The default value for each property in this configuration varies depending on the target.
HostHeader
(deprecated) Rule applies if the requested host matches the indicated host.
public string HostHeader { get; set; }
Property Value
System.String
Remarks
May contain up to three '*' wildcards.
Requires that priority is set.
Default: No host condition
Stability: Deprecated
LoadBalancingAlgorithmType
The load balancing algorithm to select targets for routing requests.
public Nullable<TargetGroupLoadBalancingAlgorithmType> LoadBalancingAlgorithmType { get; set; }
Property Value
System.Nullable<TargetGroupLoadBalancingAlgorithmType>
Remarks
Default: round_robin.
PathPattern
(deprecated) Rule applies if the requested path matches the given path pattern.
public string PathPattern { get; set; }
Property Value
System.String
Remarks
May contain up to three '*' wildcards.
Requires that priority is set.
Default: No path condition
Stability: Deprecated
PathPatterns
(deprecated) Rule applies if the requested path matches any of the given patterns.
public string[] PathPatterns { get; set; }
Property Value
System.String[]
Remarks
May contain up to three '*' wildcards.
Requires that priority is set.
Default: - No path condition.
Stability: Deprecated
Port
The port on which the listener listens for requests.
public Nullable<double> Port { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Default: Determined from protocol if known
Priority
Priority of this target group.
public Nullable<double> Priority { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
The rule with the lowest priority will be used for every request. If priority is not given, these target groups will be added as defaults, and must not have conditions.
Priorities must be unique.
Default: Target groups are used as defaults
Protocol
The protocol to use.
public Nullable<ApplicationProtocol> Protocol { get; set; }
Property Value
System.Nullable<ApplicationProtocol>
Remarks
Default: Determined from port if known
ProtocolVersion
The protocol version to use.
public Nullable<ApplicationProtocolVersion> ProtocolVersion { get; set; }
Property Value
System.Nullable<ApplicationProtocolVersion>
Remarks
Default: ApplicationProtocolVersion.HTTP1
SlowStart
The time period during which the load balancer sends a newly registered target a linearly increasing share of the traffic to the target group.
public Duration SlowStart { get; set; }
Property Value
Remarks
The range is 30-900 seconds (15 minutes).
Default: 0
StickinessCookieDuration
The stickiness cookie expiration period.
public Duration StickinessCookieDuration { get; set; }
Property Value
Remarks
Setting this value enables load balancer stickiness.
After this period, the cookie is considered stale. The minimum value is 1 second and the maximum value is 7 days (604800 seconds).
Default: Stickiness disabled
StickinessCookieName
The name of an application-based stickiness cookie.
public string StickinessCookieName { get; set; }
Property Value
System.String
Remarks
Names that start with the following prefixes are not allowed: AWSALB, AWSALBAPP, and AWSALBTG; they're reserved for use by the load balancer.
Note: stickinessCookieName
parameter depends on the presence of stickinessCookieDuration
parameter.
If stickinessCookieDuration
is not set, stickinessCookieName
will be omitted.
Default: - If stickinessCookieDuration
is set, a load-balancer generated cookie is used. Otherwise, no stickiness is defined.
See: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/sticky-sessions.html
TargetGroupName
The name of the target group.
public string TargetGroupName { get; set; }
Property Value
System.String
Remarks
This name must be unique per region per account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen.
Default: Automatically generated
Targets
The targets to add to this target group.
public IApplicationLoadBalancerTarget[] Targets { get; set; }
Property Value
IApplicationLoadBalancerTarget[]
Remarks
Can be Instance
, IPAddress
, or any self-registering load balancing
target. All target must be of the same type.