# BaseLoadBalancer

Base class for both Application and Network Load Balancers.

Extends: Construct › Resource › BaseLoadBalancer
Implements: IResource, IEnvironmentAware, IConstruct, IDependable
Superclass of: ApplicationLoadBalancer, NetworkLoadBalancer

- Source: [`aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts#L217)
- Type last changed: v2.234.0 · 8 Jan 2026

## Initializer

```ts
new BaseLoadBalancer(scope: Construct, id: string, baseProps: BaseLoadBalancerProps, additionalProps: any)
```

## Construct Props

- `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](/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.

## Properties

- `env`: [ResourceEnvironment](/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) — The environment this resource belongs to.

  For resources that are created and managed in a Stack (those created by
  creating new class instances like `new Role()`, `new Bucket()`, etc.), this
  is always the same as the environment of the stack they belong to.

  For referenced resources (those obtained from referencing methods like
  `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
  different than the stack they were imported into.

- `loadBalancerArn`: string — The ARN of this load balancer.

  Example value: `arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-internal-load-balancer/50dc6c495c0c9188`

- `loadBalancerCanonicalHostedZoneId`: string — The canonical hosted zone ID of this load balancer.

  Example value: `Z2P70J7EXAMPLE`

- `loadBalancerDnsName`: string — The DNS name of this load balancer.

  Example value: `my-load-balancer-424835706.us-west-2.elb.amazonaws.com`

- `loadBalancerFullName`: string — The full name of this load balancer.

  Example value: `app/my-load-balancer/50dc6c495c0c9188`

- `loadBalancerName`: string — The name of this load balancer.

  Example value: `my-load-balancer`

- `loadBalancerRef`: [LoadBalancerReference](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_elasticloadbalancingv2.LoadBalancerReference.html) — A reference to this load balancer.

- `loadBalancerSecurityGroups`: string[]

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `stack`: [Stack](/cdk/api/v2/docs/aws-cdk-lib.Stack.html) — The stack in which this resource is defined.

- `vpc`: [IVpc](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) — The VPC this load balancer has been created in.

  This property is always defined (not `null` or `undefined`) for sub-classes of `BaseLoadBalancer`.

## Methods

- `applyCrossStackReferenceStrength(strength: ReferenceStrength): void` — Override the cross-stack reference strength for this resource.

  When set, any cross-stack reference to this resource will use the specified
  mechanism instead of the global default determined by the
  `@aws-cdk/core:defaultCrossStackReferences` context key. This is useful for
  selectively weakening specific references to avoid the "deadly embrace" problem
  without changing the app-wide default.

  **Parameters**

  - `strength` — - The reference strength to use for this resource.

- `applyRemovalPolicy(policy: RemovalPolicy): void` — Apply the given removal policy to this resource.

  The Removal Policy controls what happens to this resource when it stops
  being managed by CloudFormation, either because you've removed it from the
  CDK application or because you've made a change that requires the resource
  to be replaced.

  The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
  account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).

- `isConstruct(x: any): boolean` (static) — Checks if `x` is a construct.

  Use this method instead of `instanceof` to properly detect `Construct`
  instances, even when the construct library is symlinked.

  Explanation: in JavaScript, multiple copies of the `constructs` library on
  disk are seen as independent, completely different libraries. As a
  consequence, the class `Construct` in each copy of the `constructs` library
  is seen as a different class, and an instance of one class will not test as
  `instanceof` the other class. `npm install` will not create installations
  like this, but users may manually symlink construct libraries together or
  use a monorepo tool: in those cases, multiple copies of the `constructs`
  library can be accidentally installed, and `instanceof` will behave
  unpredictably. It is safest to avoid using `instanceof`, and using
  this type-testing method instead.

  **Parameters**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Construct`.

- `isOwnedResource(construct: IConstruct): boolean` (static) — Returns true if the construct was created by CDK, and false otherwise.

- `isResource(construct: IConstruct): boolean` (static) — Check whether the given construct is a Resource.

- `logAccessLogs(bucket: IBucket, prefix?: string): void` — Enable access logging for this load balancer.

  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

- `removeAttribute(key: string): void` — Remove an attribute from the load balancer.

- `setAttribute(key: string, value?: string): void` — Set a non-standard attribute on the load balancer.

- `toString(): string` — Returns a string representation of this construct.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.
  Use multiple `with()` calls if subsequent mixins should apply to added
  constructs.
