AWS Fundamentals Logo
AWS Fundamentals
L2 Construct

ApplicationLoadBalancer

Define an Application Load Balancer.

Import

import { ApplicationLoadBalancer } from 'aws-cdk-lib/aws-elasticloadbalancingv2';

Or use the module namespace:

import * as elasticloadbalancingv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2';
// elasticloadbalancingv2.ApplicationLoadBalancer

Properties

Configuration passed to the constructor as ApplicationLoadBalancerProps.

clientKeepAliveOptional
Duration

The client keep alive duration. The valid range is 60 to 604800 seconds (1 minute to 7 days).

Default: - Duration.seconds(3600)

desyncMitigationModeOptional
DesyncMitigationMode

Determines how the load balancer handles requests that might pose a security risk to your application.

Default: DesyncMitigationMode.DEFENSIVE

dropInvalidHeaderFieldsOptional
boolean

Indicates whether HTTP headers with invalid header fields are removed by the load balancer (true) or routed to targets (false).

Default: false

http2EnabledOptional
boolean

Indicates whether HTTP/2 is enabled.

Default: true

idleTimeoutOptional
Duration

The load balancer idle timeout, in seconds.

Default: 60

ipAddressTypeOptional
IpAddressType

The type of IP addresses to use.

Default: IpAddressType.IPV4

preserveHostHeaderOptional
boolean

Indicates whether the Application Load Balancer should preserve the host header in the HTTP request and send it to the target without any change.

Default: false

preserveXffClientPortOptional
boolean

Indicates whether the X-Forwarded-For header should preserve the source port that the client used to connect to the load balancer.

Default: false

securityGroupOptional
ISecurityGroup

Security group to associate with this load balancer.

Default: A security group is created

wafFailOpenOptional
boolean

Indicates whether to allow a WAF-enabled load balancer to route requests to targets if it is unable to forward the request to AWS WAF.

Default: false

xAmznTlsVersionAndCipherSuiteHeadersOptional
boolean

Indicates whether the two headers (x-amzn-tls-version and x-amzn-tls-cipher-suite), which contain information about the negotiated TLS version and cipher suite, are added to the client request before sending it to the target. The x-amzn-tls-version header has information about the TLS protocol version negotiated with the client, and the x-amzn-tls-cipher-suite header has information about the cipher suite negotiated with the client. Both headers are in OpenSSL format.

Default: false

xffHeaderProcessingModeOptional
XffHeaderProcessingMode

Enables you to modify, preserve, or remove the X-Forwarded-For header in the HTTP request before the Application Load Balancer sends the request to the target.

Default: XffHeaderProcessingMode.APPEND

8 properties inherited from BaseLoadBalancerProps
vpcRequiredinherited from BaseLoadBalancerProps
IVpc

The VPC network to place the load balancer in.

crossZoneEnabledOptionalinherited from BaseLoadBalancerProps
boolean

Indicates whether cross-zone load balancing is enabled.

Default: - false for Network Load Balancers and true for Application Load Balancers. This can not be `false` for Application Load Balancers.

deletionProtectionOptionalinherited from BaseLoadBalancerProps
boolean

Indicates whether deletion protection is enabled.

Default: false

denyAllIgwTrafficOptionalinherited from BaseLoadBalancerProps
boolean

Indicates whether the load balancer blocks traffic through the Internet Gateway (IGW).

Default: - false for internet-facing load balancers and true for internal load balancers

internetFacingOptionalinherited from BaseLoadBalancerProps
boolean

Whether the load balancer has an internet-routable address.

Default: false

loadBalancerNameOptionalinherited from BaseLoadBalancerProps
string

Name of the load balancer.

Default: - Automatically generated name.

minimumCapacityUnitOptionalinherited from BaseLoadBalancerProps
number

The minimum capacity (LCU) for a load balancer.

Default: undefined - ELB default is 0 LCU

vpcSubnetsOptionalinherited from BaseLoadBalancerProps
SubnetSelection

Which subnets place the load balancer in.

Default: - the Vpc default strategy.

Get the Elastic Load Balancing V2 Cheat Sheet

Everything you need to know about Elastic Load Balancing V2 on one page. HD quality, print-friendly.

Download Free Infographic