NetworkLoadBalancerProps

class aws_cdk.aws_elasticloadbalancingv2.NetworkLoadBalancerProps(*, vpc, cross_zone_enabled=None, deletion_protection=None, deny_all_igw_traffic=None, internet_facing=None, load_balancer_name=None, vpc_subnets=None, client_routing_policy=None, enable_prefix_for_ipv6_source_nat=None, enforce_security_group_inbound_rules_on_private_link_traffic=None, ip_address_type=None, security_groups=None, zonal_shift=None)

Bases: BaseLoadBalancerProps

Properties for a network load balancer.

Parameters:
  • vpc (IVpc) – The VPC network to place the load balancer in.

  • cross_zone_enabled (Optional[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.

  • deletion_protection (Optional[bool]) – Indicates whether deletion protection is enabled. Default: false

  • deny_all_igw_traffic (Optional[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

  • internet_facing (Optional[bool]) – Whether the load balancer has an internet-routable address. Default: false

  • load_balancer_name (Optional[str]) – Name of the load balancer. Default: - Automatically generated name.

  • vpc_subnets (Union[SubnetSelection, Dict[str, Any], None]) – Which subnets place the load balancer in. Default: - the Vpc default strategy.

  • client_routing_policy (Optional[ClientRoutingPolicy]) – The AZ affinity routing policy. Default: - AZ affinity is disabled.

  • enable_prefix_for_ipv6_source_nat (Optional[bool]) – 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

  • enforce_security_group_inbound_rules_on_private_link_traffic (Optional[bool]) – Indicates whether to evaluate inbound security group rules for traffic sent to a Network Load Balancer through AWS PrivateLink. Default: true

  • ip_address_type (Optional[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

  • security_groups (Optional[Sequence[ISecurityGroup]]) – Security groups to associate with this load balancer. Default: - No security groups associated with the load balancer.

  • zonal_shift (Optional[bool]) – Indicates whether zonal shift is enabled. Default: false

ExampleMetadata:

infused

Example:

# vpc: ec2.Vpc


lb = elbv2.NetworkLoadBalancer(self, "LB",
    vpc=vpc,
    ip_address_type=elbv2.IpAddressType.DUAL_STACK,
    enable_prefix_for_ipv6_source_nat=True
)

listener = lb.add_listener("Listener",
    port=1229,
    protocol=elbv2.Protocol.UDP
)

Attributes

client_routing_policy

The AZ affinity routing policy.

Default:
  • AZ affinity is disabled.

See:

https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html#zonal-dns-affinity

cross_zone_enabled

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.

See:

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-loadbalancer-loadbalancerattribute.html

deletion_protection

Indicates whether deletion protection is enabled.

Default:

false

deny_all_igw_traffic

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

enable_prefix_for_ipv6_source_nat

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

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

Default:

true

internet_facing

Whether the load balancer has an internet-routable address.

Default:

false

ip_address_type

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

load_balancer_name

Name of the load balancer.

Default:
  • Automatically generated name.

security_groups

Security groups to associate with this load balancer.

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

vpc

The VPC network to place the load balancer in.

vpc_subnets

Which subnets place the load balancer in.

Default:
  • the Vpc default strategy.

zonal_shift

Indicates whether zonal shift is enabled.

Default:

false

See:

https://docs.aws.amazon.com/elasticloadbalancing/latest/network/zonal-shift.html