You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Class: Aws::ElasticLoadBalancing::Client

Inherits:
Seahorse::Client::Base show all
Defined in:
(unknown)

Overview

An API client for Elastic Load Balancing. To construct a client, you need to configure a :region and :credentials.

elasticloadbalancing = Aws::ElasticLoadBalancing::Client.new(
  region: region_name,
  credentials: credentials,
  # ...
)

See #initialize for a full list of supported configuration options.

Region

You can configure a default region in the following locations:

  • ENV['AWS_REGION']
  • Aws.config[:region]

Go here for a list of supported regions.

Credentials

Default credentials are loaded automatically from the following locations:

  • ENV['AWS_ACCESS_KEY_ID'] and ENV['AWS_SECRET_ACCESS_KEY']
  • Aws.config[:credentials]
  • The shared credentials ini file at ~/.aws/credentials (more information)
  • From an instance profile when running on EC2

You can also construct a credentials object from one of the following classes:

Alternatively, you configure credentials with :access_key_id and :secret_access_key:

# load credentials from disk
creds = YAML.load(File.read('/path/to/secrets'))

Aws::ElasticLoadBalancing::Client.new(
  access_key_id: creds['access_key_id'],
  secret_access_key: creds['secret_access_key']
)

Always load your credentials from outside your application. Avoid configuring credentials statically and never commit them to source control.

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Base

#config, #handlers

Constructor collapse

API Operations collapse

Instance Method Summary collapse

Methods inherited from Seahorse::Client::Base

add_plugin, api, #build_request, clear_plugins, define, new, #operation, #operation_names, plugins, remove_plugin, set_api, set_plugins

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Constructor Details

#initialize(options = {}) ⇒ Aws::ElasticLoadBalancing::Client

Constructs an API client.

Options Hash (options):

  • :access_key_id (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :active_endpoint_cache (Boolean)

    When set to true, a thread polling for endpoints will be running in the background every 60 secs (default). Defaults to false. See Plugins::EndpointDiscovery for more details.

  • :convert_params (Boolean) — default: true

    When true, an attempt is made to coerce request parameters into the required types. See Plugins::ParamConverter for more details.

  • :credentials (required, Credentials)

    Your AWS credentials. The following locations will be searched in order for credentials:

    • :access_key_id, :secret_access_key, and :session_token options
    • ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
    • HOME/.aws/credentials shared credentials file
    • EC2 instance profile credentials See Plugins::RequestSigner for more details.
  • :disable_host_prefix_injection (Boolean)

    Set to true to disable SDK automatically adding host prefix to default service endpoint when available. See Plugins::EndpointPattern for more details.

  • :endpoint (String)

    A default endpoint is constructed from the :region. See Plugins::RegionalEndpoint for more details.

  • :endpoint_cache_max_entries (Integer)

    Used for the maximum size limit of the LRU cache storing endpoints data for endpoint discovery enabled operations. Defaults to 1000. See Plugins::EndpointDiscovery for more details.

  • :endpoint_cache_max_threads (Integer)

    Used for the maximum threads in use for polling endpoints to be cached, defaults to 10. See Plugins::EndpointDiscovery for more details.

  • :endpoint_cache_poll_interval (Integer)

    When :endpoint_discovery and :active_endpoint_cache is enabled, Use this option to config the time interval in seconds for making requests fetching endpoints information. Defaults to 60 sec. See Plugins::EndpointDiscovery for more details.

  • :endpoint_discovery (Boolean)

    When set to true, endpoint discovery will be enabled for operations when available. Defaults to false. See Plugins::EndpointDiscovery for more details.

  • :http_continue_timeout (Float) — default: 1

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_idle_timeout (Integer) — default: 5

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_open_timeout (Integer) — default: 15

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_proxy (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_read_timeout (Integer) — default: 60

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_wire_trace (Boolean) — default: false

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :log_level (Symbol) — default: :info

    The log level to send messages to the logger at. See Plugins::Logging for more details.

  • :log_formatter (Logging::LogFormatter)

    The log formatter. Defaults to Seahorse::Client::Logging::Formatter.default. See Plugins::Logging for more details.

  • :logger (Logger) — default: nil

    The Logger instance to send log messages to. If this option is not set, logging will be disabled. See Plugins::Logging for more details.

  • :profile (String)

    Used when loading credentials from the shared credentials file at HOME/.aws/credentials. When not specified, 'default' is used. See Plugins::RequestSigner for more details.

  • :raise_response_errors (Boolean) — default: true

    When true, response errors are raised. See Seahorse::Client::Plugins::RaiseResponseErrors for more details.

  • :region (required, String)

    The AWS region to connect to. The region is used to construct the client endpoint. Defaults to ENV['AWS_REGION']. Also checks AMAZON_REGION and AWS_DEFAULT_REGION. See Plugins::RegionalEndpoint for more details.

  • :retry_limit (Integer) — default: 3

    The maximum number of times to retry failed requests. Only ~ 500 level server errors and certain ~ 400 level client errors are retried. Generally, these are throttling errors, data checksum errors, networking errors, timeout errors and auth errors from expired credentials. See Plugins::RetryErrors for more details.

  • :secret_access_key (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :session_token (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :ssl_ca_bundle (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_ca_directory (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_ca_store (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_verify_peer (Boolean) — default: true

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :stub_responses (Boolean) — default: false

    Causes the client to return stubbed responses. By default fake responses are generated and returned. You can specify the response data to return or errors to raise by calling ClientStubs#stub_responses. See ClientStubs for more information.

    Please note When response stubbing is enabled, no HTTP requests are made, and retries are disabled. See Plugins::StubResponses for more details.

  • :validate_params (Boolean) — default: true

    When true, request parameters are validated before sending the request. See Plugins::ParamValidator for more details.

Instance Method Details

#add_tags(options = {}) ⇒ Struct

Adds the specified tags to the specified load balancer. Each load balancer can have a maximum of 10 tags.

Each tag consists of a key and an optional value. If a tag with the same key is already associated with the load balancer, AddTags updates its value.

For more information, see Tag Your Classic Load Balancer in the Classic Load Balancers Guide.

Examples:

Example: To add tags to a load balancer


# This example adds two tags to the specified load balancer.

resp = client.add_tags({
  load_balancer_names: [
    "my-load-balancer", 
  ], 
  tags: [
    {
      key: "project", 
      value: "lima", 
    }, 
    {
      key: "department", 
      value: "digital-media", 
    }, 
  ], 
})

Request syntax with placeholder values


resp = client.add_tags({
  load_balancer_names: ["AccessPointName"], # required
  tags: [ # required
    {
      key: "TagKey", # required
      value: "TagValue",
    },
  ],
})

Options Hash (options):

  • :load_balancer_names (required, Array<String>)

    The name of the load balancer. You can specify one load balancer only.

  • :tags (required, Array<Types::Tag>)

    The tags.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#apply_security_groups_to_load_balancer(options = {}) ⇒ Types::ApplySecurityGroupsToLoadBalancerOutput

Associates one or more security groups with your load balancer in a virtual private cloud (VPC). The specified security groups override the previously associated security groups.

For more information, see Security Groups for Load Balancers in a VPC in the Classic Load Balancers Guide.

Examples:

Example: To associate a security group with a load balancer in a VPC


# This example associates a security group with the specified load balancer in a VPC.

resp = client.apply_security_groups_to_load_balancer({
  load_balancer_name: "my-load-balancer", 
  security_groups: [
    "sg-fc448899", 
  ], 
})

# resp.to_h outputs the following:
{
  security_groups: [
    "sg-fc448899", 
  ], 
}

Request syntax with placeholder values


resp = client.apply_security_groups_to_load_balancer({
  load_balancer_name: "AccessPointName", # required
  security_groups: ["SecurityGroupId"], # required
})

Response structure


resp.security_groups #=> Array
resp.security_groups[0] #=> String

Options Hash (options):

  • :load_balancer_name (required, String)

    The name of the load balancer.

  • :security_groups (required, Array<String>)

    The IDs of the security groups to associate with the load balancer. Note that you cannot specify the name of the security group.

Returns:

See Also:

#attach_load_balancer_to_subnets(options = {}) ⇒ Types::AttachLoadBalancerToSubnetsOutput

Adds one or more subnets to the set of configured subnets for the specified load balancer.

The load balancer evenly distributes requests across all registered subnets. For more information, see Add or Remove Subnets for Your Load Balancer in a VPC in the Classic Load Balancers Guide.

Examples:

Example: To attach subnets to a load balancer


# This example adds the specified subnet to the set of configured subnets for the specified load balancer.

resp = client.attach_load_balancer_to_subnets({
  load_balancer_name: "my-load-balancer", 
  subnets: [
    "subnet-0ecac448", 
  ], 
})

# resp.to_h outputs the following:
{
  subnets: [
    "subnet-15aaab61", 
    "subnet-0ecac448", 
  ], 
}

Request syntax with placeholder values


resp = client.attach_load_balancer_to_subnets({
  load_balancer_name: "AccessPointName", # required
  subnets: ["SubnetId"], # required
})

Response structure


resp.subnets #=> Array
resp.subnets[0] #=> String

Options Hash (options):

  • :load_balancer_name (required, String)

    The name of the load balancer.

  • :subnets (required, Array<String>)

    The IDs of the subnets to add. You can add only one subnet per Availability Zone.

Returns:

See Also:

#configure_health_check(options = {}) ⇒ Types::ConfigureHealthCheckOutput

Specifies the health check settings to use when evaluating the health state of your EC2 instances.

For more information, see Configure Health Checks for Your Load Balancer in the Classic Load Balancers Guide.

Examples:

Example: To specify the health check settings for your backend EC2 instances


# This example specifies the health check settings used to evaluate the health of your backend EC2 instances.

resp = client.configure_health_check({
  health_check: {
    healthy_threshold: 2, 
    interval: 30, 
    target: "HTTP:80/png", 
    timeout: 3, 
    unhealthy_threshold: 2, 
  }, 
  load_balancer_name: "my-load-balancer", 
})

# resp.to_h outputs the following:
{
  health_check: {
    healthy_threshold: 2, 
    interval: 30, 
    target: "HTTP:80/png", 
    timeout: 3, 
    unhealthy_threshold: 2, 
  }, 
}

Request syntax with placeholder values


resp = client.configure_health_check({
  load_balancer_name: "AccessPointName", # required
  health_check: { # required
    target: "HealthCheckTarget", # required
    interval: 1, # required
    timeout: 1, # required
    unhealthy_threshold: 1, # required
    healthy_threshold: 1, # required
  },
})

Response structure


resp.health_check.target #=> String
resp.health_check.interval #=> Integer
resp.health_check.timeout #=> Integer
resp.health_check.unhealthy_threshold #=> Integer
resp.health_check.healthy_threshold #=> Integer

Options Hash (options):

  • :load_balancer_name (required, String)

    The name of the load balancer.

  • :health_check (required, Types::HealthCheck)

    The configuration information.

Returns:

See Also:

Generates a stickiness policy with sticky session lifetimes that follow that of an application-generated cookie. This policy can be associated only with HTTP/HTTPS listeners.

This policy is similar to the policy created by CreateLBCookieStickinessPolicy, except that the lifetime of the special Elastic Load Balancing cookie, AWSELB, follows the lifetime of the application-generated cookie specified in the policy configuration. The load balancer only inserts a new stickiness cookie when the application response includes a new application cookie.

If the application cookie is explicitly removed or expires, the session stops being sticky until a new application cookie is issued.

For more information, see Application-Controlled Session Stickiness in the Classic Load Balancers Guide.

Examples:

Example: To generate a stickiness policy for your load balancer


# This example generates a stickiness policy that follows the sticky session lifetimes of the application-generated cookie.

resp = client.create_app_cookie_stickiness_policy({
  cookie_name: "my-app-cookie", 
  load_balancer_name: "my-load-balancer", 
  policy_name: "my-app-cookie-policy", 
})

Request syntax with placeholder values


resp = client.create_app_cookie_stickiness_policy({
  load_balancer_name: "AccessPointName", # required
  policy_name: "PolicyName", # required
  cookie_name: "CookieName", # required
})

Options Hash (options):

  • :load_balancer_name (required, String)

    The name of the load balancer.

  • :policy_name (required, String)

    The name of the policy being created. Policy names must consist of alphanumeric characters and dashes (-). This name must be unique within the set of policies for this load balancer.

  • :cookie_name (required, String)

    The name of the application cookie used for stickiness.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

Generates a stickiness policy with sticky session lifetimes controlled by the lifetime of the browser (user-agent) or a specified expiration period. This policy can be associated only with HTTP/HTTPS listeners.

When a load balancer implements this policy, the load balancer uses a special cookie to track the instance for each request. When the load balancer receives a request, it first checks to see if this cookie is present in the request. If so, the load balancer sends the request to the application server specified in the cookie. If not, the load balancer sends the request to a server that is chosen based on the existing load-balancing algorithm.

A cookie is inserted into the response for binding subsequent requests from the same user to that server. The validity of the cookie is based on the cookie expiration time, which is specified in the policy configuration.

For more information, see Duration-Based Session Stickiness in the Classic Load Balancers Guide.

Examples:

Example: To generate a duration-based stickiness policy for your load balancer


# This example generates a stickiness policy with sticky session lifetimes controlled by the specified expiration period.

resp = client.create_lb_cookie_stickiness_policy({
  cookie_expiration_period: 60, 
  load_balancer_name: "my-load-balancer", 
  policy_name: "my-duration-cookie-policy", 
})

Request syntax with placeholder values


resp = client.create_lb_cookie_stickiness_policy({
  load_balancer_name: "AccessPointName", # required
  policy_name: "PolicyName", # required
  cookie_expiration_period: 1,
})

Options Hash (options):

  • :load_balancer_name (required, String)

    The name of the load balancer.

  • :policy_name (required, String)

    The name of the policy being created. Policy names must consist of alphanumeric characters and dashes (-). This name must be unique within the set of policies for this load balancer.

  • :cookie_expiration_period (Integer)

    The time period, in seconds, after which the cookie should be considered stale. If you do not specify this parameter, the default value is 0, which indicates that the sticky session should last for the duration of the browser session.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#create_load_balancer(options = {}) ⇒ Types::CreateAccessPointOutput

Creates a Classic Load Balancer.

You can add listeners, security groups, subnets, and tags when you create your load balancer, or you can add them later using CreateLoadBalancerListeners, ApplySecurityGroupsToLoadBalancer, AttachLoadBalancerToSubnets, and AddTags.

To describe your current load balancers, see DescribeLoadBalancers. When you are finished with a load balancer, you can delete it using DeleteLoadBalancer.

You can create up to 20 load balancers per region per account. You can request an increase for the number of load balancers for your account. For more information, see Limits for Your Classic Load Balancer in the Classic Load Balancers Guide.

Examples:

Example: To create an HTTP load balancer in a VPC


# This example creates a load balancer with an HTTP listener in a VPC.

resp = client.create_load_balancer({
  listeners: [
    {
      instance_port: 80, 
      instance_protocol: "HTTP", 
      load_balancer_port: 80, 
      protocol: "HTTP", 
    }, 
  ], 
  load_balancer_name: "my-load-balancer", 
  security_groups: [
    "sg-a61988c3", 
  ], 
  subnets: [
    "subnet-15aaab61", 
  ], 
})

# resp.to_h outputs the following:
{
  dns_name: "my-load-balancer-1234567890.us-west-2.elb.amazonaws.com", 
}

Example: To create an HTTP load balancer in EC2-Classic


# This example creates a load balancer with an HTTP listener in EC2-Classic.

resp = client.create_load_balancer({
  availability_zones: [
    "us-west-2a", 
  ], 
  listeners: [
    {
      instance_port: 80, 
      instance_protocol: "HTTP", 
      load_balancer_port: 80, 
      protocol: "HTTP", 
    }, 
  ], 
  load_balancer_name: "my-load-balancer", 
})

# resp.to_h outputs the following:
{
  dns_name: "my-load-balancer-123456789.us-west-2.elb.amazonaws.com", 
}

Example: To create an HTTPS load balancer in a VPC


# This example creates a load balancer with an HTTPS listener in a VPC.

resp = client.create_load_balancer({
  listeners: [
    {
      instance_port: 80, 
      instance_protocol: "HTTP", 
      load_balancer_port: 80, 
      protocol: "HTTP", 
    }, 
    {
      instance_port: 80, 
      instance_protocol: "HTTP", 
      load_balancer_port: 443, 
      protocol: "HTTPS", 
      ssl_certificate_id: "arn:aws:iam::123456789012:server-certificate/my-server-cert", 
    }, 
  ], 
  load_balancer_name: "my-load-balancer", 
  security_groups: [
    "sg-a61988c3", 
  ], 
  subnets: [
    "subnet-15aaab61", 
  ], 
})

# resp.to_h outputs the following:
{
  dns_name: "my-load-balancer-1234567890.us-west-2.elb.amazonaws.com", 
}

Example: To create an HTTPS load balancer in EC2-Classic


# This example creates a load balancer with an HTTPS listener in EC2-Classic.

resp = client.create_load_balancer({
  availability_zones: [
    "us-west-2a", 
  ], 
  listeners: [
    {
      instance_port: 80, 
      instance_protocol: "HTTP", 
      load_balancer_port: 80, 
      protocol: "HTTP", 
    }, 
    {
      instance_port: 80, 
      instance_protocol: "HTTP", 
      load_balancer_port: 443, 
      protocol: "HTTPS", 
      ssl_certificate_id: "arn:aws:iam::123456789012:server-certificate/my-server-cert", 
    }, 
  ], 
  load_balancer_name: "my-load-balancer", 
})

# resp.to_h outputs the following:
{
  dns_name: "my-load-balancer-123456789.us-west-2.elb.amazonaws.com", 
}

Example: To create an internal load balancer


# This example creates an internal load balancer with an HTTP listener in a VPC.

resp = client.create_load_balancer({
  listeners: [
    {
      instance_port: 80, 
      instance_protocol: "HTTP", 
      load_balancer_port: 80, 
      protocol: "HTTP", 
    }, 
  ], 
  load_balancer_name: "my-load-balancer", 
  scheme: "internal", 
  security_groups: [
    "sg-a61988c3", 
  ], 
  subnets: [
    "subnet-15aaab61", 
  ], 
})

# resp.to_h outputs the following:
{
  dns_name: "internal-my-load-balancer-123456789.us-west-2.elb.amazonaws.com", 
}

Request syntax with placeholder values


resp = client.create_load_balancer({
  load_balancer_name: "AccessPointName", # required
  listeners: [ # required
    {
      protocol: "Protocol", # required
      load_balancer_port: 1, # required
      instance_protocol: "Protocol",
      instance_port: 1, # required
      ssl_certificate_id: "SSLCertificateId",
    },
  ],
  availability_zones: ["AvailabilityZone"],
  subnets: ["SubnetId"],
  security_groups: ["SecurityGroupId"],
  scheme: "LoadBalancerScheme",
  tags: [
    {
      key: "TagKey", # required
      value: "TagValue",
    },
  ],
})

Response structure


resp.dns_name #=> String

Options Hash (options):

  • :load_balancer_name (required, String)

    The name of the load balancer.

    This name must be unique within your set of load balancers for the region, must have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, and cannot begin or end with a hyphen.

  • :listeners (required, Array<Types::Listener>)

    The listeners.

    For more information, see Listeners for Your Classic Load Balancer in the Classic Load Balancers Guide.

  • :availability_zones (Array<String>)

    One or more Availability Zones from the same region as the load balancer.

    You must specify at least one Availability Zone.

    You can add more Availability Zones after you create the load balancer using EnableAvailabilityZonesForLoadBalancer.

  • :subnets (Array<String>)

    The IDs of the subnets in your VPC to attach to the load balancer. Specify one subnet per Availability Zone specified in AvailabilityZones.

  • :security_groups (Array<String>)

    The IDs of the security groups to assign to the load balancer.

  • :scheme (String)

    The type of a load balancer. Valid only for load balancers in a VPC.

    By default, Elastic Load Balancing creates an Internet-facing load balancer with a DNS name that resolves to public IP addresses. For more information about Internet-facing and Internal load balancers, see Load Balancer Scheme in the Elastic Load Balancing User Guide.

    Specify internal to create a load balancer with a DNS name that resolves to private IP addresses.

  • :tags (Array<Types::Tag>)

    A list of tags to assign to the load balancer.

    For more information about tagging your load balancer, see Tag Your Classic Load Balancer in the Classic Load Balancers Guide.

Returns:

See Also:

#create_load_balancer_listeners(options = {}) ⇒ Struct

Creates one or more listeners for the specified load balancer. If a listener with the specified port does not already exist, it is created; otherwise, the properties of the new listener must match the properties of the existing listener.

For more information, see Listeners for Your Classic Load Balancer in the Classic Load Balancers Guide.

Examples:

Example: To create an HTTP listener for a load balancer


# This example creates a listener for your load balancer at port 80 using the HTTP protocol.

resp = client.create_load_balancer_listeners({
  listeners: [
    {
      instance_port: 80, 
      instance_protocol: "HTTP", 
      load_balancer_port: 80, 
      protocol: "HTTP", 
    }, 
  ], 
  load_balancer_name: "my-load-balancer", 
})

Example: To create an HTTPS listener for a load balancer


# This example creates a listener for your load balancer at port 443 using the HTTPS protocol.

resp = client.create_load_balancer_listeners({
  listeners: [
    {
      instance_port: 80, 
      instance_protocol: "HTTP", 
      load_balancer_port: 443, 
      protocol: "HTTPS", 
      ssl_certificate_id: "arn:aws:iam::123456789012:server-certificate/my-server-cert", 
    }, 
  ], 
  load_balancer_name: "my-load-balancer", 
})

Request syntax with placeholder values


resp = client.create_load_balancer_listeners({
  load_balancer_name: "AccessPointName", # required
  listeners: [ # required
    {
      protocol: "Protocol", # required
      load_balancer_port: 1, # required
      instance_protocol: "Protocol",
      instance_port: 1, # required
      ssl_certificate_id: "SSLCertificateId",
    },
  ],
})

Options Hash (options):

  • :load_balancer_name (required, String)

    The name of the load balancer.

  • :listeners (required, Array<Types::Listener>)

    The listeners.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#create_load_balancer_policy(options = {}) ⇒ Struct

Creates a policy with the specified attributes for the specified load balancer.

Policies are settings that are saved for your load balancer and that can be applied to the listener or the application server, depending on the policy type.

Examples:

Example: To create a policy that enables Proxy Protocol on a load balancer


# This example creates a policy that enables Proxy Protocol on the specified load balancer.

resp = client.create_load_balancer_policy({
  load_balancer_name: "my-load-balancer", 
  policy_attributes: [
    {
      attribute_name: "ProxyProtocol", 
      attribute_value: "true", 
    }, 
  ], 
  policy_name: "my-ProxyProtocol-policy", 
  policy_type_name: "ProxyProtocolPolicyType", 
})

Example: To create a public key policy


# This example creates a public key policy.

resp = client.create_load_balancer_policy({
  load_balancer_name: "my-load-balancer", 
  policy_attributes: [
    {
      attribute_name: "PublicKey", 
      attribute_value: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwAYUjnfyEyXr1pxjhFWBpMlggUcqoi3kl+dS74kj//c6x7ROtusUaeQCTgIUkayttRDWchuqo1pHC1u+n5xxXnBBe2ejbb2WRsKIQ5rXEeixsjFpFsojpSQKkzhVGI6mJVZBJDVKSHmswnwLBdofLhzvllpovBPTHe+o4haAWvDBALJU0pkSI1FecPHcs2hwxf14zHoXy1e2k36A64nXW43wtfx5qcVSIxtCEOjnYRg7RPvybaGfQ+v6Iaxb/+7J5kEvZhTFQId+bSiJImF1FSUT1W1xwzBZPUbcUkkXDj45vC2s3Z8E+Lk7a3uZhvsQHLZnrfuWjBWGWvZ/MhZYgEXAMPLE", 
    }, 
  ], 
  policy_name: "my-PublicKey-policy", 
  policy_type_name: "PublicKeyPolicyType", 
})

Example: To create a backend server authentication policy


# This example creates a backend server authentication policy that enables authentication on your backend instance using a public key policy.

resp = client.create_load_balancer_policy({
  load_balancer_name: "my-load-balancer", 
  policy_attributes: [
    {
      attribute_name: "PublicKeyPolicyName", 
      attribute_value: "my-PublicKey-policy", 
    }, 
  ], 
  policy_name: "my-authentication-policy", 
  policy_type_name: "BackendServerAuthenticationPolicyType", 
})

Request syntax with placeholder values


resp = client.create_load_balancer_policy({
  load_balancer_name: "AccessPointName", # required
  policy_name: "PolicyName", # required
  policy_type_name: "PolicyTypeName", # required
  policy_attributes: [
    {
      attribute_name: "AttributeName",
      attribute_value: "AttributeValue",
    },
  ],
})

Options Hash (options):

  • :load_balancer_name (required, String)

    The name of the load balancer.

  • :policy_name (required, String)

    The name of the load balancer policy to be created. This name must be unique within the set of policies for this load balancer.

  • :policy_type_name (required, String)

    The name of the base policy type. To get the list of policy types, use DescribeLoadBalancerPolicyTypes.

  • :policy_attributes (Array<Types::PolicyAttribute>)

    The policy attributes.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#delete_load_balancer(options = {}) ⇒ Struct

Deletes the specified load balancer.

If you are attempting to recreate a load balancer, you must reconfigure all settings. The DNS name associated with a deleted load balancer are no longer usable. The name and associated DNS record of the deleted load balancer no longer exist and traffic sent to any of its IP addresses is no longer delivered to your instances.

If the load balancer does not exist or has already been deleted, the call to DeleteLoadBalancer still succeeds.

Examples:

Example: To delete a load balancer


# This example deletes the specified load balancer.

resp = client.delete_load_balancer({
  load_balancer_name: "my-load-balancer", 
})

Request syntax with placeholder values


resp = client.delete_load_balancer({
  load_balancer_name: "AccessPointName", # required
})

Options Hash (options):

  • :load_balancer_name (required, String)

    The name of the load balancer.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#delete_load_balancer_listeners(options = {}) ⇒ Struct

Deletes the specified listeners from the specified load balancer.

Examples:

Example: To delete a listener from your load balancer


# This example deletes the listener for the specified port from the specified load balancer.

resp = client.delete_load_balancer_listeners({
  load_balancer_name: "my-load-balancer", 
  load_balancer_ports: [
    80, 
  ], 
})

Request syntax with placeholder values


resp = client.delete_load_balancer_listeners({
  load_balancer_name: "AccessPointName", # required
  load_balancer_ports: [1], # required
})

Options Hash (options):

  • :load_balancer_name (required, String)

    The name of the load balancer.

  • :load_balancer_ports (required, Array<Integer>)

    The client port numbers of the listeners.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#delete_load_balancer_policy(options = {}) ⇒ Struct

Deletes the specified policy from the specified load balancer. This policy must not be enabled for any listeners.

Examples:

Example: To delete a policy from your load balancer


# This example deletes the specified policy from the specified load balancer. The policy must not be enabled on any listener.

resp = client.delete_load_balancer_policy({
  load_balancer_name: "my-load-balancer", 
  policy_name: "my-duration-cookie-policy", 
})

Request syntax with placeholder values


resp = client.delete_load_balancer_policy({
  load_balancer_name: "AccessPointName", # required
  policy_name: "PolicyName", # required
})

Options Hash (options):

  • :load_balancer_name (required, String)

    The name of the load balancer.

  • :policy_name (required, String)

    The name of the policy.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#deregister_instances_from_load_balancer(options = {}) ⇒ Types::DeregisterEndPointsOutput

Deregisters the specified instances from the specified load balancer. After the instance is deregistered, it no longer receives traffic from the load balancer.

You can use DescribeLoadBalancers to verify that the instance is deregistered from the load balancer.

For more information, see Register or De-Register EC2 Instances in the Classic Load Balancers Guide.

Examples:

Example: To deregister instances from a load balancer


# This example deregisters the specified instance from the specified load balancer.

resp = client.deregister_instances_from_load_balancer({
  instances: [
    {
      instance_id: "i-d6f6fae3", 
    }, 
  ], 
  load_balancer_name: "my-load-balancer", 
})

# resp.to_h outputs the following:
{
  instances: [
    {
      instance_id: "i-207d9717", 
    }, 
    {
      instance_id: "i-afefb49b", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.deregister_instances_from_load_balancer({
  load_balancer_name: "AccessPointName", # required
  instances: [ # required
    {
      instance_id: "InstanceId",
    },
  ],
})

Response structure


resp.instances #=> Array
resp.instances[0].instance_id #=> String

Options Hash (options):

  • :load_balancer_name (required, String)

    The name of the load balancer.

  • :instances (required, Array<Types::Instance>)

    The IDs of the instances.

Returns:

See Also:

#describe_account_limits(options = {}) ⇒ Types::DescribeAccountLimitsOutput

Describes the current Elastic Load Balancing resource limits for your AWS account.

For more information, see Limits for Your Classic Load Balancer in the Classic Load Balancers Guide.

Examples:

Request syntax with placeholder values


resp = client.({
  marker: "Marker",
  page_size: 1,
})

Response structure


resp.limits #=> Array
resp.limits[0].name #=> String
resp.limits[0].max #=> String
resp.next_marker #=> String

Options Hash (options):

  • :marker (String)

    The marker for the next set of results. (You received this marker from a previous call.)

  • :page_size (Integer)

    The maximum number of results to return with this call.

Returns:

See Also:

#describe_instance_health(options = {}) ⇒ Types::DescribeEndPointStateOutput

Describes the state of the specified instances with respect to the specified load balancer. If no instances are specified, the call describes the state of all instances that are currently registered with the load balancer. If instances are specified, their state is returned even if they are no longer registered with the load balancer. The state of terminated instances is not returned.

Examples:

Example: To describe the health of the instances for a load balancer


# This example describes the health of the instances for the specified load balancer.

resp = client.describe_instance_health({
  load_balancer_name: "my-load-balancer", 
})

# resp.to_h outputs the following:
{
  instance_states: [
    {
      description: "N/A", 
      instance_id: "i-207d9717", 
      reason_code: "N/A", 
      state: "InService", 
    }, 
    {
      description: "N/A", 
      instance_id: "i-afefb49b", 
      reason_code: "N/A", 
      state: "InService", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.describe_instance_health({
  load_balancer_name: "AccessPointName", # required
  instances: [
    {
      instance_id: "InstanceId",
    },
  ],
})

Response structure


resp.instance_states #=> Array
resp.instance_states[0].instance_id #=> String
resp.instance_states[0].state #=> String
resp.instance_states[0].reason_code #=> String
resp.instance_states[0].description #=> String

Options Hash (options):

  • :load_balancer_name (required, String)

    The name of the load balancer.

  • :instances (Array<Types::Instance>)

    The IDs of the instances.

Returns:

See Also:

#describe_load_balancer_attributes(options = {}) ⇒ Types::DescribeLoadBalancerAttributesOutput

Describes the attributes for the specified load balancer.

Examples:

Example: To describe the attributes of a load balancer


# This example describes the attributes of the specified load balancer.

resp = client.describe_load_balancer_attributes({
  load_balancer_name: "my-load-balancer", 
})

# resp.to_h outputs the following:
{
  load_balancer_attributes: {
    access_log: {
      enabled: false, 
    }, 
    connection_draining: {
      enabled: false, 
      timeout: 300, 
    }, 
    connection_settings: {
      idle_timeout: 60, 
    }, 
    cross_zone_load_balancing: {
      enabled: false, 
    }, 
  }, 
}

Request syntax with placeholder values


resp = client.describe_load_balancer_attributes({
  load_balancer_name: "AccessPointName", # required
})

Response structure


resp.load_balancer_attributes.cross_zone_load_balancing.enabled #=> true/false
resp.load_balancer_attributes.access_log.enabled #=> true/false
resp.load_balancer_attributes.access_log.s3_bucket_name #=> String
resp.load_balancer_attributes.access_log.emit_interval #=> Integer
resp.load_balancer_attributes.access_log.s3_bucket_prefix #=> String
resp.load_balancer_attributes.connection_draining.enabled #=> true/false
resp.load_balancer_attributes.connection_draining.timeout #=> Integer
resp.load_balancer_attributes.connection_settings.idle_timeout #=> Integer
resp.load_balancer_attributes.additional_attributes #=> Array
resp.load_balancer_attributes.additional_attributes[0].key #=> String
resp.load_balancer_attributes.additional_attributes[0].value #=> String

Options Hash (options):

  • :load_balancer_name (required, String)

    The name of the load balancer.

Returns:

See Also:

#describe_load_balancer_policies(options = {}) ⇒ Types::DescribeLoadBalancerPoliciesOutput

Describes the specified policies.

If you specify a load balancer name, the action returns the descriptions of all policies created for the load balancer. If you specify a policy name associated with your load balancer, the action returns the description of that policy. If you don't specify a load balancer name, the action returns descriptions of the specified sample policies, or descriptions of all sample policies. The names of the sample policies have the ELBSample- prefix.

Examples:

Example: To describe a policy associated with a load balancer


# This example describes the specified policy associated with the specified load balancer.

resp = client.describe_load_balancer_policies({
  load_balancer_name: "my-load-balancer", 
  policy_names: [
    "my-authentication-policy", 
  ], 
})

# resp.to_h outputs the following:
{
  policy_descriptions: [
    {
      policy_attribute_descriptions: [
        {
          attribute_name: "PublicKeyPolicyName", 
          attribute_value: "my-PublicKey-policy", 
        }, 
      ], 
      policy_name: "my-authentication-policy", 
      policy_type_name: "BackendServerAuthenticationPolicyType", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.describe_load_balancer_policies({
  load_balancer_name: "AccessPointName",
  policy_names: ["PolicyName"],
})

Response structure


resp.policy_descriptions #=> Array
resp.policy_descriptions[0].policy_name #=> String
resp.policy_descriptions[0].policy_type_name #=> String
resp.policy_descriptions[0].policy_attribute_descriptions #=> Array
resp.policy_descriptions[0].policy_attribute_descriptions[0].attribute_name #=> String
resp.policy_descriptions[0].policy_attribute_descriptions[0].attribute_value #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>

Options Hash (options):

  • :load_balancer_name (String)

    The name of the load balancer.

  • :policy_names (Array<String>)

    The names of the policies.

Returns:

See Also:

#describe_load_balancer_policy_types(options = {}) ⇒ Types::DescribeLoadBalancerPolicyTypesOutput

Describes the specified load balancer policy types or all load balancer policy types.

The description of each type indicates how it can be used. For example, some policies can be used only with layer 7 listeners, some policies can be used only with layer 4 listeners, and some policies can be used only with your EC2 instances.

You can use CreateLoadBalancerPolicy to create a policy configuration for any of these policy types. Then, depending on the policy type, use either SetLoadBalancerPoliciesOfListener or SetLoadBalancerPoliciesForBackendServer to set the policy.

Examples:

Example: To describe a load balancer policy type defined by Elastic Load Balancing


# This example describes the specified load balancer policy type.

resp = client.describe_load_balancer_policy_types({
  policy_type_names: [
    "ProxyProtocolPolicyType", 
  ], 
})

# resp.to_h outputs the following:
{
  policy_type_descriptions: [
    {
      description: "Policy that controls whether to include the IP address and port of the originating request for TCP messages. This policy operates on TCP listeners only.", 
      policy_attribute_type_descriptions: [
        {
          attribute_name: "ProxyProtocol", 
          attribute_type: "Boolean", 
          cardinality: "ONE", 
        }, 
      ], 
      policy_type_name: "ProxyProtocolPolicyType", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.describe_load_balancer_policy_types({
  policy_type_names: ["PolicyTypeName"],
})

Response structure


resp.policy_type_descriptions #=> Array
resp.policy_type_descriptions[0].policy_type_name #=> String
resp.policy_type_descriptions[0].description #=> String
resp.policy_type_descriptions[0].policy_attribute_type_descriptions #=> Array
resp.policy_type_descriptions[0].policy_attribute_type_descriptions[0].attribute_name #=> String
resp.policy_type_descriptions[0].policy_attribute_type_descriptions[0].attribute_type #=> String
resp.policy_type_descriptions[0].policy_attribute_type_descriptions[0].description #=> String
resp.policy_type_descriptions[0].policy_attribute_type_descriptions[0].default_value #=> String
resp.policy_type_descriptions[0].policy_attribute_type_descriptions[0].cardinality #=> String

Options Hash (options):

  • :policy_type_names (Array<String>)

    The names of the policy types. If no names are specified, describes all policy types defined by Elastic Load Balancing.

Returns:

See Also:

#describe_load_balancers(options = {}) ⇒ Types::DescribeAccessPointsOutput

Describes the specified the load balancers. If no load balancers are specified, the call describes all of your load balancers.

Examples:

Example: To describe one of your load balancers


# This example describes the specified load balancer.

resp = client.describe_load_balancers({
  load_balancer_names: [
    "my-load-balancer", 
  ], 
})

# resp.to_h outputs the following:
{
  load_balancer_descriptions: [
    {
      availability_zones: [
        "us-west-2a", 
      ], 
      backend_server_descriptions: [
        {
          instance_port: 80, 
          policy_names: [
            "my-ProxyProtocol-policy", 
          ], 
        }, 
      ], 
      canonical_hosted_zone_name: "my-load-balancer-1234567890.us-west-2.elb.amazonaws.com", 
      canonical_hosted_zone_name_id: "Z3DZXE0EXAMPLE", 
      created_time: Time.parse("2015-03-19T03:24:02.650Z"), 
      dns_name: "my-load-balancer-1234567890.us-west-2.elb.amazonaws.com", 
      health_check: {
        healthy_threshold: 2, 
        interval: 30, 
        target: "HTTP:80/png", 
        timeout: 3, 
        unhealthy_threshold: 2, 
      }, 
      instances: [
        {
          instance_id: "i-207d9717", 
        }, 
        {
          instance_id: "i-afefb49b", 
        }, 
      ], 
      listener_descriptions: [
        {
          listener: {
            instance_port: 80, 
            instance_protocol: "HTTP", 
            load_balancer_port: 80, 
            protocol: "HTTP", 
          }, 
          policy_names: [
          ], 
        }, 
        {
          listener: {
            instance_port: 443, 
            instance_protocol: "HTTPS", 
            load_balancer_port: 443, 
            protocol: "HTTPS", 
            ssl_certificate_id: "arn:aws:iam::123456789012:server-certificate/my-server-cert", 
          }, 
          policy_names: [
            "ELBSecurityPolicy-2015-03", 
          ], 
        }, 
      ], 
      load_balancer_name: "my-load-balancer", 
      policies: {
        app_cookie_stickiness_policies: [
        ], 
        lb_cookie_stickiness_policies: [
          {
            cookie_expiration_period: 60, 
            policy_name: "my-duration-cookie-policy", 
          }, 
        ], 
        other_policies: [
          "my-PublicKey-policy", 
          "my-authentication-policy", 
          "my-SSLNegotiation-policy", 
          "my-ProxyProtocol-policy", 
          "ELBSecurityPolicy-2015-03", 
        ], 
      }, 
      scheme: "internet-facing", 
      security_groups: [
        "sg-a61988c3", 
      ], 
      source_security_group: {
        group_name: "my-elb-sg", 
        owner_alias: "123456789012", 
      }, 
      subnets: [
        "subnet-15aaab61", 
      ], 
      vpc_id: "vpc-a01106c2", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.describe_load_balancers({
  load_balancer_names: ["AccessPointName"],
  marker: "Marker",
  page_size: 1,
})

Response structure


resp.load_balancer_descriptions #=> Array
resp.load_balancer_descriptions[0].load_balancer_name #=> String
resp.load_balancer_descriptions[0].dns_name #=> String
resp.load_balancer_descriptions[0].canonical_hosted_zone_name #=> String
resp.load_balancer_descriptions[0].canonical_hosted_zone_name_id #=> String
resp.load_balancer_descriptions[0].listener_descriptions #=> Array
resp.load_balancer_descriptions[0].listener_descriptions[0].listener.protocol #=> String
resp.load_balancer_descriptions[0].listener_descriptions[0].listener.load_balancer_port #=> Integer
resp.load_balancer_descriptions[0].listener_descriptions[0].listener.instance_protocol #=> String
resp.load_balancer_descriptions[0].listener_descriptions[0].listener.instance_port #=> Integer
resp.load_balancer_descriptions[0].listener_descriptions[0].listener.ssl_certificate_id #=> String
resp.load_balancer_descriptions[0].listener_descriptions[0].policy_names #=> Array
resp.load_balancer_descriptions[0].listener_descriptions[0].policy_names[0] #=> String
resp.load_balancer_descriptions[0].policies.app_cookie_stickiness_policies #=> Array
resp.load_balancer_descriptions[0].policies.app_cookie_stickiness_policies[0].policy_name #=> String
resp.load_balancer_descriptions[0].policies.app_cookie_stickiness_policies[0].cookie_name #=> String
resp.load_balancer_descriptions[0].policies.lb_cookie_stickiness_policies #=> Array
resp.load_balancer_descriptions[0].policies.lb_cookie_stickiness_policies[0].policy_name #=> String
resp.load_balancer_descriptions[0].policies.lb_cookie_stickiness_policies[0].cookie_expiration_period #=> Integer
resp.load_balancer_descriptions[0].policies.other_policies #=> Array
resp.load_balancer_descriptions[0].policies.other_policies[0] #=> String
resp.load_balancer_descriptions[0].backend_server_descriptions #=> Array
resp.load_balancer_descriptions[0].backend_server_descriptions[0].instance_port #=> Integer
resp.load_balancer_descriptions[0].backend_server_descriptions[0].policy_names #=> Array
resp.load_balancer_descriptions[0].backend_server_descriptions[0].policy_names[0] #=> String
resp.load_balancer_descriptions[0].availability_zones #=> Array
resp.load_balancer_descriptions[0].availability_zones[0] #=> String
resp.load_balancer_descriptions[0].subnets #=> Array
resp.load_balancer_descriptions[0].subnets[0] #=> String
resp.load_balancer_descriptions[0].vpc_id #=> String
resp.load_balancer_descriptions[0].instances #=> Array
resp.load_balancer_descriptions[0].instances[0].instance_id #=> String
resp.load_balancer_descriptions[0].health_check.target #=> String
resp.load_balancer_descriptions[0].health_check.interval #=> Integer
resp.load_balancer_descriptions[0].health_check.timeout #=> Integer
resp.load_balancer_descriptions[0].health_check.unhealthy_threshold #=> Integer
resp.load_balancer_descriptions[0].health_check.healthy_threshold #=> Integer
resp.load_balancer_descriptions[0].source_security_group.owner_alias #=> String
resp.load_balancer_descriptions[0].source_security_group.group_name #=> String
resp.load_balancer_descriptions[0].security_groups #=> Array
resp.load_balancer_descriptions[0].security_groups[0] #=> String
resp.load_balancer_descriptions[0].created_time #=> Time
resp.load_balancer_descriptions[0].scheme #=> String
resp.next_marker #=> String

Options Hash (options):

  • :load_balancer_names (Array<String>)

    The names of the load balancers.

  • :marker (String)

    The marker for the next set of results. (You received this marker from a previous call.)

  • :page_size (Integer)

    The maximum number of results to return with this call (a number from 1 to 400). The default is 400.

Returns:

See Also:

#describe_tags(options = {}) ⇒ Types::DescribeTagsOutput

Describes the tags associated with the specified load balancers.

Examples:

Example: To describe the tags for a load balancer


# This example describes the tags for the specified load balancer.

resp = client.describe_tags({
  load_balancer_names: [
    "my-load-balancer", 
  ], 
})

# resp.to_h outputs the following:
{
  tag_descriptions: [
    {
      load_balancer_name: "my-load-balancer", 
      tags: [
        {
          key: "project", 
          value: "lima", 
        }, 
        {
          key: "department", 
          value: "digital-media", 
        }, 
      ], 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.describe_tags({
  load_balancer_names: ["AccessPointName"], # required
})

Response structure


resp.tag_descriptions #=> Array
resp.tag_descriptions[0].load_balancer_name #=> String
resp.tag_descriptions[0].tags #=> Array
resp.tag_descriptions[0].tags[0].key #=> String
resp.tag_descriptions[0].tags[0].value #=> String

Options Hash (options):

  • :load_balancer_names (required, Array<String>)

    The names of the load balancers.

Returns:

See Also:

#detach_load_balancer_from_subnets(options = {}) ⇒ Types::DetachLoadBalancerFromSubnetsOutput

Removes the specified subnets from the set of configured subnets for the load balancer.

After a subnet is removed, all EC2 instances registered with the load balancer in the removed subnet go into the OutOfService state. Then, the load balancer balances the traffic among the remaining routable subnets.

Examples:

Example: To detach a load balancer from a subnet


# This example detaches the specified load balancer from the specified subnet.

resp = client.detach_load_balancer_from_subnets({
  load_balancer_name: "my-load-balancer", 
  subnets: [
    "subnet-0ecac448", 
  ], 
})

# resp.to_h outputs the following:
{
  subnets: [
    "subnet-15aaab61", 
  ], 
}

Request syntax with placeholder values


resp = client.detach_load_balancer_from_subnets({
  load_balancer_name: "AccessPointName", # required
  subnets: ["SubnetId"], # required
})

Response structure


resp.subnets #=> Array
resp.subnets[0] #=> String

Options Hash (options):

  • :load_balancer_name (required, String)

    The name of the load balancer.

  • :subnets (required, Array<String>)

    The IDs of the subnets.

Returns:

See Also:

#disable_availability_zones_for_load_balancer(options = {}) ⇒ Types::RemoveAvailabilityZonesOutput

Removes the specified Availability Zones from the set of Availability Zones for the specified load balancer in EC2-Classic or a default VPC.

For load balancers in a non-default VPC, use DetachLoadBalancerFromSubnets.

There must be at least one Availability Zone registered with a load balancer at all times. After an Availability Zone is removed, all instances registered with the load balancer that are in the removed Availability Zone go into the OutOfService state. Then, the load balancer attempts to equally balance the traffic among its remaining Availability Zones.

For more information, see Add or Remove Availability Zones in the Classic Load Balancers Guide.

Examples:

Example: To disable an Availability Zone for a load balancer


# This example removes the specified Availability Zone from the set of Availability Zones for the specified load balancer.

resp = client.disable_availability_zones_for_load_balancer({
  availability_zones: [
    "us-west-2a", 
  ], 
  load_balancer_name: "my-load-balancer", 
})

# resp.to_h outputs the following:
{
  availability_zones: [
    "us-west-2b", 
  ], 
}

Request syntax with placeholder values


resp = client.disable_availability_zones_for_load_balancer({
  load_balancer_name: "AccessPointName", # required
  availability_zones: ["AvailabilityZone"], # required
})

Response structure


resp.availability_zones #=> Array
resp.availability_zones[0] #=> String

Options Hash (options):

  • :load_balancer_name (required, String)

    The name of the load balancer.

  • :availability_zones (required, Array<String>)

    The Availability Zones.

Returns:

See Also:

#enable_availability_zones_for_load_balancer(options = {}) ⇒ Types::AddAvailabilityZonesOutput

Adds the specified Availability Zones to the set of Availability Zones for the specified load balancer in EC2-Classic or a default VPC.

For load balancers in a non-default VPC, use AttachLoadBalancerToSubnets.

The load balancer evenly distributes requests across all its registered Availability Zones that contain instances. For more information, see Add or Remove Availability Zones in the Classic Load Balancers Guide.

Examples:

Example: To enable an Availability Zone for a load balancer


# This example adds the specified Availability Zone to the specified load balancer.

resp = client.enable_availability_zones_for_load_balancer({
  availability_zones: [
    "us-west-2b", 
  ], 
  load_balancer_name: "my-load-balancer", 
})

# resp.to_h outputs the following:
{
  availability_zones: [
    "us-west-2a", 
    "us-west-2b", 
  ], 
}

Request syntax with placeholder values


resp = client.enable_availability_zones_for_load_balancer({
  load_balancer_name: "AccessPointName", # required
  availability_zones: ["AvailabilityZone"], # required
})

Response structure


resp.availability_zones #=> Array
resp.availability_zones[0] #=> String

Options Hash (options):

  • :load_balancer_name (required, String)

    The name of the load balancer.

  • :availability_zones (required, Array<String>)

    The Availability Zones. These must be in the same region as the load balancer.

Returns:

See Also:

#modify_load_balancer_attributes(options = {}) ⇒ Types::ModifyLoadBalancerAttributesOutput

Modifies the attributes of the specified load balancer.

You can modify the load balancer attributes, such as AccessLogs, ConnectionDraining, and CrossZoneLoadBalancing by either enabling or disabling them. Or, you can modify the load balancer attribute ConnectionSettings by specifying an idle connection timeout value for your load balancer.

For more information, see the following in the Classic Load Balancers Guide:

Examples:

Example: To enable cross-zone load balancing


# This example enables cross-zone load balancing for the specified load balancer.

resp = client.modify_load_balancer_attributes({
  load_balancer_attributes: {
    cross_zone_load_balancing: {
      enabled: true, 
    }, 
  }, 
  load_balancer_name: "my-load-balancer", 
})

# resp.to_h outputs the following:
{
  load_balancer_attributes: {
    cross_zone_load_balancing: {
      enabled: true, 
    }, 
  }, 
  load_balancer_name: "my-load-balancer", 
}

Example: To enable connection draining


# This example enables connection draining for the specified load balancer.

resp = client.modify_load_balancer_attributes({
  load_balancer_attributes: {
    connection_draining: {
      enabled: true, 
      timeout: 300, 
    }, 
  }, 
  load_balancer_name: "my-load-balancer", 
})

# resp.to_h outputs the following:
{
  load_balancer_attributes: {
    connection_draining: {
      enabled: true, 
      timeout: 300, 
    }, 
  }, 
  load_balancer_name: "my-load-balancer", 
}

Request syntax with placeholder values


resp = client.modify_load_balancer_attributes({
  load_balancer_name: "AccessPointName", # required
  load_balancer_attributes: { # required
    cross_zone_load_balancing: {
      enabled: false, # required
    },
    access_log: {
      enabled: false, # required
      s3_bucket_name: "S3BucketName",
      emit_interval: 1,
      s3_bucket_prefix: "AccessLogPrefix",
    },
    connection_draining: {
      enabled: false, # required
      timeout: 1,
    },
    connection_settings: {
      idle_timeout: 1, # required
    },
    additional_attributes: [
      {
        key: "AdditionalAttributeKey",
        value: "AdditionalAttributeValue",
      },
    ],
  },
})

Response structure


resp.load_balancer_name #=> String
resp.load_balancer_attributes.cross_zone_load_balancing.enabled #=> true/false
resp.load_balancer_attributes.access_log.enabled #=> true/false
resp.load_balancer_attributes.access_log.s3_bucket_name #=> String
resp.load_balancer_attributes.access_log.emit_interval #=> Integer
resp.load_balancer_attributes.access_log.s3_bucket_prefix #=> String
resp.load_balancer_attributes.connection_draining.enabled #=> true/false
resp.load_balancer_attributes.connection_draining.timeout #=> Integer
resp.load_balancer_attributes.connection_settings.idle_timeout #=> Integer
resp.load_balancer_attributes.additional_attributes #=> Array
resp.load_balancer_attributes.additional_attributes[0].key #=> String
resp.load_balancer_attributes.additional_attributes[0].value #=> String

Options Hash (options):

  • :load_balancer_name (required, String)

    The name of the load balancer.

  • :load_balancer_attributes (required, Types::LoadBalancerAttributes)

    The attributes for the load balancer.

Returns:

See Also:

#register_instances_with_load_balancer(options = {}) ⇒ Types::RegisterEndPointsOutput

Adds the specified instances to the specified load balancer.

The instance must be a running instance in the same network as the load balancer (EC2-Classic or the same VPC). If you have EC2-Classic instances and a load balancer in a VPC with ClassicLink enabled, you can link the EC2-Classic instances to that VPC and then register the linked EC2-Classic instances with the load balancer in the VPC.

Note that RegisterInstanceWithLoadBalancer completes when the request has been registered. Instance registration takes a little time to complete. To check the state of the registered instances, use DescribeLoadBalancers or DescribeInstanceHealth.

After the instance is registered, it starts receiving traffic and requests from the load balancer. Any instance that is not in one of the Availability Zones registered for the load balancer is moved to the OutOfService state. If an Availability Zone is added to the load balancer later, any instances registered with the load balancer move to the InService state.

To deregister instances from a load balancer, use DeregisterInstancesFromLoadBalancer.

For more information, see Register or De-Register EC2 Instances in the Classic Load Balancers Guide.

Examples:

Example: To register instances with a load balancer


# This example registers the specified instance with the specified load balancer.

resp = client.register_instances_with_load_balancer({
  instances: [
    {
      instance_id: "i-d6f6fae3", 
    }, 
  ], 
  load_balancer_name: "my-load-balancer", 
})

# resp.to_h outputs the following:
{
  instances: [
    {
      instance_id: "i-d6f6fae3", 
    }, 
    {
      instance_id: "i-207d9717", 
    }, 
    {
      instance_id: "i-afefb49b", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.register_instances_with_load_balancer({
  load_balancer_name: "AccessPointName", # required
  instances: [ # required
    {
      instance_id: "InstanceId",
    },
  ],
})

Response structure


resp.instances #=> Array
resp.instances[0].instance_id #=> String

Options Hash (options):

  • :load_balancer_name (required, String)

    The name of the load balancer.

  • :instances (required, Array<Types::Instance>)

    The IDs of the instances.

Returns:

See Also:

#remove_tags(options = {}) ⇒ Struct

Removes one or more tags from the specified load balancer.

Examples:

Example: To remove tags from a load balancer


# This example removes the specified tag from the specified load balancer.

resp = client.remove_tags({
  load_balancer_names: [
    "my-load-balancer", 
  ], 
  tags: [
    {
      key: "project", 
    }, 
  ], 
})

Request syntax with placeholder values


resp = client.remove_tags({
  load_balancer_names: ["AccessPointName"], # required
  tags: [ # required
    {
      key: "TagKey",
    },
  ],
})

Options Hash (options):

  • :load_balancer_names (required, Array<String>)

    The name of the load balancer. You can specify a maximum of one load balancer name.

  • :tags (required, Array<Types::TagKeyOnly>)

    The list of tag keys to remove.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#set_load_balancer_listener_ssl_certificate(options = {}) ⇒ Struct

Sets the certificate that terminates the specified listener's SSL connections. The specified certificate replaces any prior certificate that was used on the same load balancer and port.

For more information about updating your SSL certificate, see Replace the SSL Certificate for Your Load Balancer in the Classic Load Balancers Guide.

Examples:

Example: To update the SSL certificate for an HTTPS listener


# This example replaces the existing SSL certificate for the specified HTTPS listener.

resp = client.set_load_balancer_listener_ssl_certificate({
  load_balancer_name: "my-load-balancer", 
  load_balancer_port: 443, 
  ssl_certificate_id: "arn:aws:iam::123456789012:server-certificate/new-server-cert", 
})

Request syntax with placeholder values


resp = client.set_load_balancer_listener_ssl_certificate({
  load_balancer_name: "AccessPointName", # required
  load_balancer_port: 1, # required
  ssl_certificate_id: "SSLCertificateId", # required
})

Options Hash (options):

  • :load_balancer_name (required, String)

    The name of the load balancer.

  • :load_balancer_port (required, Integer)

    The port that uses the specified SSL certificate.

  • :ssl_certificate_id (required, String)

    The Amazon Resource Name (ARN) of the SSL certificate.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#set_load_balancer_policies_for_backend_server(options = {}) ⇒ Struct

Replaces the set of policies associated with the specified port on which the EC2 instance is listening with a new set of policies. At this time, only the back-end server authentication policy type can be applied to the instance ports; this policy type is composed of multiple public key policies.

Each time you use SetLoadBalancerPoliciesForBackendServer to enable the policies, use the PolicyNames parameter to list the policies that you want to enable.

You can use DescribeLoadBalancers or DescribeLoadBalancerPolicies to verify that the policy is associated with the EC2 instance.

For more information about enabling back-end instance authentication, see Configure Back-end Instance Authentication in the Classic Load Balancers Guide. For more information about Proxy Protocol, see Configure Proxy Protocol Support in the Classic Load Balancers Guide.

Examples:

Example: To replace the policies associated with a port for a backend instance


# This example replaces the policies that are currently associated with the specified port.

resp = client.set_load_balancer_policies_for_backend_server({
  instance_port: 80, 
  load_balancer_name: "my-load-balancer", 
  policy_names: [
    "my-ProxyProtocol-policy", 
  ], 
})

Request syntax with placeholder values


resp = client.set_load_balancer_policies_for_backend_server({
  load_balancer_name: "AccessPointName", # required
  instance_port: 1, # required
  policy_names: ["PolicyName"], # required
})

Options Hash (options):

  • :load_balancer_name (required, String)

    The name of the load balancer.

  • :instance_port (required, Integer)

    The port number associated with the EC2 instance.

  • :policy_names (required, Array<String>)

    The names of the policies. If the list is empty, then all current polices are removed from the EC2 instance.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#set_load_balancer_policies_of_listener(options = {}) ⇒ Struct

Replaces the current set of policies for the specified load balancer port with the specified set of policies.

To enable back-end server authentication, use SetLoadBalancerPoliciesForBackendServer.

For more information about setting policies, see Update the SSL Negotiation Configuration, Duration-Based Session Stickiness, and Application-Controlled Session Stickiness in the Classic Load Balancers Guide.

Examples:

Example: To replace the policies associated with a listener


# This example replaces the policies that are currently associated with the specified listener.

resp = client.set_load_balancer_policies_of_listener({
  load_balancer_name: "my-load-balancer", 
  load_balancer_port: 80, 
  policy_names: [
    "my-SSLNegotiation-policy", 
  ], 
})

Request syntax with placeholder values


resp = client.set_load_balancer_policies_of_listener({
  load_balancer_name: "AccessPointName", # required
  load_balancer_port: 1, # required
  policy_names: ["PolicyName"], # required
})

Options Hash (options):

  • :load_balancer_name (required, String)

    The name of the load balancer.

  • :load_balancer_port (required, Integer)

    The external port of the load balancer.

  • :policy_names (required, Array<String>)

    The names of the policies. This list must include all policies to be enabled. If you omit a policy that is currently enabled, it is disabled. If the list is empty, all current policies are disabled.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#wait_until(waiter_name, params = {}) {|waiter| ... } ⇒ Boolean

Waiters polls an API operation until a resource enters a desired state.

Basic Usage

Waiters will poll until they are succesful, they fail by entering a terminal state, or until a maximum number of attempts are made.

# polls in a loop, sleeping between attempts client.waiter_until(waiter_name, params)

Configuration

You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. You configure waiters by passing a block to #wait_until:

# poll for ~25 seconds
client.wait_until(...) do |w|
  w.max_attempts = 5
  w.delay = 5
end

Callbacks

You can be notified before each polling attempt and before each delay. If you throw :success or :failure from these callbacks, it will terminate the waiter.

started_at = Time.now
client.wait_until(...) do |w|

  # disable max attempts
  w.max_attempts = nil

  # poll for 1 hour, instead of a number of attempts
  w.before_wait do |attempts, response|
    throw :failure if Time.now - started_at > 3600
  end

end

Handling Errors

When a waiter is successful, it returns true. When a waiter fails, it raises an error. All errors raised extend from Waiters::Errors::WaiterFailed.

begin
  client.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
  # resource did not enter the desired state in time
end

Parameters:

  • waiter_name (Symbol)

    The name of the waiter. See #waiter_names for a full list of supported waiters.

  • params (Hash) (defaults to: {})

    Additional request parameters. See the #waiter_names for a list of supported waiters and what request they call. The called request determines the list of accepted parameters.

Yield Parameters:

Returns:

  • (Boolean)

    Returns true if the waiter was successful.

Raises:

  • (Errors::FailureStateError)

    Raised when the waiter terminates because the waiter has entered a state that it will not transition out of, preventing success.

  • (Errors::TooManyAttemptsError)

    Raised when the configured maximum number of attempts have been made, and the waiter is not yet successful.

  • (Errors::UnexpectedError)

    Raised when an error is encounted while polling for a resource that is not expected.

  • (Errors::NoSuchWaiterError)

    Raised when you request to wait for an unknown state.

#waiter_namesArray<Symbol>

Returns the list of supported waiters. The following table lists the supported waiters and the client method they call:

Waiter NameClient MethodDefault Delay:Default Max Attempts:
:any_instance_in_service#describe_instance_health1540
:instance_deregistered#describe_instance_health1540
:instance_in_service#describe_instance_health1540

Returns:

  • (Array<Symbol>)

    the list of supported waiters.