Class: Aws::ElasticLoadBalancing::Client

Inherits:
Seahorse::Client::Base
  • Object
show all
Includes:
ClientStubs
Defined in:
lib/aws-sdk-elasticloadbalancing/client.rb

Class Attribute Summary collapse

API Operations collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Client

Returns a new instance of Client.

Parameters:

  • options (Hash)

Options Hash (options):

  • :credentials (required, Aws::CredentialProvider)

    Your AWS credentials. This can be an instance of any one of the following classes:

    • ‘Aws::Credentials` - Used for configuring static, non-refreshing credentials.

    • ‘Aws::InstanceProfileCredentials` - Used for loading credentials from an EC2 IMDS on an EC2 instance.

    • ‘Aws::SharedCredentials` - Used for loading credentials from a shared file, such as `~/.aws/config`.

    • ‘Aws::AssumeRoleCredentials` - Used when you need to assume a role.

    When ‘:credentials` are not configured directly, the following locations will be searched for credentials:

    • Aws.config`

    • The ‘:access_key_id`, `:secret_access_key`, and `:session_token` options.

    • ENV, ENV

    • ‘~/.aws/credentials`

    • ‘~/.aws/config`

    • EC2 IMDS instance profile - When used by default, the timeouts are very aggressive. Construct and pass an instance of ‘Aws::InstanceProfileCredentails` to enable retries and extended timeouts.

  • :region (required, String)

    The AWS region to connect to. The configured ‘:region` is used to determine the service `:endpoint`. When not passed, a default `:region` is search for in the following locations:

  • :access_key_id (String)
  • :active_endpoint_cache (Boolean) — default: false

    When set to ‘true`, a thread polling for endpoints will be running in the background every 60 secs (default). Defaults to `false`.

  • :client_side_monitoring (Boolean) — default: false

    When ‘true`, client-side metrics will be collected for all API requests from this client.

  • :client_side_monitoring_client_id (String) — default: ""

    Allows you to provide an identifier for this client which will be attached to all generated client side metrics. Defaults to an empty string.

  • :client_side_monitoring_port (Integer) — default: 31000

    Required for publishing client metrics. The port that the client side monitoring agent is running on, where client metrics will be published via UDP.

  • :client_side_monitoring_publisher (Aws::ClientSideMonitoring::Publisher) — default: Aws::ClientSideMonitoring::Publisher

    Allows you to provide a custom client-side monitoring publisher class. By default, will use the Client Side Monitoring Agent Publisher.

  • :convert_params (Boolean) — default: true

    When ‘true`, an attempt is made to coerce request parameters into the required types.

  • :disable_host_prefix_injection (Boolean) — default: false

    Set to true to disable SDK automatically adding host prefix to default service endpoint when available.

  • :endpoint (String)

    The client endpoint is normally constructed from the ‘:region` option. You should only configure an `:endpoint` when connecting to test endpoints. This should be avalid HTTP(S) URI.

  • :endpoint_cache_max_entries (Integer) — default: 1000

    Used for the maximum size limit of the LRU cache storing endpoints data for endpoint discovery enabled operations. Defaults to 1000.

  • :endpoint_cache_max_threads (Integer) — default: 10

    Used for the maximum threads in use for polling endpoints to be cached, defaults to 10.

  • :endpoint_cache_poll_interval (Integer) — default: 60

    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.

  • :endpoint_discovery (Boolean) — default: false

    When set to ‘true`, endpoint discovery will be enabled for operations when available. Defaults to `false`.

  • :log_formatter (Aws::Log::Formatter) — default: Aws::Log::Formatter.default

    The log formatter.

  • :log_level (Symbol) — default: :info

    The log level to send messages to the ‘:logger` at.

  • :logger (Logger)

    The Logger instance to send log messages to. If this option is not set, logging will be disabled.

  • :profile (String) — default: "default"

    Used when loading credentials from the shared credentials file at HOME/.aws/credentials. When not specified, ‘default’ is used.

  • :retry_base_delay (Float) — default: 0.3

    The base delay in seconds used by the default backoff function.

  • :retry_jitter (Symbol) — default: :none

    A delay randomiser function used by the default backoff function. Some predefined functions can be referenced by name - :none, :equal, :full, otherwise a Proc that takes and returns a number.

    @see www.awsarchitectureblog.com/2015/03/backoff.html

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

  • :retry_max_delay (Integer) — default: 0

    The maximum number of seconds to delay between retries (0 for no limit) used by the default backoff function.

  • :secret_access_key (String)
  • :session_token (String)
  • :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.

  • :validate_params (Boolean) — default: true

    When ‘true`, request parameters are validated before sending the request.



202
203
204
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 202

def initialize(*args)
  super
end

Class Attribute Details

.identifierObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



2614
2615
2616
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 2614

def identifier
  @identifier
end

Class Method Details

.errors_moduleObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



2617
2618
2619
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 2617

def errors_module
  Errors
end

Instance Method Details

#add_tags(params = {}) ⇒ 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*.

[1]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/add-remove-tags.html

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",
    },
  ],
})

Parameters:

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

    ({})

Options Hash (params):

  • :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:



267
268
269
270
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 267

def add_tags(params = {}, options = {})
  req = build_request(:add_tags, params)
  req.send_request(options)
end

#apply_security_groups_to_load_balancer(params = {}) ⇒ 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*.

[1]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-security-groups.html#elb-vpc-security-groups

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

Parameters:

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

    ({})

Options Hash (params):

  • :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:



329
330
331
332
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 329

def apply_security_groups_to_load_balancer(params = {}, options = {})
  req = build_request(:apply_security_groups_to_load_balancer, params)
  req.send_request(options)
end

#attach_load_balancer_to_subnets(params = {}) ⇒ 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*.

[1]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-manage-subnets.html

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

Parameters:

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

    ({})

Options Hash (params):

  • :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:



392
393
394
395
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 392

def attach_load_balancer_to_subnets(params = {}, options = {})
  req = build_request(:attach_load_balancer_to_subnets, params)
  req.send_request(options)
end

#build_request(operation_name, params = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

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


2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 2475

def build_request(operation_name, params = {})
  handlers = @handlers.for(operation_name)
  context = Seahorse::Client::RequestContext.new(
    operation_name: operation_name,
    operation: config.api.operation(operation_name),
    client: self,
    params: params,
    config: config)
  context[:gem_name] = 'aws-sdk-elasticloadbalancing'
  context[:gem_version] = '1.8.0'
  Seahorse::Client::Request.new(handlers, context)
end

#configure_health_check(params = {}) ⇒ 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*.

[1]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-healthchecks.html

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

Parameters:

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

    ({})

Options Hash (params):

  • :load_balancer_name (required, String)

    The name of the load balancer.

  • :health_check (required, Types::HealthCheck)

    The configuration information.

Returns:

See Also:



469
470
471
472
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 469

def configure_health_check(params = {}, options = {})
  req = build_request(:configure_health_check, params)
  req.send_request(options)
end

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*.

[1]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-sticky-sessions.html#enable-sticky-sessions-application

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
})

Parameters:

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

    ({})

Options Hash (params):

  • :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:



532
533
534
535
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 532

def create_app_cookie_stickiness_policy(params = {}, options = {})
  req = build_request(:create_app_cookie_stickiness_policy, params)
  req.send_request(options)
end

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*.

[1]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-sticky-sessions.html#enable-sticky-sessions-duration

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,
})

Parameters:

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

    ({})

Options Hash (params):

  • :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:



600
601
602
603
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 600

def create_lb_cookie_stickiness_policy(params = {}, options = {})
  req = build_request(:create_lb_cookie_stickiness_policy, params)
  req.send_request(options)
end

#create_load_balancer(params = {}) ⇒ 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*.

[1]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-limits.html

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

Parameters:

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

    ({})

Options Hash (params):

  • :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*.

    [1]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-listener-config.html

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

    [1]: docs.aws.amazon.com/elasticloadbalancing/latest/userguide/how-elastic-load-balancing-works.html#load-balancer-scheme

  • :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*.

    [1]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/add-remove-tags.html

Returns:

See Also:



868
869
870
871
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 868

def create_load_balancer(params = {}, options = {})
  req = build_request(:create_load_balancer, params)
  req.send_request(options)
end

#create_load_balancer_listeners(params = {}) ⇒ 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*.

[1]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-listener-config.html

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",
    },
  ],
})

Parameters:

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

    ({})

Options Hash (params):

  • :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:



946
947
948
949
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 946

def create_load_balancer_listeners(params = {}, options = {})
  req = build_request(:create_load_balancer_listeners, params)
  req.send_request(options)
end

#create_load_balancer_policy(params = {}) ⇒ 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",
    },
  ],
})

Parameters:

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

    ({})

Options Hash (params):

  • :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:



1042
1043
1044
1045
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 1042

def create_load_balancer_policy(params = {}, options = {})
  req = build_request(:create_load_balancer_policy, params)
  req.send_request(options)
end

#delete_load_balancer(params = {}) ⇒ 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
})

Parameters:

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

    ({})

Options Hash (params):

  • :load_balancer_name (required, String)

    The name of the load balancer.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



1082
1083
1084
1085
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 1082

def delete_load_balancer(params = {}, options = {})
  req = build_request(:delete_load_balancer, params)
  req.send_request(options)
end

#delete_load_balancer_listeners(params = {}) ⇒ 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
})

Parameters:

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

    ({})

Options Hash (params):

  • :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:



1120
1121
1122
1123
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 1120

def delete_load_balancer_listeners(params = {}, options = {})
  req = build_request(:delete_load_balancer_listeners, params)
  req.send_request(options)
end

#delete_load_balancer_policy(params = {}) ⇒ 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
})

Parameters:

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

    ({})

Options Hash (params):

  • :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:



1158
1159
1160
1161
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 1158

def delete_load_balancer_policy(params = {}, options = {})
  req = build_request(:delete_load_balancer_policy, params)
  req.send_request(options)
end

#deregister_instances_from_load_balancer(params = {}) ⇒ 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*.

[1]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-deregister-register-instances.html

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

Parameters:

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

    ({})

Options Hash (params):

  • :load_balancer_name (required, String)

    The name of the load balancer.

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

    The IDs of the instances.

Returns:

See Also:



1233
1234
1235
1236
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 1233

def deregister_instances_from_load_balancer(params = {}, options = {})
  req = build_request(:deregister_instances_from_load_balancer, params)
  req.send_request(options)
end

#describe_account_limits(params = {}) ⇒ 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*.

[1]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-limits.html

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

Parameters:

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

    ({})

Options Hash (params):

  • :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:



1278
1279
1280
1281
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 1278

def (params = {}, options = {})
  req = build_request(:describe_account_limits, params)
  req.send_request(options)
end

#describe_instance_health(params = {}) ⇒ 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

Parameters:

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

    ({})

Options Hash (params):

  • :load_balancer_name (required, String)

    The name of the load balancer.

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

    The IDs of the instances.

Returns:

See Also:



1350
1351
1352
1353
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 1350

def describe_instance_health(params = {}, options = {})
  req = build_request(:describe_instance_health, params)
  req.send_request(options)
end

#describe_load_balancer_attributes(params = {}) ⇒ 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 #=> Boolean
resp.load_balancer_attributes.access_log.enabled #=> Boolean
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 #=> Boolean
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

Parameters:

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

    ({})

Options Hash (params):

  • :load_balancer_name (required, String)

    The name of the load balancer.

Returns:

See Also:



1416
1417
1418
1419
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 1416

def describe_load_balancer_attributes(params = {}, options = {})
  req = build_request(:describe_load_balancer_attributes, params)
  req.send_request(options)
end

#describe_load_balancer_policies(params = {}) ⇒ 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>

Parameters:

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

    ({})

Options Hash (params):

  • :load_balancer_name (String)

    The name of the load balancer.

  • :policy_names (Array<String>)

    The names of the policies.

Returns:

See Also:



1489
1490
1491
1492
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 1489

def describe_load_balancer_policies(params = {}, options = {})
  req = build_request(:describe_load_balancer_policies, params)
  req.send_request(options)
end

#describe_load_balancer_policy_types(params = {}) ⇒ 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

Parameters:

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

    ({})

Options Hash (params):

  • :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:



1565
1566
1567
1568
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 1565

def describe_load_balancer_policy_types(params = {}, options = {})
  req = build_request(:describe_load_balancer_policy_types, params)
  req.send_request(options)
end

#describe_load_balancers(params = {}) ⇒ 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

Parameters:

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

    ({})

Options Hash (params):

  • :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:



1751
1752
1753
1754
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 1751

def describe_load_balancers(params = {}, options = {})
  req = build_request(:describe_load_balancers, params)
  req.send_request(options)
end

#describe_tags(params = {}) ⇒ 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

Parameters:

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

    ({})

Options Hash (params):

  • :load_balancer_names (required, Array<String>)

    The names of the load balancers.

Returns:

See Also:



1813
1814
1815
1816
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 1813

def describe_tags(params = {}, options = {})
  req = build_request(:describe_tags, params)
  req.send_request(options)
end

#detach_load_balancer_from_subnets(params = {}) ⇒ 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

Parameters:

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

    ({})

Options Hash (params):

  • :load_balancer_name (required, String)

    The name of the load balancer.

  • :subnets (required, Array<String>)

    The IDs of the subnets.

Returns:

See Also:



1871
1872
1873
1874
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 1871

def detach_load_balancer_from_subnets(params = {}, options = {})
  req = build_request(:detach_load_balancer_from_subnets, params)
  req.send_request(options)
end

#disable_availability_zones_for_load_balancer(params = {}) ⇒ 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*.

[1]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-disable-az.html

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

Parameters:

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

    ({})

Options Hash (params):

  • :load_balancer_name (required, String)

    The name of the load balancer.

  • :availability_zones (required, Array<String>)

    The Availability Zones.

Returns:

See Also:



1941
1942
1943
1944
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 1941

def disable_availability_zones_for_load_balancer(params = {}, options = {})
  req = build_request(:disable_availability_zones_for_load_balancer, params)
  req.send_request(options)
end

#enable_availability_zones_for_load_balancer(params = {}) ⇒ 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*.

[1]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-disable-az.html

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

Parameters:

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

    ({})

Options Hash (params):

  • :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:



2008
2009
2010
2011
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 2008

def enable_availability_zones_for_load_balancer(params = {}, options = {})
  req = build_request(:enable_availability_zones_for_load_balancer, params)
  req.send_request(options)
end

#modify_load_balancer_attributes(params = {}) ⇒ 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*:

  • Cross-Zone Load Balancing][1
  • Connection Draining][2
  • Access Logs][3
  • Idle Connection Timeout][4

[1]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-disable-crosszone-lb.html [2]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/config-conn-drain.html [3]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/access-log-collection.html [4]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/config-idle-timeout.html

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 #=> Boolean
resp.load_balancer_attributes.access_log.enabled #=> Boolean
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 #=> Boolean
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

Parameters:

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

    ({})

Options Hash (params):

  • :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:



2148
2149
2150
2151
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 2148

def modify_load_balancer_attributes(params = {}, options = {})
  req = build_request(:modify_load_balancer_attributes, params)
  req.send_request(options)
end

#register_instances_with_load_balancer(params = {}) ⇒ 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*.

[1]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-deregister-register-instances.html

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

Parameters:

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

    ({})

Options Hash (params):

  • :load_balancer_name (required, String)

    The name of the load balancer.

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

    The IDs of the instances.

Returns:

See Also:



2242
2243
2244
2245
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 2242

def register_instances_with_load_balancer(params = {}, options = {})
  req = build_request(:register_instances_with_load_balancer, params)
  req.send_request(options)
end

#remove_tags(params = {}) ⇒ 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",
    },
  ],
})

Parameters:

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

    ({})

Options Hash (params):

  • :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:



2289
2290
2291
2292
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 2289

def remove_tags(params = {}, options = {})
  req = build_request(:remove_tags, params)
  req.send_request(options)
end

#set_load_balancer_listener_ssl_certificate(params = {}) ⇒ 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*.

[1]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-update-ssl-cert.html

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
})

Parameters:

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

    ({})

Options Hash (params):

  • :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:



2340
2341
2342
2343
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 2340

def set_load_balancer_listener_ssl_certificate(params = {}, options = {})
  req = build_request(:set_load_balancer_listener_ssl_certificate, params)
  req.send_request(options)
end

#set_load_balancer_policies_for_backend_server(params = {}) ⇒ 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][2

in the *Classic Load Balancers

Guide*.

[1]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-create-https-ssl-load-balancer.html#configure_backendauth_clt [2]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-proxy-protocol.html

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
})

Parameters:

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

    ({})

Options Hash (params):

  • :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:



2406
2407
2408
2409
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 2406

def set_load_balancer_policies_for_backend_server(params = {}, options = {})
  req = build_request(:set_load_balancer_policies_for_backend_server, params)
  req.send_request(options)
end

#set_load_balancer_policies_of_listener(params = {}) ⇒ 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*.

[1]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/ssl-config-update.html [2]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-sticky-sessions.html#enable-sticky-sessions-duration [3]: docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-sticky-sessions.html#enable-sticky-sessions-application

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
})

Parameters:

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

    ({})

Options Hash (params):

  • :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:



2466
2467
2468
2469
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 2466

def set_load_balancer_policies_of_listener(params = {}, options = {})
  req = build_request(:set_load_balancer_policies_of_listener, params)
  req.send_request(options)
end

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

Polls an API operation until a resource enters a desired state.

## Basic Usage

A waiter will call an API operation until:

  • It is successful

  • It enters a terminal state

  • It makes the maximum number of attempts

In between attempts, the waiter will sleep.

# 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 can pass configuration as the final arguments hash.

# poll for ~25 seconds
client.wait_until(waiter_name, params, {
  max_attempts: 5,
  delay: 5,
})

## 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(waiter_name, params, {

  # disable max attempts
  max_attempts: nil,

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

## Handling Errors

When a waiter is unsuccessful, it will raise an error. All of the failure errors extend from Waiters::Errors::WaiterFailed.

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

## Valid Waiters

The following table lists the valid waiter names, the operations they call, and the default ‘:delay` and `:max_attempts` values.

| waiter_name | params | :delay | :max_attempts | | ———————– | ————————— | ——– | ————- | | any_instance_in_service | #describe_instance_health | 15 | 40 | | instance_deregistered | #describe_instance_health | 15 | 40 | | instance_in_service | #describe_instance_health | 15 | 40 |

Parameters:

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

    ({})

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

    ({})

Options Hash (options):

  • :max_attempts (Integer)
  • :delay (Integer)
  • :before_attempt (Proc)
  • :before_wait (Proc)

Yields:

  • (w.waiter)

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.



2578
2579
2580
2581
2582
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 2578

def wait_until(waiter_name, params = {}, options = {})
  w = waiter(waiter_name, options)
  yield(w.waiter) if block_given? # deprecated
  w.wait(params)
end

#waiter_namesObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Deprecated.


2586
2587
2588
# File 'lib/aws-sdk-elasticloadbalancing/client.rb', line 2586

def waiter_names
  waiters.keys
end