# BaseLoadBalancerProps

Shared properties of both Application and Network Load Balancers.

Used as props by: [BaseLoadBalancer](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.BaseLoadBalancer.html)

- Source: [`aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts#L98)
- Type last changed: v2.179.0 · 18 Feb 2025

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
import { aws_elasticloadbalancingv2 as elbv2 } from 'aws-cdk-lib';

declare const subnet: ec2.Subnet;
declare const subnetFilter: ec2.SubnetFilter;
declare const vpc: ec2.Vpc;
const baseLoadBalancerProps: elbv2.BaseLoadBalancerProps = {
  vpc: vpc,

  // the properties below are optional
  crossZoneEnabled: false,
  deletionProtection: false,
  denyAllIgwTraffic: false,
  internetFacing: false,
  loadBalancerName: 'loadBalancerName',
  minimumCapacityUnit: 123,
  vpcSubnets: {
    availabilityZones: ['availabilityZones'],
    onePerAz: false,
    subnetFilters: [subnetFilter],
    subnetGroupName: 'subnetGroupName',
    subnets: [subnet],
    subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
  },
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ec2 as ec2
from aws_cdk import aws_elasticloadbalancingv2 as elbv2

# subnet: ec2.Subnet
# subnet_filter: ec2.SubnetFilter
# vpc: ec2.Vpc

base_load_balancer_props = elbv2.BaseLoadBalancerProps(
    vpc=vpc,

    # the properties below are optional
    cross_zone_enabled=False,
    deletion_protection=False,
    deny_all_igw_traffic=False,
    internet_facing=False,
    load_balancer_name="loadBalancerName",
    minimum_capacity_unit=123,
    vpc_subnets=ec2.SubnetSelection(
        availability_zones=["availabilityZones"],
        one_per_az=False,
        subnet_filters=[subnet_filter],
        subnet_group_name="subnetGroupName",
        subnets=[subnet],
        subnet_type=ec2.SubnetType.PRIVATE_ISOLATED
    )
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ec2.*;
import software.amazon.awscdk.services.elasticloadbalancingv2.*;

Subnet subnet;
SubnetFilter subnetFilter;
Vpc vpc;

BaseLoadBalancerProps baseLoadBalancerProps = BaseLoadBalancerProps.builder()
        .vpc(vpc)

        // the properties below are optional
        .crossZoneEnabled(false)
        .deletionProtection(false)
        .denyAllIgwTraffic(false)
        .internetFacing(false)
        .loadBalancerName("loadBalancerName")
        .minimumCapacityUnit(123)
        .vpcSubnets(SubnetSelection.builder()
                .availabilityZones(List.of("availabilityZones"))
                .onePerAz(false)
                .subnetFilters(List.of(subnetFilter))
                .subnetGroupName("subnetGroupName")
                .subnets(List.of(subnet))
                .subnetType(SubnetType.PRIVATE_ISOLATED)
                .build())
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.EC2;
using Amazon.CDK.AWS.ElasticLoadBalancingV2;

Subnet subnet;
SubnetFilter subnetFilter;
Vpc vpc;

var baseLoadBalancerProps = new BaseLoadBalancerProps {
    Vpc = vpc,

    // the properties below are optional
    CrossZoneEnabled = false,
    DeletionProtection = false,
    DenyAllIgwTraffic = false,
    InternetFacing = false,
    LoadBalancerName = "loadBalancerName",
    MinimumCapacityUnit = 123,
    VpcSubnets = new SubnetSelection {
        AvailabilityZones = new [] { "availabilityZones" },
        OnePerAz = false,
        SubnetFilters = new [] { subnetFilter },
        SubnetGroupName = "subnetGroupName",
        Subnets = new [] { subnet },
        SubnetType = SubnetType.PRIVATE_ISOLATED
    }
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var subnet Subnet
var subnetFilter SubnetFilter
var vpc Vpc

baseLoadBalancerProps := &BaseLoadBalancerProps{
	Vpc: vpc,

	// the properties below are optional
	CrossZoneEnabled: jsii.Boolean(false),
	DeletionProtection: jsii.Boolean(false),
	DenyAllIgwTraffic: jsii.Boolean(false),
	InternetFacing: jsii.Boolean(false),
	LoadBalancerName: jsii.String("loadBalancerName"),
	MinimumCapacityUnit: jsii.Number(123),
	VpcSubnets: &SubnetSelection{
		AvailabilityZones: []*string{
			jsii.String("availabilityZones"),
		},
		OnePerAz: jsii.Boolean(false),
		SubnetFilters: []SubnetFilter{
			subnetFilter,
		},
		SubnetGroupName: jsii.String("subnetGroupName"),
		Subnets: []ISubnet{
			subnet,
		},
		SubnetType: awscdk.Aws_ec2.SubnetType_PRIVATE_ISOLATED,
	},
}
```

## Properties

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

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

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

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

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

  **Default:** the Vpc default strategy.
