Skip to content
v2.277.0

BaseLoadBalancerProps Struct ​

Shared properties of both Application and Network Load Balancers.

Example ​

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
# 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
// 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();
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
    }
};
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 ​

crossZoneEnabledoptionalbooleancross_zone_enabledoptionalboolcrossZoneEnabledoptionalBooleanCrossZoneEnabledoptionalboolCrossZoneEnabledoptional*bool #
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.

deletionProtectionoptionalbooleandeletion_protectionoptionalbooldeletionProtectionoptionalBooleanDeletionProtectionoptionalboolDeletionProtectionoptional*bool = false #
Indicates whether deletion protection is enabled.
denyAllIgwTrafficoptionalbooleandeny_all_igw_trafficoptionalbooldenyAllIgwTrafficoptionalBooleanDenyAllIgwTrafficoptionalboolDenyAllIgwTrafficoptional*bool #
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

internetFacingoptionalbooleaninternet_facingoptionalboolinternetFacingoptionalBooleanInternetFacingoptionalboolInternetFacingoptional*bool = false #
Whether the load balancer has an internet-routable address.
loadBalancerNameoptionalstringload_balancer_nameoptionalstrloadBalancerNameoptionalStringLoadBalancerNameoptionalstringLoadBalancerNameoptional*string #
Name of the load balancer.

Default: Automatically generated name.

minimumCapacityUnitoptionalnumberminimum_capacity_unitoptionalint | floatminimumCapacityUnitoptionalNumberMinimumCapacityUnitoptionaldoubleMinimumCapacityUnitoptional*float64 #
The minimum capacity (LCU) for a load balancer.

Default: undefined - ELB default is 0 LCU

vpcIVpcvpcIVpcvpcIVpcVpcIVpcVpcIVpc required #
The VPC network to place the load balancer in.
vpcSubnetsoptionalSubnetSelectionvpc_subnetsoptionalSubnetSelectionvpcSubnetsoptionalSubnetSelectionVpcSubnetsoptionalSubnetSelectionVpcSubnetsoptionalSubnetSelection #
Which subnets place the load balancer in.

Default: the Vpc default strategy.