NLB

Definition

NLB stands for Network Load Balancer, a type of load balancer that operates at the transport layer (Layer 4) of the OSI model. It is designed to handle millions of requests per second while maintaining ultra-low latencies. NLB is typically used to distribute incoming network traffic across multiple targets, such as Amazon EC2 instances, containers, and IP addresses, ensuring high availability and fault tolerance.

Secure Settings Example

# AWS CloudFormation snippet for a secure NLB
Resources:
  MyNetworkLoadBalancer:
    Type: "AWS::ElasticLoadBalancingV2::LoadBalancer"
    Properties:
      Type: "network"
      Subnets:
        - subnet-12345678
        - subnet-87654321
      LoadBalancerAttributes:
        - Key: "deletion_protection.enabled"
          Value: "true"
        - Key: "access_logs.s3.enabled"
          Value: "true"
        - Key: "access_logs.s3.bucket"
          Value: "my-secure-logs-bucket"
      IpAddressType: "ipv4"

Insecure Settings Example

# AWS CloudFormation snippet with insecure NLB settings
Resources:
  MyNetworkLoadBalancer:
    Type: "AWS::ElasticLoadBalancingV2::LoadBalancer"
    Properties:
      Type: "network"
      Subnets:
        - subnet-12345678
        - subnet-87654321
      LoadBalancerAttributes:
        - Key: "deletion_protection.enabled"
          Value: "false"  # Deletion protection is disabled
        - Key: "access_logs.s3.enabled"
          Value: "false"  # Access logging is disabled
      IpAddressType: "ipv4"