# ApplicationLoadBalancerProps

Properties for defining an Application Load Balancer.

Extends: ApplicationLoadBalancerProps
Extends: BaseLoadBalancerProps
Used as props by: ApplicationLoadBalancer

- Source: [`aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts#L32)
- Type last changed: v2.137.0 · 11 Apr 2024

## Example

```ts
import { AutoScalingGroup } from 'aws-cdk-lib/aws-autoscaling';
declare const asg: AutoScalingGroup;
declare const vpc: ec2.Vpc;

// Create the load balancer in a VPC. 'internetFacing' is 'false'
// by default, which creates an internal load balancer.
const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', {
  vpc,
  internetFacing: true
});

// Add a listener and open up the load balancer's security group
// to the world.
const listener = lb.addListener('Listener', {
  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', {
  port: 8080,
  targets: [asg]
});
```

## Properties

- `clientKeepAlive`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = Duration.seconds(3600) — The client keep alive duration.

  The valid range is 60 to 604800 seconds (1 minute to 7 days).

- `crossZoneEnabled`: 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.

- `deletionProtection`: boolean = false — Indicates whether deletion protection is enabled.

- `denyAllIgwTraffic`: 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

- `desyncMitigationMode`: [DesyncMitigationMode](/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.DesyncMitigationMode.html) = DesyncMitigationMode.DEFENSIVE — Determines how the load balancer handles requests that might pose a security risk to your application.

- `dropInvalidHeaderFields`: boolean = false — Indicates whether HTTP headers with invalid header fields are removed by the load balancer (true) or routed to targets (false).

- `http2Enabled`: boolean = true — Indicates whether HTTP/2 is enabled.

- `idleTimeout`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = 60 — The load balancer idle timeout, in seconds.

- `internetFacing`: boolean = false — Whether the load balancer has an internet-routable address.

- `ipAddressType`: [IpAddressType](/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.IpAddressType.html) = IpAddressType.IPV4 — The type of IP addresses to use.

- `loadBalancerName`: string — Name of the load balancer.

  **Default:** Automatically generated name.

- `minimumCapacityUnit`: number — The minimum capacity (LCU) for a load balancer.

  **Default:** undefined - ELB default is 0 LCU

- `preserveHostHeader`: boolean = false — Indicates whether the Application Load Balancer should preserve the host header in the HTTP request and send it to the target without any change.

- `preserveXffClientPort`: boolean = false — Indicates whether the X-Forwarded-For header should preserve the source port that the client used to connect to the load balancer.

- `securityGroup`: [ISecurityGroup](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.ISecurityGroup.html) — Security group to associate with this load balancer.

  **Default:** A security group is created

- `vpc`: [IVpc](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) (required) — The VPC network to place the load balancer in.

- `vpcSubnets`: [SubnetSelection](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.SubnetSelection.html) — Which subnets place the load balancer in.

  **Default:** the Vpc default strategy.

- `wafFailOpen`: boolean = false — 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.

- `xAmznTlsVersionAndCipherSuiteHeaders`: boolean = false — 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.

- `xffHeaderProcessingMode`: [XffHeaderProcessingMode](/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.XffHeaderProcessingMode.html) = XffHeaderProcessingMode.APPEND — 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.
