Class: AWS::ELB::LoadBalancer
- Inherits:
-
Core::Resource
- Object
- Core::Resource
- AWS::ELB::LoadBalancer
- Defined in:
- lib/aws/elb/load_balancer.rb
Overview
Instance Attribute Summary collapse
-
#availability_zone_names ⇒ Array<String>
readonly
Return the names of the availability zones this load balancer routes traffic to.
-
#canonical_hosted_zone_name ⇒ String
readonly
Provides the name of the Amazon Route 53 hosted zone that is associated with the load balancer.
-
#canonical_hosted_zone_name_id ⇒ String
readonly
Provides the ID of the Amazon Route 53 hosted zone name that is associated with the load balancer.
-
#dns_name ⇒ String
readonly
Specifies the external DNS name associated with this load balancer.
-
#health_check ⇒ Hash
readonly
Returns a hash of the various health probes conducted on the load balancer instances.
-
#name ⇒ String
readonly
The name of the load balancer.
-
#policy_descriptions ⇒ Hash
readonly
Returns a hash of
:app_cookie_stickiness_policies
,:lb_cookie_stickiness_policies
and:other_policies
. -
#scheme ⇒ String?
readonly
Specifies the type of LoadBalancer.
-
#subnet_ids ⇒ Array<String>
readonly
Provides a list of VPC subnet IDs for the LoadBalancer.
Instance Method Summary collapse
-
#availability_zones ⇒ AvailabilityZoneCollection
A collection that help maanage the availability zones for this load balancer.
- #backend_server_policies ⇒ BackendServerPolicyCollection
-
#configure_health_check(options = {}) ⇒ Object
Updates the configuration that drives the instance health checks.
-
#delete ⇒ nil
Deletes the load balancer.
-
#exists? ⇒ Boolean
Returns true if the load balancer exists.
-
#initialize(name, options = {}) ⇒ LoadBalancer
constructor
A new instance of LoadBalancer.
- #instances ⇒ InstanceCollection
- #listeners ⇒ ListenerCollection
- #policies ⇒ PolicyCollection
-
#security_groups ⇒ Array<EC2::SecurityGroup>
Returns the VPC security groups assigned to this load balancer.
-
#source_security_group ⇒ Hash
Generally you don’t need to call this method, rather you can just pass the load balancer as a source to the various authorize and revoke methods of AWS::EC2::SecurityGroup:.
-
#subnets ⇒ Array<EC2::Subnet>
Returns an array of VPC subnets for this load balancer.
Constructor Details
#initialize(name, options = {}) ⇒ LoadBalancer
Returns a new instance of LoadBalancer.
63 64 65 |
# File 'lib/aws/elb/load_balancer.rb', line 63 def initialize name, = {} super(.merge(:name => name.to_s)) end |
Instance Attribute Details
#availability_zone_names ⇒ Array<String> (readonly)
Return the names of the availability zones this load balancer routes traffic to.
61 62 63 |
# File 'lib/aws/elb/load_balancer.rb', line 61 def availability_zone_names @availability_zone_names end |
#canonical_hosted_zone_name ⇒ String (readonly)
Provides the name of the Amazon Route 53 hosted zone that is associated with the load balancer. For more information: http://docs.amazonwebservices.com/ElasticLoadBalancing/latest/DeveloperGuide/index.html?using-domain-names-with-elb.html.
61 62 63 |
# File 'lib/aws/elb/load_balancer.rb', line 61 def canonical_hosted_zone_name @canonical_hosted_zone_name end |
#canonical_hosted_zone_name_id ⇒ String (readonly)
Provides the ID of the Amazon Route 53 hosted zone name that is associated with the load balancer. For more information: http://docs.amazonwebservices.com/ElasticLoadBalancing/latest/DeveloperGuide/index.html?using-domain-names-with-elb.html.
61 62 63 |
# File 'lib/aws/elb/load_balancer.rb', line 61 def canonical_hosted_zone_name_id @canonical_hosted_zone_name_id end |
#dns_name ⇒ String (readonly)
Specifies the external DNS name associated with this load balancer.
61 62 63 |
# File 'lib/aws/elb/load_balancer.rb', line 61 def dns_name @dns_name end |
#health_check ⇒ Hash (readonly)
Returns a hash of the various health probes conducted on the load balancer instances. The following entries are returned:
-
:healthy_threshold
-
:unhealthy_threshold
-
:interval
-
:target
-
:timeout
See #configure_health_check for more details on what each of the configuration values mean.
61 62 63 |
# File 'lib/aws/elb/load_balancer.rb', line 61 def health_check @health_check end |
#name ⇒ String (readonly)
The name of the load balancer.
61 62 63 |
# File 'lib/aws/elb/load_balancer.rb', line 61 def name @name end |
#policy_descriptions ⇒ Hash (readonly)
Returns a hash of :app_cookie_stickiness_policies
, :lb_cookie_stickiness_policies
and :other_policies
. See also #policies.
61 62 63 |
# File 'lib/aws/elb/load_balancer.rb', line 61 def policy_descriptions @policy_descriptions end |
#scheme ⇒ String? (readonly)
Specifies the type of LoadBalancer. This attribute it set only for LoadBalancers attached to an Amazon VPC. If the Scheme is ‘internet-facing’, the LoadBalancer has a publicly resolvable DNS name that resolves to public IP addresses. If the Scheme is ‘internal’, the LoadBalancer has a publicly resolvable DNS name that resolves to private IP addresses.
61 62 63 |
# File 'lib/aws/elb/load_balancer.rb', line 61 def scheme @scheme end |
#subnet_ids ⇒ Array<String> (readonly)
Provides a list of VPC subnet IDs for the LoadBalancer.
61 62 63 |
# File 'lib/aws/elb/load_balancer.rb', line 61 def subnet_ids @subnet_ids end |
Instance Method Details
#availability_zones ⇒ AvailabilityZoneCollection
A collection that help maanage the availability zones for this load balancer.
133 134 135 |
# File 'lib/aws/elb/load_balancer.rb', line 133 def availability_zones AvailabilityZoneCollection.new(self) end |
#backend_server_policies ⇒ BackendServerPolicyCollection
153 154 155 |
# File 'lib/aws/elb/load_balancer.rb', line 153 def backend_server_policies BackendServerPolicyCollection.new(self) end |
#configure_health_check(options = {}) ⇒ Object
Updates the configuration that drives the instance health checks.
You only need to pass the options you want to change. You can call #health_check if you want to see what the current configuration values are.
205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/aws/elb/load_balancer.rb', line 205 def configure_health_check = {} new_config = health_check.merge() response = client.configure_health_check( :load_balancer_name => name, :health_check => new_config) new_config end |
#delete ⇒ nil
Deletes the load balancer.
264 265 266 267 |
# File 'lib/aws/elb/load_balancer.rb', line 264 def delete client.delete_load_balancer(:load_balancer_name => name) nil end |
#exists? ⇒ Boolean
Returns true if the load balancer exists.
255 256 257 258 259 260 |
# File 'lib/aws/elb/load_balancer.rb', line 255 def exists? client.describe_load_balancers(:load_balancer_names => [name]) true rescue Errors::LoadBalancerNotFound false end |
#instances ⇒ InstanceCollection
148 149 150 |
# File 'lib/aws/elb/load_balancer.rb', line 148 def instances InstanceCollection.new(self) end |
#listeners ⇒ ListenerCollection
138 139 140 |
# File 'lib/aws/elb/load_balancer.rb', line 138 def listeners ListenerCollection.new(self) end |
#policies ⇒ PolicyCollection
143 144 145 |
# File 'lib/aws/elb/load_balancer.rb', line 143 def policies LoadBalancerPolicyCollection.new(self) end |
#security_groups ⇒ Array<EC2::SecurityGroup>
VPC only
Returns the VPC security groups assigned to this load balancer.
227 228 229 230 231 |
# File 'lib/aws/elb/load_balancer.rb', line 227 def security_groups security_group_ids.collect do |id| EC2::SecurityGroup.new(id, :config => config) end end |
#source_security_group ⇒ Hash
Generally you don’t need to call this method, rather you can just pass the load balancer as a source to the various authorize and revoke methods of AWS::EC2::SecurityGroup:
security_group.(load_balancer)
security_group.revoke_ingress(load_balancer)
247 248 249 250 251 252 |
# File 'lib/aws/elb/load_balancer.rb', line 247 def source_security_group { :group_name => source_security_group_name, :user_id => source_security_group_owner_alias, } end |
#subnets ⇒ Array<EC2::Subnet>
VPC only
Returns an array of VPC subnets for this load balancer.
220 221 222 |
# File 'lib/aws/elb/load_balancer.rb', line 220 def subnets subnet_ids.map{|id| EC2::Subnet.new(id, :config => config) } end |