Skip to content
v2.274.0

NetworkLoadBalancerProps Struct ​

Properties for a network load balancer.

Example ​

ts
declare const vpc: ec2.Vpc;

const lb = new elbv2.NetworkLoadBalancer(this, 'LB', {
  vpc,
  ipAddressType: elbv2.IpAddressType.DUAL_STACK,
  enablePrefixForIpv6SourceNat: true,
});

const listener = lb.addListener('Listener', {
  port: 1229,
  protocol: elbv2.Protocol.UDP,
});

Properties ​

clientRoutingPolicyClientRoutingPolicyclient_routing_policyClientRoutingPolicyclientRoutingPolicyClientRoutingPolicyClientRoutingPolicyClientRoutingPolicyClientRoutingPolicyClientRoutingPolicy#
The AZ affinity routing policy.

Default: AZ affinity is disabled.

crossZoneEnabledbooleancross_zone_enabledboolcrossZoneEnabledBooleanCrossZoneEnabledboolCrossZoneEnabled*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.

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

disableSecurityGroupsbooleandisable_security_groupsbooldisableSecurityGroupsBooleanDisableSecurityGroupsboolDisableSecurityGroups*bool= false#
Create a Network Load Balancer without security groups.
notes

When true, creates an NLB that cannot have security groups attached. This is useful when you need to create a traditional NLB without security group associations.

This property only takes effect when the feature flag @aws-cdk/aws-elasticloadbalancingv2:networkLoadBalancerWithSecurityGroupByDefault is enabled.

enablePrefixForIpv6SourceNatbooleanenable_prefix_for_ipv6_source_natboolenablePrefixForIpv6SourceNatBooleanEnablePrefixForIpv6SourceNatboolEnablePrefixForIpv6SourceNat*bool#
Indicates whether to use an IPv6 prefix from each subnet for source NAT.

Default: undefined - NLB default behavior is false

The IP address type must be IpAddressType.DUALSTACK.

enforceSecurityGroupInboundRulesOnPrivateLinkTrafficbooleanenforce_security_group_inbound_rules_on_private_link_trafficboolenforceSecurityGroupInboundRulesOnPrivateLinkTrafficBooleanEnforceSecurityGroupInboundRulesOnPrivateLinkTrafficboolEnforceSecurityGroupInboundRulesOnPrivateLinkTraffic*bool= true#
Indicates whether to evaluate inbound security group rules for traffic sent to a Network Load Balancer through AWS PrivateLink.
internetFacingbooleaninternet_facingboolinternetFacingBooleanInternetFacingboolInternetFacing*bool= false#
Whether the load balancer has an internet-routable address.
ipAddressTypeIpAddressTypeip_address_typeIpAddressTypeipAddressTypeIpAddressTypeIpAddressTypeIpAddressTypeIpAddressTypeIpAddressType= IpAddressType.IPV4#
The type of IP addresses to use.

If you want to add a UDP or TCP_UDP listener to the load balancer, you must choose IPv4.

loadBalancerNamestringload_balancer_namestrloadBalancerNameStringLoadBalancerNamestringLoadBalancerName*string#
Name of the load balancer.

Default: Automatically generated name.

minimumCapacityUnitnumberminimum_capacity_unitint | floatminimumCapacityUnitNumberMinimumCapacityUnitdoubleMinimumCapacityUnit*float64#
The minimum capacity (LCU) for a load balancer.

Default: undefined - ELB default is 0 LCU

securityGroupsISecurityGroup[]security_groupstyping.List[ISecurityGroup]securityGroupsList<ISecurityGroup>SecurityGroupsISecurityGroup[]SecurityGroups*[]ISecurityGroup#
Security groups to associate with this load balancer.

Default: No security groups associated with the load balancer.

subnetMappingsSubnetMapping[]subnet_mappingstyping.List[SubnetMapping]subnetMappingsList<SubnetMapping>SubnetMappingsSubnetMapping[]SubnetMappings*[]SubnetMapping#
Subnet information for the load balancer.

Default: undefined - The VPC default strategy for subnets is used

vpcIVpcvpcIVpcvpcIVpcVpcIVpcVpcIVpcrequired#
The VPC network to place the load balancer in.
vpcSubnetsSubnetSelectionvpc_subnetsSubnetSelectionvpcSubnetsSubnetSelectionVpcSubnetsSubnetSelectionVpcSubnetsSubnetSelection#
Which subnets place the load balancer in.

Default: the Vpc default strategy.

zonalShiftbooleanzonal_shiftboolzonalShiftBooleanZonalShiftboolZonalShift*bool= false#
Indicates whether zonal shift is enabled.