Class: AWSCDK::ElasticLoadBalancingv2::NetworkLoadBalancerProps

Inherits:
BaseLoadBalancerProps
  • Object
show all
Defined in:
elastic_load_balancingv2/network_load_balancer_props.rb

Overview

Properties for a network load balancer.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(vpc:, cross_zone_enabled: nil, deletion_protection: nil, deny_all_igw_traffic: nil, internet_facing: nil, load_balancer_name: nil, minimum_capacity_unit: nil, vpc_subnets: nil, client_routing_policy: nil, disable_security_groups: nil, enable_prefix_for_ipv6_source_nat: nil, enforce_security_group_inbound_rules_on_private_link_traffic: nil, ip_address_type: nil, security_groups: nil, subnet_mappings: nil, zonal_shift: nil) ⇒ NetworkLoadBalancerProps

Returns a new instance of NetworkLoadBalancerProps.

Parameters:

  • vpc (AWSCDK::EC2::IVPC)

    The VPC network to place the load balancer in.

  • cross_zone_enabled (Boolean, nil) (defaults to: nil)

    Indicates whether cross-zone load balancing is enabled.

  • deletion_protection (Boolean, nil) (defaults to: nil)

    Indicates whether deletion protection is enabled.

  • deny_all_igw_traffic (Boolean, nil) (defaults to: nil)

    Indicates whether the load balancer blocks traffic through the Internet Gateway (IGW).

  • internet_facing (Boolean, nil) (defaults to: nil)

    Whether the load balancer has an internet-routable address.

  • load_balancer_name (String, nil) (defaults to: nil)

    Name of the load balancer.

  • minimum_capacity_unit (Numeric, nil) (defaults to: nil)

    The minimum capacity (LCU) for a load balancer.

  • vpc_subnets (AWSCDK::EC2::SubnetSelection, nil) (defaults to: nil)

    Which subnets place the load balancer in.

  • client_routing_policy (AWSCDK::ElasticLoadBalancingv2::ClientRoutingPolicy, nil) (defaults to: nil)

    The AZ affinity routing policy.

  • disable_security_groups (Boolean, nil) (defaults to: nil)

    Create a Network Load Balancer without security groups.

  • enable_prefix_for_ipv6_source_nat (Boolean, nil) (defaults to: nil)

    Indicates whether to use an IPv6 prefix from each subnet for source NAT.

  • enforce_security_group_inbound_rules_on_private_link_traffic (Boolean, nil) (defaults to: nil)

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

  • ip_address_type (AWSCDK::ElasticLoadBalancingv2::IPAddressType, nil) (defaults to: nil)

    The type of IP addresses to use.

  • security_groups (Array<AWSCDK::EC2::ISecurityGroup>, nil) (defaults to: nil)

    Security groups to associate with this load balancer.

  • subnet_mappings (Array<AWSCDK::ElasticLoadBalancingv2::SubnetMapping>, nil) (defaults to: nil)

    Subnet information for the load balancer.

  • zonal_shift (Boolean, nil) (defaults to: nil)

    Indicates whether zonal shift is enabled.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'elastic_load_balancingv2/network_load_balancer_props.rb', line 23

def initialize(vpc:, cross_zone_enabled: nil, deletion_protection: nil, deny_all_igw_traffic: nil, internet_facing: nil, load_balancer_name: nil, minimum_capacity_unit: nil, vpc_subnets: nil, client_routing_policy: nil, disable_security_groups: nil, enable_prefix_for_ipv6_source_nat: nil, enforce_security_group_inbound_rules_on_private_link_traffic: nil, ip_address_type: nil, security_groups: nil, subnet_mappings: nil, zonal_shift: nil)
  @vpc = vpc
  Jsii::Type.check_type(@vpc, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklWcGMifQ==")), "vpc")
  @cross_zone_enabled = cross_zone_enabled
  Jsii::Type.check_type(@cross_zone_enabled, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "crossZoneEnabled") unless @cross_zone_enabled.nil?
  @deletion_protection = deletion_protection
  Jsii::Type.check_type(@deletion_protection, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "deletionProtection") unless @deletion_protection.nil?
  @deny_all_igw_traffic = deny_all_igw_traffic
  Jsii::Type.check_type(@deny_all_igw_traffic, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "denyAllIgwTraffic") unless @deny_all_igw_traffic.nil?
  @internet_facing = internet_facing
  Jsii::Type.check_type(@internet_facing, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "internetFacing") unless @internet_facing.nil?
  @load_balancer_name = load_balancer_name
  Jsii::Type.check_type(@load_balancer_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "loadBalancerName") unless @load_balancer_name.nil?
  @minimum_capacity_unit = minimum_capacity_unit
  Jsii::Type.check_type(@minimum_capacity_unit, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "minimumCapacityUnit") unless @minimum_capacity_unit.nil?
  @vpc_subnets = vpc_subnets.is_a?(Hash) ? ::AWSCDK::EC2::SubnetSelection.new(**vpc_subnets.transform_keys(&:to_sym)) : vpc_subnets
  Jsii::Type.check_type(@vpc_subnets, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlN1Ym5ldFNlbGVjdGlvbiJ9")), "vpcSubnets") unless @vpc_subnets.nil?
  @client_routing_policy = client_routing_policy
  Jsii::Type.check_type(@client_routing_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWxhc3RpY2xvYWRiYWxhbmNpbmd2Mi5DbGllbnRSb3V0aW5nUG9saWN5In0=")), "clientRoutingPolicy") unless @client_routing_policy.nil?
  @disable_security_groups = disable_security_groups
  Jsii::Type.check_type(@disable_security_groups, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "disableSecurityGroups") unless @disable_security_groups.nil?
  @enable_prefix_for_ipv6_source_nat = enable_prefix_for_ipv6_source_nat
  Jsii::Type.check_type(@enable_prefix_for_ipv6_source_nat, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enablePrefixForIpv6SourceNat") unless @enable_prefix_for_ipv6_source_nat.nil?
  @enforce_security_group_inbound_rules_on_private_link_traffic = enforce_security_group_inbound_rules_on_private_link_traffic
  Jsii::Type.check_type(@enforce_security_group_inbound_rules_on_private_link_traffic, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enforceSecurityGroupInboundRulesOnPrivateLinkTraffic") unless @enforce_security_group_inbound_rules_on_private_link_traffic.nil?
  @ip_address_type = ip_address_type
  Jsii::Type.check_type(@ip_address_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWxhc3RpY2xvYWRiYWxhbmNpbmd2Mi5JcEFkZHJlc3NUeXBlIn0=")), "ipAddressType") unless @ip_address_type.nil?
  @security_groups = security_groups
  Jsii::Type.check_type(@security_groups, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuSVNlY3VyaXR5R3JvdXAifSwia2luZCI6ImFycmF5In19")), "securityGroups") unless @security_groups.nil?
  @subnet_mappings = subnet_mappings.is_a?(Array) ? subnet_mappings.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::ElasticLoadBalancingv2::SubnetMapping.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : subnet_mappings
  Jsii::Type.check_type(@subnet_mappings, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lbGFzdGljbG9hZGJhbGFuY2luZ3YyLlN1Ym5ldE1hcHBpbmcifSwia2luZCI6ImFycmF5In19")), "subnetMappings") unless @subnet_mappings.nil?
  @zonal_shift = zonal_shift
  Jsii::Type.check_type(@zonal_shift, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "zonalShift") unless @zonal_shift.nil?
end

Instance Attribute Details

#client_routing_policyAWSCDK::ElasticLoadBalancingv2::ClientRoutingPolicy? (readonly)

Note:

Default: - AZ affinity is disabled.

The AZ affinity routing policy.



104
105
106
# File 'elastic_load_balancingv2/network_load_balancer_props.rb', line 104

def client_routing_policy
  @client_routing_policy
end

#cross_zone_enabledBoolean? (readonly)

Note:

Default: - false for Network Load Balancers and true for Application Load Balancers. This can not be false for Application Load Balancers.

Indicates whether cross-zone load balancing is enabled.



67
68
69
# File 'elastic_load_balancingv2/network_load_balancer_props.rb', line 67

def cross_zone_enabled
  @cross_zone_enabled
end

#deletion_protectionBoolean? (readonly)

Note:

Default: false

Indicates whether deletion protection is enabled.

Returns:

  • (Boolean, nil)


72
73
74
# File 'elastic_load_balancingv2/network_load_balancer_props.rb', line 72

def deletion_protection
  @deletion_protection
end

#deny_all_igw_trafficBoolean? (readonly)

Note:

Default: - false for internet-facing load balancers and true for internal load balancers

Indicates whether the load balancer blocks traffic through the Internet Gateway (IGW).

Returns:

  • (Boolean, nil)


77
78
79
# File 'elastic_load_balancingv2/network_load_balancer_props.rb', line 77

def deny_all_igw_traffic
  @deny_all_igw_traffic
end

#disable_security_groupsBoolean? (readonly)

Note:

Default: false

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.

Returns:

  • (Boolean, nil)


115
116
117
# File 'elastic_load_balancingv2/network_load_balancer_props.rb', line 115

def disable_security_groups
  @disable_security_groups
end

#enable_prefix_for_ipv6_source_natBoolean? (readonly)

Note:

Default: undefined - NLB default behavior is false

Indicates whether to use an IPv6 prefix from each subnet for source NAT.

The IP address type must be IpAddressType.DUALSTACK.

Returns:

  • (Boolean, nil)


122
123
124
# File 'elastic_load_balancingv2/network_load_balancer_props.rb', line 122

def enable_prefix_for_ipv6_source_nat
  @enable_prefix_for_ipv6_source_nat
end
Note:

Default: true

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

Returns:

  • (Boolean, nil)


127
128
129
# File 'elastic_load_balancingv2/network_load_balancer_props.rb', line 127

def enforce_security_group_inbound_rules_on_private_link_traffic
  @enforce_security_group_inbound_rules_on_private_link_traffic
end

#internet_facingBoolean? (readonly)

Note:

Default: false

Whether the load balancer has an internet-routable address.

Returns:

  • (Boolean, nil)


82
83
84
# File 'elastic_load_balancingv2/network_load_balancer_props.rb', line 82

def internet_facing
  @internet_facing
end

#ip_address_typeAWSCDK::ElasticLoadBalancingv2::IPAddressType? (readonly)

Note:

Default: 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.



135
136
137
# File 'elastic_load_balancingv2/network_load_balancer_props.rb', line 135

def ip_address_type
  @ip_address_type
end

#load_balancer_nameString? (readonly)

Note:

Default: - Automatically generated name.

Name of the load balancer.

Returns:

  • (String, nil)


87
88
89
# File 'elastic_load_balancingv2/network_load_balancer_props.rb', line 87

def load_balancer_name
  @load_balancer_name
end

#minimum_capacity_unitNumeric? (readonly)

Note:

Default: undefined - ELB default is 0 LCU

The minimum capacity (LCU) for a load balancer.



93
94
95
# File 'elastic_load_balancingv2/network_load_balancer_props.rb', line 93

def minimum_capacity_unit
  @minimum_capacity_unit
end

#security_groupsArray<AWSCDK::EC2::ISecurityGroup>? (readonly)

Note:

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

Security groups to associate with this load balancer.

Returns:



140
141
142
# File 'elastic_load_balancingv2/network_load_balancer_props.rb', line 140

def security_groups
  @security_groups
end

#subnet_mappingsArray<AWSCDK::ElasticLoadBalancingv2::SubnetMapping>? (readonly)

Note:

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

Subnet information for the load balancer.



145
146
147
# File 'elastic_load_balancingv2/network_load_balancer_props.rb', line 145

def subnet_mappings
  @subnet_mappings
end

#vpcAWSCDK::EC2::IVPC (readonly)

The VPC network to place the load balancer in.

Returns:



61
62
63
# File 'elastic_load_balancingv2/network_load_balancer_props.rb', line 61

def vpc
  @vpc
end

#vpc_subnetsAWSCDK::EC2::SubnetSelection? (readonly)

Note:

Default: - the Vpc default strategy.

Which subnets place the load balancer in.



98
99
100
# File 'elastic_load_balancingv2/network_load_balancer_props.rb', line 98

def vpc_subnets
  @vpc_subnets
end

#zonal_shiftBoolean? (readonly)

Note:

Default: false

Indicates whether zonal shift is enabled.



151
152
153
# File 'elastic_load_balancingv2/network_load_balancer_props.rb', line 151

def zonal_shift
  @zonal_shift
end

Class Method Details

.jsii_propertiesObject



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'elastic_load_balancingv2/network_load_balancer_props.rb', line 153

def self.jsii_properties
  {
    :vpc => "vpc",
    :cross_zone_enabled => "crossZoneEnabled",
    :deletion_protection => "deletionProtection",
    :deny_all_igw_traffic => "denyAllIgwTraffic",
    :internet_facing => "internetFacing",
    :load_balancer_name => "loadBalancerName",
    :minimum_capacity_unit => "minimumCapacityUnit",
    :vpc_subnets => "vpcSubnets",
    :client_routing_policy => "clientRoutingPolicy",
    :disable_security_groups => "disableSecurityGroups",
    :enable_prefix_for_ipv6_source_nat => "enablePrefixForIpv6SourceNat",
    :enforce_security_group_inbound_rules_on_private_link_traffic => "enforceSecurityGroupInboundRulesOnPrivateLinkTraffic",
    :ip_address_type => "ipAddressType",
    :security_groups => "securityGroups",
    :subnet_mappings => "subnetMappings",
    :zonal_shift => "zonalShift",
  }
end

Instance Method Details

#to_jsiiObject



174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'elastic_load_balancingv2/network_load_balancer_props.rb', line 174

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "vpc" => @vpc,
    "crossZoneEnabled" => @cross_zone_enabled,
    "deletionProtection" => @deletion_protection,
    "denyAllIgwTraffic" => @deny_all_igw_traffic,
    "internetFacing" => @internet_facing,
    "loadBalancerName" => @load_balancer_name,
    "minimumCapacityUnit" => @minimum_capacity_unit,
    "vpcSubnets" => @vpc_subnets,
    "clientRoutingPolicy" => @client_routing_policy,
    "disableSecurityGroups" => @disable_security_groups,
    "enablePrefixForIpv6SourceNat" => @enable_prefix_for_ipv6_source_nat,
    "enforceSecurityGroupInboundRulesOnPrivateLinkTraffic" => @enforce_security_group_inbound_rules_on_private_link_traffic,
    "ipAddressType" => @ip_address_type,
    "securityGroups" => @security_groups,
    "subnetMappings" => @subnet_mappings,
    "zonalShift" => @zonal_shift,
  })
  result.compact
end