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, 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.

  • 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:

from aws_cdk.aws_apigatewayv2_integrations import HttpNlbIntegration


vpc = ec2.Vpc(self, "VPC")
lb = elbv2.NetworkLoadBalancer(self, "lb", vpc=vpc)
listener = lb.add_listener("listener", port=80)
listener.add_targets("target",
    port=80
)

http_endpoint = apigwv2.HttpApi(self, "HttpProxyPrivateApi",
    default_integration=HttpNlbIntegration("DefaultIntegration", listener)
)

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

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