AWS Fundamentals Logo
AWS Fundamentals
L2 Construct

NetworkLoadBalancer

Define a new network load balancer.

Import

import { NetworkLoadBalancer } from 'aws-cdk-lib/aws-elasticloadbalancingv2';

Or use the module namespace:

import * as elasticloadbalancingv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2';
// elasticloadbalancingv2.NetworkLoadBalancer

Properties

Configuration passed to the constructor as NetworkLoadBalancerProps.

clientRoutingPolicyOptional
ClientRoutingPolicy

The AZ affinity routing policy.

Default: - AZ affinity is disabled.

disableSecurityGroupsOptional
boolean

Create a Network Load Balancer without security groups. 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.

Default: false

enablePrefixForIpv6SourceNatOptional
boolean

Indicates whether to use an IPv6 prefix from each subnet for source NAT. The IP address type must be IpAddressType.DUALSTACK.

Default: undefined - NLB default behavior is false

enforceSecurityGroupInboundRulesOnPrivateLinkTrafficOptional
boolean

Indicates whether to evaluate inbound security group rules for traffic sent to a Network Load Balancer through AWS PrivateLink.

Default: true

ipAddressTypeOptional
IpAddressType

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.

Default: IpAddressType.IPV4

securityGroupsOptional
ISecurityGroup[]

Security groups to associate with this load balancer.

Default: - No security groups associated with the load balancer.

subnetMappingsOptional
SubnetMapping[]

Subnet information for the load balancer.

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

zonalShiftOptional
boolean

Indicates whether zonal shift is enabled.

Default: false

8 properties inherited from BaseLoadBalancerProps
vpcRequiredinherited from BaseLoadBalancerProps
IVpc

The VPC network to place the load balancer in.

crossZoneEnabledOptionalinherited from BaseLoadBalancerProps
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.

deletionProtectionOptionalinherited from BaseLoadBalancerProps
boolean

Indicates whether deletion protection is enabled.

Default: false

denyAllIgwTrafficOptionalinherited from BaseLoadBalancerProps
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

internetFacingOptionalinherited from BaseLoadBalancerProps
boolean

Whether the load balancer has an internet-routable address.

Default: false

loadBalancerNameOptionalinherited from BaseLoadBalancerProps
string

Name of the load balancer.

Default: - Automatically generated name.

minimumCapacityUnitOptionalinherited from BaseLoadBalancerProps
number

The minimum capacity (LCU) for a load balancer.

Default: undefined - ELB default is 0 LCU

vpcSubnetsOptionalinherited from BaseLoadBalancerProps
SubnetSelection

Which subnets place the load balancer in.

Default: - the Vpc default strategy.

Get the Elastic Load Balancing V2 Cheat Sheet

Everything you need to know about Elastic Load Balancing V2 on one page. HD quality, print-friendly.

Download Free Infographic