Class: AWSCDK::ElasticLoadBalancingv2Targets::IPTarget

Inherits:
Jsii::Object
  • Object
show all
Includes:
AWSCDK::ElasticLoadBalancingv2::IApplicationLoadBalancerTarget, AWSCDK::ElasticLoadBalancingv2::INetworkLoadBalancerTarget
Defined in:
elastic_load_balancingv2_targets/ip_target.rb

Overview

An IP address that is a target for load balancing.

Specify IP addresses from the subnets of the virtual private cloud (VPC) for the target group, the RFC 1918 range (10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16), and the RFC 6598 range (100.64.0.0/10). You can't specify publicly routable IP addresses.

If you register a target of this type, you are responsible for making sure the load balancer's security group can send packets to the IP address.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ip_address, port = nil, availability_zone = nil) ⇒ IPTarget

Create a new IPAddress target.

The availabilityZone parameter determines whether the target receives traffic from the load balancer nodes in the specified Availability Zone or from all enabled Availability Zones for the load balancer.

This parameter is not supported if the target type of the target group is instance. If the IP address is in a subnet of the VPC for the target group, the Availability Zone is automatically detected and this parameter is optional. If the IP address is outside the VPC, this parameter is required.

With an Application Load Balancer, if the IP address is outside the VPC for the target group, the only supported value is all.

Default is automatic.

Parameters:

  • ip_address (String)

    The IP Address to load balance to.

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

    Override the group's default port.

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

    Availability zone to send traffic from.



38
39
40
41
42
43
# File 'elastic_load_balancingv2_targets/ip_target.rb', line 38

def initialize(ip_address, port = nil, availability_zone = nil)
  Jsii::Type.check_type(ip_address, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "ipAddress")
  Jsii::Type.check_type(port, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "port") unless port.nil?
  Jsii::Type.check_type(availability_zone, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "availabilityZone") unless availability_zone.nil?
  Jsii::Object.instance_method(:initialize).bind(self).call(ip_address, port, availability_zone)
end

Class Method Details

.jsii_overridable_methodsObject



45
46
47
48
49
50
# File 'elastic_load_balancingv2_targets/ip_target.rb', line 45

def self.jsii_overridable_methods
  {
    :attach_to_application_target_group => { kind: :method, name: "attachToApplicationTargetGroup", is_optional: false },
    :attach_to_network_target_group => { kind: :method, name: "attachToNetworkTargetGroup", is_optional: false },
  }
end

Instance Method Details

#attach_to_application_target_group(target_group) ⇒ AWSCDK::ElasticLoadBalancingv2::LoadBalancerTargetProps

Register this instance target with a load balancer.

Don't call this, it is called automatically when you add the target to a load balancer.



59
60
61
62
# File 'elastic_load_balancingv2_targets/ip_target.rb', line 59

def attach_to_application_target_group(target_group)
  Jsii::Type.check_type(target_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWxhc3RpY2xvYWRiYWxhbmNpbmd2Mi5JQXBwbGljYXRpb25UYXJnZXRHcm91cCJ9")), "targetGroup")
  jsii_call_method("attachToApplicationTargetGroup", [target_group])
end

#attach_to_network_target_group(target_group) ⇒ AWSCDK::ElasticLoadBalancingv2::LoadBalancerTargetProps

Register this instance target with a load balancer.

Don't call this, it is called automatically when you add the target to a load balancer.



71
72
73
74
# File 'elastic_load_balancingv2_targets/ip_target.rb', line 71

def attach_to_network_target_group(target_group)
  Jsii::Type.check_type(target_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWxhc3RpY2xvYWRiYWxhbmNpbmd2Mi5JTmV0d29ya1RhcmdldEdyb3VwIn0=")), "targetGroup")
  jsii_call_method("attachToNetworkTargetGroup", [target_group])
end