Class ApplicationLoadBalancer
Define an Application Load Balancer.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.ElasticLoadBalancingV2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class ApplicationLoadBalancer : BaseLoadBalancer, IApplicationLoadBalancer, ILoadBalancerV2, IResource, IConnectable
Syntax (vb)
Public Class ApplicationLoadBalancer
Inherits BaseLoadBalancer
Implements IApplicationLoadBalancer, ILoadBalancerV2, IResource, IConnectable
Remarks
Resource: AWS::ElasticLoadBalancingV2::LoadBalancer
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
ApplicationLoadBalancer(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
ApplicationLoadBalancer(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
ApplicationLoadBalancer(Construct, String, IApplicationLoadBalancerProps) |
Properties
Connections | The network connections associated with this resource. |
IpAddressType | The IP Address Type for this load balancer. |
Listeners | A list of listeners that have been added to the load balancer. |
Metrics | All metrics available for this load balancer. |
Methods
AddListener(String, IBaseApplicationListenerProps) | Add a new listener to this load balancer. |
AddRedirect(IApplicationLoadBalancerRedirectConfig) | Add a redirection listener to this load balancer. |
AddSecurityGroup(ISecurityGroup) | Add a security group to this load balancer. |
FromApplicationLoadBalancerAttributes(Construct, String, IApplicationLoadBalancerAttributes) | Import an existing Application Load Balancer. |
FromLookup(Construct, String, IApplicationLoadBalancerLookupOptions) | Look up an application load balancer. |
LogAccessLogs(IBucket, String) | Enable access logging for this load balancer. |
LogConnectionLogs(IBucket, String) | Enable connection logging for this load balancer. |
Metric(String, IMetricOptions) | (deprecated) Return the given named metric for this Application Load Balancer. |
MetricActiveConnectionCount(IMetricOptions) | (deprecated) The total number of concurrent TCP connections active from clients to the load balancer and from the load balancer to targets. |
MetricClientTlsNegotiationErrorCount(IMetricOptions) | (deprecated) The number of TLS connections initiated by the client that did not establish a session with the load balancer. |
MetricConsumedLCUs(IMetricOptions) | (deprecated) The number of load balancer capacity units (LCU) used by your load balancer. |
MetricElbAuthError(IMetricOptions) | (deprecated) The number of user authentications that could not be completed. |
MetricElbAuthFailure(IMetricOptions) | (deprecated) The number of user authentications that could not be completed because the IdP denied access to the user or an authorization code was used more than once. |
MetricElbAuthLatency(IMetricOptions) | (deprecated) The time elapsed, in milliseconds, to query the IdP for the ID token and user info. |
MetricElbAuthSuccess(IMetricOptions) | (deprecated) The number of authenticate actions that were successful. |
MetricHttpCodeElb(HttpCodeElb, IMetricOptions) | (deprecated) The number of HTTP 3xx/4xx/5xx codes that originate from the load balancer. |
MetricHttpCodeTarget(HttpCodeTarget, IMetricOptions) | (deprecated) The number of HTTP 2xx/3xx/4xx/5xx response codes generated by all targets in the load balancer. |
MetricHttpFixedResponseCount(IMetricOptions) | (deprecated) The number of fixed-response actions that were successful. |
MetricHttpRedirectCount(IMetricOptions) | (deprecated) The number of redirect actions that were successful. |
MetricHttpRedirectUrlLimitExceededCount(IMetricOptions) | (deprecated) The number of redirect actions that couldn't be completed because the URL in the response location header is larger than 8K. |
MetricIpv6ProcessedBytes(IMetricOptions) | (deprecated) The total number of bytes processed by the load balancer over IPv6. |
MetricIpv6RequestCount(IMetricOptions) | (deprecated) The number of IPv6 requests received by the load balancer. |
MetricNewConnectionCount(IMetricOptions) | (deprecated) The total number of new TCP connections established from clients to the load balancer and from the load balancer to targets. |
MetricProcessedBytes(IMetricOptions) | (deprecated) The total number of bytes processed by the load balancer over IPv4 and IPv6. |
MetricRejectedConnectionCount(IMetricOptions) | (deprecated) The number of connections that were rejected because the load balancer had reached its maximum number of connections. |
MetricRequestCount(IMetricOptions) | (deprecated) The number of requests processed over IPv4 and IPv6. |
MetricRuleEvaluations(IMetricOptions) | (deprecated) The number of rules processed by the load balancer given a request rate averaged over an hour. |
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. |
Constructors
ApplicationLoadBalancer(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected ApplicationLoadBalancer(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
ApplicationLoadBalancer(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected ApplicationLoadBalancer(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
ApplicationLoadBalancer(Construct, String, IApplicationLoadBalancerProps)
public ApplicationLoadBalancer(Construct scope, string id, IApplicationLoadBalancerProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props IApplicationLoadBalancerProps
Properties
Connections
The network connections associated with this resource.
public virtual Connections_ Connections { get; }
Property Value
IpAddressType
The IP Address Type for this load balancer.
public virtual Nullable<IpAddressType> IpAddressType { get; }
Property Value
System.Nullable<IpAddressType>
Listeners
A list of listeners that have been added to the load balancer.
public virtual ApplicationListener[] Listeners { get; }
Property Value
Remarks
This list is only valid for owned constructs.
Metrics
All metrics available for this load balancer.
public virtual IApplicationLoadBalancerMetrics Metrics { get; }
Property Value
IApplicationLoadBalancerMetrics
Methods
AddListener(String, IBaseApplicationListenerProps)
Add a new listener to this load balancer.
public virtual ApplicationListener AddListener(string id, IBaseApplicationListenerProps props)
Parameters
- id System.String
- props IBaseApplicationListenerProps
Returns
AddRedirect(IApplicationLoadBalancerRedirectConfig)
Add a redirection listener to this load balancer.
public virtual ApplicationListener AddRedirect(IApplicationLoadBalancerRedirectConfig props = null)
Parameters
Returns
AddSecurityGroup(ISecurityGroup)
Add a security group to this load balancer.
public virtual void AddSecurityGroup(ISecurityGroup securityGroup)
Parameters
- securityGroup ISecurityGroup
FromApplicationLoadBalancerAttributes(Construct, String, IApplicationLoadBalancerAttributes)
Import an existing Application Load Balancer.
public static IApplicationLoadBalancer FromApplicationLoadBalancerAttributes(Construct scope, string id, IApplicationLoadBalancerAttributes attrs)
Parameters
- scope Constructs.Construct
- id System.String
- attrs IApplicationLoadBalancerAttributes
Returns
FromLookup(Construct, String, IApplicationLoadBalancerLookupOptions)
Look up an application load balancer.
public static IApplicationLoadBalancer FromLookup(Construct scope, string id, IApplicationLoadBalancerLookupOptions options)
Parameters
- scope Constructs.Construct
- id System.String
- options IApplicationLoadBalancerLookupOptions
Returns
LogAccessLogs(IBucket, String)
Enable access logging for this load balancer.
public override void LogAccessLogs(IBucket bucket, string prefix = null)
Parameters
- bucket IBucket
- prefix System.String
Overrides
Remarks
A region must be specified on the stack containing the load balancer; you cannot enable logging on environment-agnostic stacks. See https://docs.aws.amazon.com/cdk/latest/guide/environments.html
LogConnectionLogs(IBucket, String)
Enable connection logging for this load balancer.
public virtual void LogConnectionLogs(IBucket bucket, string prefix = null)
Parameters
- bucket IBucket
- prefix System.String
Remarks
A region must be specified on the stack containing the load balancer; you cannot enable logging on environment-agnostic stacks.
See: https://docs.aws.amazon.com/cdk/latest/guide/environments.html
Metric(String, IMetricOptions)
(deprecated) Return the given named metric for this Application Load Balancer.
public virtual Metric Metric(string metricName, IMetricOptions props = null)
Parameters
- metricName System.String
- props IMetricOptions
Returns
Remarks
Default: Average over 5 minutes
Stability: Deprecated
MetricActiveConnectionCount(IMetricOptions)
(deprecated) The total number of concurrent TCP connections active from clients to the load balancer and from the load balancer to targets.
public virtual Metric MetricActiveConnectionCount(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: Sum over 5 minutes
Stability: Deprecated
MetricClientTlsNegotiationErrorCount(IMetricOptions)
(deprecated) The number of TLS connections initiated by the client that did not establish a session with the load balancer.
public virtual Metric MetricClientTlsNegotiationErrorCount(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Possible causes include a mismatch of ciphers or protocols.
Default: Sum over 5 minutes
Stability: Deprecated
MetricConsumedLCUs(IMetricOptions)
(deprecated) The number of load balancer capacity units (LCU) used by your load balancer.
public virtual Metric MetricConsumedLCUs(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: Sum over 5 minutes
Stability: Deprecated
MetricElbAuthError(IMetricOptions)
(deprecated) The number of user authentications that could not be completed.
public virtual Metric MetricElbAuthError(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Because an authenticate action was misconfigured, the load balancer couldn't establish a connection with the IdP, or the load balancer couldn't complete the authentication flow due to an internal error.
Default: Sum over 5 minutes
Stability: Deprecated
MetricElbAuthFailure(IMetricOptions)
(deprecated) The number of user authentications that could not be completed because the IdP denied access to the user or an authorization code was used more than once.
public virtual Metric MetricElbAuthFailure(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: Sum over 5 minutes
Stability: Deprecated
MetricElbAuthLatency(IMetricOptions)
(deprecated) The time elapsed, in milliseconds, to query the IdP for the ID token and user info.
public virtual Metric MetricElbAuthLatency(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
If one or more of these operations fail, this is the time to failure.
Default: Average over 5 minutes
Stability: Deprecated
MetricElbAuthSuccess(IMetricOptions)
(deprecated) The number of authenticate actions that were successful.
public virtual Metric MetricElbAuthSuccess(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
This metric is incremented at the end of the authentication workflow, after the load balancer has retrieved the user claims from the IdP.
Default: Sum over 5 minutes
Stability: Deprecated
MetricHttpCodeElb(HttpCodeElb, IMetricOptions)
(deprecated) The number of HTTP 3xx/4xx/5xx codes that originate from the load balancer.
public virtual Metric MetricHttpCodeElb(HttpCodeElb code, IMetricOptions props = null)
Parameters
- code HttpCodeElb
- props IMetricOptions
Returns
Remarks
This does not include any response codes generated by the targets.
Default: Sum over 5 minutes
Stability: Deprecated
MetricHttpCodeTarget(HttpCodeTarget, IMetricOptions)
(deprecated) The number of HTTP 2xx/3xx/4xx/5xx response codes generated by all targets in the load balancer.
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
MetricHttpFixedResponseCount(IMetricOptions)
(deprecated) The number of fixed-response actions that were successful.
public virtual Metric MetricHttpFixedResponseCount(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: Sum over 5 minutes
Stability: Deprecated
MetricHttpRedirectCount(IMetricOptions)
(deprecated) The number of redirect actions that were successful.
public virtual Metric MetricHttpRedirectCount(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: Sum over 5 minutes
Stability: Deprecated
MetricHttpRedirectUrlLimitExceededCount(IMetricOptions)
(deprecated) The number of redirect actions that couldn't be completed because the URL in the response location header is larger than 8K.
public virtual Metric MetricHttpRedirectUrlLimitExceededCount(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: Sum over 5 minutes
Stability: Deprecated
MetricIpv6ProcessedBytes(IMetricOptions)
(deprecated) The total number of bytes processed by the load balancer over IPv6.
public virtual Metric MetricIpv6ProcessedBytes(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: Sum over 5 minutes
Stability: Deprecated
MetricIpv6RequestCount(IMetricOptions)
(deprecated) The number of IPv6 requests received by the load balancer.
public virtual Metric MetricIpv6RequestCount(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: Sum over 5 minutes
Stability: Deprecated
MetricNewConnectionCount(IMetricOptions)
(deprecated) The total number of new TCP connections established from clients to the load balancer and from the load balancer to targets.
public virtual Metric MetricNewConnectionCount(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: Sum over 5 minutes
Stability: Deprecated
MetricProcessedBytes(IMetricOptions)
(deprecated) The total number of bytes processed by the load balancer over IPv4 and IPv6.
public virtual Metric MetricProcessedBytes(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: Sum over 5 minutes
Stability: Deprecated
MetricRejectedConnectionCount(IMetricOptions)
(deprecated) The number of connections that were rejected because the load balancer had reached its maximum number of connections.
public virtual Metric MetricRejectedConnectionCount(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.
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
MetricRuleEvaluations(IMetricOptions)
(deprecated) The number of rules processed by the load balancer given a request rate averaged over an hour.
public virtual Metric MetricRuleEvaluations(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
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.
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.
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.
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