Object
Initialize connection to ELB
options parameter must include values for :aws_access_key_id and :aws_secret_access_key in order to create a connection
elb = ELB.new( :aws_access_key_id => your_aws_access_key_id, :aws_secret_access_key => your_aws_secret_access_key )
options<~Hash> - config arguments for connection. Defaults to {}.
region<~String> - optional region to use, in ['eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2', 'ap-northeast-1', 'ap-southeast-1']
# File lib/fog/aws/elb.rb, line 101 def initialize(options={}) require 'fog/core/parser' @aws_access_key_id = options[:aws_access_key_id] @aws_secret_access_key = options[:aws_secret_access_key] @connection_options = options[:connection_options] || {} @hmac = Fog::HMAC.new('sha256', @aws_secret_access_key) options[:region] ||= 'us-east-1' @host = options[:host] || case options[:region] when 'ap-northeast-1' 'elasticloadbalancing.ap-northeast-1.amazonaws.com' when 'ap-southeast-1' 'elasticloadbalancing.ap-southeast-1.amazonaws.com' when 'eu-west-1' 'elasticloadbalancing.eu-west-1.amazonaws.com' when 'us-east-1' 'elasticloadbalancing.us-east-1.amazonaws.com' when 'us-west-1' 'elasticloadbalancing.us-west-1.amazonaws.com' when 'us-west-2' 'elasticloadbalancing.us-west-2.amazonaws.com' when 'sa-east-1' 'elasticloadbalancing.sa-east-1.amazonaws.com' else raise ArgumentError, "Unknown region: #{options[:region].inspect}" end @path = options[:path] || '/' @persistent = options[:persistent] || false @port = options[:port] || 443 @scheme = options[:scheme] || 'https' @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options) end
Enables the client to define an application healthcheck for the instances. See docs.amazonwebservices.com/ElasticLoadBalancing/latest/APIReference/index.html?API_ConfigureHealthCheck.html
lb_name<~String> - Name of the ELB
health_check<~Hash> - A hash of parameters describing the health check
'HealthyThreshold'<~Integer> - Specifies the number of consecutive health probe successes required before moving the instance to the Healthy state.
'Interval'<~Integer> - Specifies the approximate interval, in seconds, between health checks of an individual instance.
'Target'<~String> - Specifies the instance being checked. The protocol is either TCP or HTTP. The range of valid ports is one (1) through 65535.
'Timeout'<~Integer> - Specifies the amount of time, in seconds,
during which no response means a failed health probe.
'UnhealthyThreshold'<~Integer> - Specifies the number of consecutive health probe failures required before moving the instance to the Unhealthy state.
response<~Excon::Response>:
body<~Hash>:
# File lib/fog/aws/requests/elb/configure_health_check.rb, line 28 def configure_health_check(lb_name, health_check) params = {'LoadBalancerName' => lb_name} health_check.each {|key, value| params["HealthCheck.#{key}"] = value } request({ 'Action' => 'ConfigureHealthCheck', :parser => Fog::Parsers::AWS::ELB::ConfigureHealthCheck.new }.merge!(params)) end
Create a new Elastic Load Balancer
availability_zones<~Array> - List of availability zones for the ELB
lb_name<~String> - Name for the new ELB -- must be unique
listeners<~Array> - Array of Hashes describing ELB listeners to assign to the ELB
response<~Excon::Response>:
# File lib/fog/aws/requests/elb/create_load_balancer.rb, line 25 def create_load_balancer(availability_zones, lb_name, listeners) params = Fog::AWS.indexed_param('AvailabilityZones.member', [*availability_zones]) listener_protocol = [] listener_lb_port = [] listener_instance_port = [] listener_ssl_certificate_id = [] listeners.each do |listener| listener_protocol.push(listener['Protocol']) listener_lb_port.push(listener['LoadBalancerPort']) listener_instance_port.push(listener['InstancePort']) listener_ssl_certificate_id.push(listener['SSLCertificateId']) end params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.Protocol', listener_protocol)) params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.LoadBalancerPort', listener_lb_port)) params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.InstancePort', listener_instance_port)) params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.SSLCertificateId', listener_ssl_certificate_id)) request({ 'Action' => 'CreateLoadBalancer', 'LoadBalancerName' => lb_name, :parser => Fog::Parsers::AWS::ELB::CreateLoadBalancer.new }.merge!(params)) end
Create Elastic Load Balancer Listeners
lb_name<~String> - Name for the new ELB -- must be unique
listeners<~Array> - Array of Hashes describing ELB listeners to add to the ELB
response<~Excon::Response>:
body<~Hash>:
'ResponseMetadata'<~Hash>:
'RequestId'<~String> - Id of request
# File lib/fog/aws/requests/elb/create_load_balancer_listeners.rb, line 22 def create_load_balancer_listeners(lb_name, listeners) params = {} listener_protocol = [] listener_lb_port = [] listener_instance_port = [] listener_ssl_certificate_id = [] listeners.each do |listener| listener_protocol.push(listener['Protocol']) listener_lb_port.push(listener['LoadBalancerPort']) listener_instance_port.push(listener['InstancePort']) listener_ssl_certificate_id.push(listener['SSLCertificateId']) end params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.Protocol', listener_protocol)) params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.LoadBalancerPort', listener_lb_port)) params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.InstancePort', listener_instance_port)) params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.SSLCertificateId', listener_ssl_certificate_id)) request({ 'Action' => 'CreateLoadBalancerListeners', 'LoadBalancerName' => lb_name, :parser => Fog::Parsers::AWS::ELB::Empty.new }.merge!(params)) end
Delete an existing Elastic Load Balancer
Note that this API call, as defined by Amazon, is idempotent. That is, it will not return an error if you try to delete an ELB that does not exist.
lb_name<~String> - Name of the ELB to be deleted
response<~Excon::Response>:
body<~Hash>:
'DeleteLoadBalancerResponse'<~nil>
'ResponseMetadata'<~Hash>:
'RequestId'<~String> - Id of request
# File lib/fog/aws/requests/elb/delete_load_balancer.rb, line 22 def delete_load_balancer(lb_name) request({ 'Action' => 'DeleteLoadBalancer', 'LoadBalancerName' => lb_name, :parser => Fog::Parsers::AWS::ELB::DeleteLoadBalancer.new }) end
Delet Elastic Load Balancer Listeners
lb_name<~String> - Name for the new ELB -- must be unique
load_balancer_ports<~Array> - Array of client port numbers of the LoadBalancerListeners to remove
response<~Excon::Response>:
body<~Hash>:
'ResponseMetadata'<~Hash>:
'RequestId'<~String> - Id of request
# File lib/fog/aws/requests/elb/delete_load_balancer_listeners.rb, line 18 def delete_load_balancer_listeners(lb_name, load_balancer_ports) params = Fog::AWS.indexed_param('LoadBalancerPorts.member.%d', load_balancer_ports) request({ 'Action' => 'DeleteLoadBalancerListeners', 'LoadBalancerName' => lb_name, :parser => Fog::Parsers::AWS::ELB::Empty.new }.merge!(params)) end
Delete a Load Balancer Stickiness Policy
lb_name<~String> - Name of the ELB
policy_name<~String> - The name of the policy to delete
response<~Excon::Response>:
body<~Hash>:
'ResponseMetadata'<~Hash>:
'RequestId'<~String> - Id of request
# File lib/fog/aws/requests/elb/delete_load_balancer_policy.rb, line 18 def delete_load_balancer_policy(lb_name, policy_name) params = {'PolicyName' => policy_name} request({ 'Action' => 'DeleteLoadBalancerPolicy', 'LoadBalancerName' => lb_name, :parser => Fog::Parsers::AWS::ELB::Empty.new }.merge!(params)) end
Deregister an instance from an existing ELB
instance_ids<~Array> - List of instance IDs to remove from ELB
lb_name<~String> - Load balancer to remove instances from
response<~Excon::Response>:
body<~Hash>:
'ResponseMetadata'<~Hash>:
'RequestId'<~String> - Id of request
'DeregisterInstancesFromLoadBalancerResult'<~Hash>:
'Instances'<~Array> - array of hashes describing instances currently enabled
'InstanceId'<~String>
# File lib/fog/aws/requests/elb/deregister_instances_from_load_balancer.rb, line 22 def deregister_instances_from_load_balancer(instance_ids, lb_name) params = Fog::AWS.indexed_param('Instances.member.%d.InstanceId', [*instance_ids]) request({ 'Action' => 'DeregisterInstancesFromLoadBalancer', 'LoadBalancerName' => lb_name, :parser => Fog::Parsers::AWS::ELB::DeregisterInstancesFromLoadBalancer.new }.merge!(params)) end
Get health status for one or more instances on an existing ELB
lb_name<~String> - Load balancer to check instances health on
instance_ids<~Array> - Optional list of instance IDs to check
response<~Excon::Response>:
body<~Hash>:
'ResponseMetadata'<~Hash>:
'RequestId'<~String> - Id of request
'DescribeInstanceHealthResult'<~Hash>:
'InstanceStates'<~Array> - array of hashes describing instance health
'Description'<~String>
'State'<~String>
'InstanceId'<~String>
'ReasonCode'<~String>
# File lib/fog/aws/requests/elb/describe_instance_health.rb, line 25 def describe_instance_health(lb_name, instance_ids = []) params = Fog::AWS.indexed_param('Instances.member.%d.InstanceId', [*instance_ids]) request({ 'Action' => 'DescribeInstanceHealth', 'LoadBalancerName' => lb_name, :parser => Fog::Parsers::AWS::ELB::DescribeInstanceHealth.new }.merge!(params)) end
Describe all or specified load balancers
lb_name<~Array> - List of load balancer names to describe, defaults to all
response<~Excon::Response>:
body<~Hash>:
'ResponseMetadata'<~Hash>:
'RequestId'<~String> - Id of request
'DescribeLoadBalancersResult'<~Hash>:
'LoadBalancerDescriptions'<~Array>
'AvailabilityZones'<~Array> - list of availability zones covered by this load balancer
'CanonicalHostedZoneName'<~String> - name of the Route 53 hosted zone associated with the load balancer
'CanonicalHostedZoneNameID'<~String> - ID of the Route 53 hosted zone associated with the load balancer
'CreatedTime'<~Time> - time load balancer was created
'DNSName'<~String> - external DNS name of load balancer
'HealthCheck'<~Hash>:
'HealthyThreshold'<~Integer> - number of consecutive health probe successes required before moving the instance to the Healthy state
'Timeout'<~Integer> - number of seconds after which no response means a failed health probe
'Interval'<~Integer> - interval (in seconds) between health checks of an individual instance
'UnhealthyThreshold'<~Integer> - number of consecutive health probe failures that move the instance to the unhealthy state
'Target'<~String> - string describing protocol type, port and URL to check
'Instances'<~Array> - list of instances that the load balancer balances between
'ListenerDescriptions'<~Array>
'PolicyNames'<~Array> - list of policies enabled
'Listener'<~Hash>:
'InstancePort'<~Integer> - port on instance that requests are sent to
'Protocol'<~String> - transport protocol used for routing in [TCP, HTTP]
'LoadBalancerPort'<~Integer> - port that load balancer listens on for requests
'LoadBalancerName'<~String> - name of load balancer
'Policies'<~Hash>:
'LBCookieStickinessPolicies'<~Array> - list of Load Balancer Generated Cookie Stickiness policies for the LoadBalancer
'AppCookieStickinessPolicies'<~Array> - list of Application Generated Cookie Stickiness policies for the LoadBalancer
'SourceSecurityGroup'<~Hash>:
'GroupName'<~String> - Name of the source security group to use with inbound security group rules
'OwnerAlias'<~String> - Owner of the source security group
# File lib/fog/aws/requests/elb/describe_load_balancers.rb, line 45 def describe_load_balancers(lb_name = []) params = Fog::AWS.indexed_param('LoadBalancerNames.member', [*lb_name]) request({ 'Action' => 'DescribeLoadBalancers', :parser => Fog::Parsers::AWS::ELB::DescribeLoadBalancers.new }.merge!(params)) end
Disable an availability zone for an existing ELB
availability_zones<~Array> - List of availability zones to disable on ELB
lb_name<~String> - Load balancer to disable availability zones on
response<~Excon::Response>:
body<~Hash>:
'ResponseMetadata'<~Hash>:
'RequestId'<~String> - Id of request
'DisableAvailabilityZonesForLoadBalancerResult'<~Hash>:
'AvailabilityZones'<~Array> - A list of updated Availability Zones for the LoadBalancer.
# File lib/fog/aws/requests/elb/disable_availability_zones_for_load_balancer.rb, line 21 def disable_availability_zones_for_load_balancer(availability_zones, lb_name) params = Fog::AWS.indexed_param('AvailabilityZones.member', [*availability_zones]) request({ 'Action' => 'DisableAvailabilityZonesForLoadBalancer', 'LoadBalancerName' => lb_name, :parser => Fog::Parsers::AWS::ELB::DisableAvailabilityZonesForLoadBalancer.new }.merge!(params)) end
Enable an availability zone for an existing ELB
availability_zones<~Array> - List of availability zones to enable on ELB
lb_name<~String> - Load balancer to enable availability zones on
response<~Excon::Response>:
body<~Hash>:
'ResponseMetadata'<~Hash>:
'RequestId'<~String> - Id of request
'EnableAvailabilityZonesForLoadBalancerResult'<~Hash>:
'AvailabilityZones'<~Array> - array of strings describing instances currently enabled
# File lib/fog/aws/requests/elb/enable_availability_zones_for_load_balancer.rb, line 21 def enable_availability_zones_for_load_balancer(availability_zones, lb_name) params = Fog::AWS.indexed_param('AvailabilityZones.member', [*availability_zones]) request({ 'Action' => 'EnableAvailabilityZonesForLoadBalancer', 'LoadBalancerName' => lb_name, :parser => Fog::Parsers::AWS::ELB::EnableAvailabilityZonesForLoadBalancer.new }.merge!(params)) end
Register an instance with an existing ELB
instance_ids<~Array> - List of instance IDs to associate with ELB
lb_name<~String> - Load balancer to assign instances to
response<~Excon::Response>:
body<~Hash>:
'ResponseMetadata'<~Hash>:
'RequestId'<~String> - Id of request
'RegisterInstancesWithLoadBalancerResult'<~Hash>:
'Instances'<~Array> - array of hashes describing instances currently enabled
'InstanceId'<~String>
# File lib/fog/aws/requests/elb/register_instances_with_load_balancer.rb, line 22 def register_instances_with_load_balancer(instance_ids, lb_name) params = Fog::AWS.indexed_param('Instances.member.%d.InstanceId', [*instance_ids]) request({ 'Action' => 'RegisterInstancesWithLoadBalancer', 'LoadBalancerName' => lb_name, :parser => Fog::Parsers::AWS::ELB::RegisterInstancesWithLoadBalancer.new }.merge!(params)) end
# File lib/fog/aws/elb.rb, line 135 def reload @connection.reset end
Sets the certificate that terminates the specified listener's SSL connections. The specified certificate replaces any prior certificate that was used on the same LoadBalancer and port.
lb_name<~String> - Name of the ELB
load_balancer_port<~Integer> - The external port of the LoadBalancer with which this policy has to be associated.
ssl_certificate_id<~String> - ID of the SSL certificate chain to use example: arn:aws:iam::322191361670:server-certificate/newCert
response<~Excon::Response>:
body<~Hash>:
'ResponseMetadata'<~Hash>:
'RequestId'<~String> - Id of request
# File lib/fog/aws/requests/elb/set_load_balancer_listener_ssl_certificate.rb, line 24 def set_load_balancer_listener_ssl_certificate(lb_name, load_balancer_port, ssl_certificate_id) request({ 'Action' => 'SetLoadBalancerListenerSSLCertificate', 'LoadBalancerName' => lb_name, 'LoadBalancerPort' => load_balancer_port, 'SSLCertificateId' => ssl_certificate_id, :parser => Fog::Parsers::AWS::ELB::Empty.new }) end
policy_names<~Array> - List of policies to be associated with the listener. Currently this list can have at most one policy. If the list is empty, the current policy is removed from the listener.
response<~Excon::Response>:
body<~Hash>:
'ResponseMetadata'<~Hash>:
'RequestId'<~String> - Id of request
# File lib/fog/aws/requests/elb/set_load_balancer_policies_of_listener.rb, line 25 def set_load_balancer_policies_of_listener(lb_name, load_balancer_port, policy_names) params = {'LoadBalancerPort' => load_balancer_port} if policy_names.any? params.merge!(Fog::AWS.indexed_param('PolicyNames.member', policy_names)) else params['PolicyNames'] = '' end request({ 'Action' => 'SetLoadBalancerPoliciesOfListener', 'LoadBalancerName' => lb_name, :parser => Fog::Parsers::AWS::ELB::Empty.new }.merge!(params)) end
Generated with the Darkfish Rdoc Generator 2.