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

Class: Aws::ElasticLoadBalancingV2::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.

elasticloadbalancingv2 = Aws::ElasticLoadBalancingV2::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::ElasticLoadBalancingV2::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::ElasticLoadBalancingV2::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_listener_certificates(options = {}) ⇒ Types::AddListenerCertificatesOutput

Adds the specified SSL server certificate to the certificate list for the specified HTTPS or TLS listener.

If the certificate in already in the certificate list, the call is successful but the certificate is not added again.

For more information, see HTTPS listeners in the Application Load Balancers Guide or TLS listeners in the Network Load Balancers Guide.

Examples:

Request syntax with placeholder values


resp = client.add_listener_certificates({
  listener_arn: "ListenerArn", # required
  certificates: [ # required
    {
      certificate_arn: "CertificateArn",
      is_default: false,
    },
  ],
})

Response structure


resp.certificates #=> Array
resp.certificates[0].certificate_arn #=> String
resp.certificates[0].is_default #=> true/false

Options Hash (options):

  • :listener_arn (required, String)

    The Amazon Resource Name (ARN) of the listener.

  • :certificates (required, Array<Types::Certificate>)

    The certificate to add. You can specify one certificate per call. Set CertificateArn to the certificate ARN but do not set IsDefault.

Returns:

See Also:

#add_tags(options = {}) ⇒ Struct

Adds the specified tags to the specified Elastic Load Balancing resource. You can tag your Application Load Balancers, Network Load Balancers, Gateway Load Balancers, target groups, listeners, and rules.

Each tag consists of a key and an optional value. If a resource already has a tag with the same key, AddTags updates its value.

Examples:

Example: To add tags to a load balancer


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

resp = client.add_tags({
  resource_arns: [
    "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
  ], 
  tags: [
    {
      key: "project", 
      value: "lima", 
    }, 
    {
      key: "department", 
      value: "digital-media", 
    }, 
  ], 
})

Request syntax with placeholder values


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

Options Hash (options):

  • :resource_arns (required, Array<String>)

    The Amazon Resource Name (ARN) of the resource.

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

    The tags.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#create_listener(options = {}) ⇒ Types::CreateListenerOutput

Creates a listener for the specified Application Load Balancer, Network Load Balancer. or Gateway Load Balancer.

For more information, see the following:

This operation is idempotent, which means that it completes at most one time. If you attempt to create multiple listeners with the same settings, each call succeeds.

Examples:

Example: To create an HTTP listener


# This example creates an HTTP listener for the specified load balancer that forwards requests to the specified target group.

resp = client.create_listener({
  default_actions: [
    {
      target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
      type: "forward", 
    }, 
  ], 
  load_balancer_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
  port: 80, 
  protocol: "HTTP", 
})

# resp.to_h outputs the following:
{
  listeners: [
    {
      default_actions: [
        {
          target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
          type: "forward", 
        }, 
      ], 
      listener_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2", 
      load_balancer_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
      port: 80, 
      protocol: "HTTP", 
    }, 
  ], 
}

Example: To create an HTTPS listener


# This example creates an HTTPS listener for the specified load balancer that forwards requests to the specified target group. Note that you must specify an SSL certificate for an HTTPS listener. You can create and manage certificates using AWS Certificate Manager (ACM). Alternatively, you can create a certificate using SSL/TLS tools, get the certificate signed by a certificate authority (CA), and upload the certificate to AWS Identity and Access Management (IAM).

resp = client.create_listener({
  certificates: [
    {
      certificate_arn: "arn:aws:iam::123456789012:server-certificate/my-server-cert", 
    }, 
  ], 
  default_actions: [
    {
      target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
      type: "forward", 
    }, 
  ], 
  load_balancer_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
  port: 443, 
  protocol: "HTTPS", 
  ssl_policy: "ELBSecurityPolicy-2015-05", 
})

# resp.to_h outputs the following:
{
  listeners: [
    {
      certificates: [
        {
          certificate_arn: "arn:aws:iam::123456789012:server-certificate/my-server-cert", 
        }, 
      ], 
      default_actions: [
        {
          target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
          type: "forward", 
        }, 
      ], 
      listener_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2", 
      load_balancer_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
      port: 443, 
      protocol: "HTTPS", 
      ssl_policy: "ELBSecurityPolicy-2015-05", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.create_listener({
  load_balancer_arn: "LoadBalancerArn", # required
  protocol: "HTTP", # accepts HTTP, HTTPS, TCP, TLS, UDP, TCP_UDP, GENEVE
  port: 1,
  ssl_policy: "SslPolicyName",
  certificates: [
    {
      certificate_arn: "CertificateArn",
      is_default: false,
    },
  ],
  default_actions: [ # required
    {
      type: "forward", # required, accepts forward, authenticate-oidc, authenticate-cognito, redirect, fixed-response
      target_group_arn: "TargetGroupArn",
      authenticate_oidc_config: {
        issuer: "AuthenticateOidcActionIssuer", # required
        authorization_endpoint: "AuthenticateOidcActionAuthorizationEndpoint", # required
        token_endpoint: "AuthenticateOidcActionTokenEndpoint", # required
        user_info_endpoint: "AuthenticateOidcActionUserInfoEndpoint", # required
        client_id: "AuthenticateOidcActionClientId", # required
        client_secret: "AuthenticateOidcActionClientSecret",
        session_cookie_name: "AuthenticateOidcActionSessionCookieName",
        scope: "AuthenticateOidcActionScope",
        session_timeout: 1,
        authentication_request_extra_params: {
          "AuthenticateOidcActionAuthenticationRequestParamName" => "AuthenticateOidcActionAuthenticationRequestParamValue",
        },
        on_unauthenticated_request: "deny", # accepts deny, allow, authenticate
        use_existing_client_secret: false,
      },
      authenticate_cognito_config: {
        user_pool_arn: "AuthenticateCognitoActionUserPoolArn", # required
        user_pool_client_id: "AuthenticateCognitoActionUserPoolClientId", # required
        user_pool_domain: "AuthenticateCognitoActionUserPoolDomain", # required
        session_cookie_name: "AuthenticateCognitoActionSessionCookieName",
        scope: "AuthenticateCognitoActionScope",
        session_timeout: 1,
        authentication_request_extra_params: {
          "AuthenticateCognitoActionAuthenticationRequestParamName" => "AuthenticateCognitoActionAuthenticationRequestParamValue",
        },
        on_unauthenticated_request: "deny", # accepts deny, allow, authenticate
      },
      order: 1,
      redirect_config: {
        protocol: "RedirectActionProtocol",
        port: "RedirectActionPort",
        host: "RedirectActionHost",
        path: "RedirectActionPath",
        query: "RedirectActionQuery",
        status_code: "HTTP_301", # required, accepts HTTP_301, HTTP_302
      },
      fixed_response_config: {
        message_body: "FixedResponseActionMessage",
        status_code: "FixedResponseActionStatusCode", # required
        content_type: "FixedResponseActionContentType",
      },
      forward_config: {
        target_groups: [
          {
            target_group_arn: "TargetGroupArn",
            weight: 1,
          },
        ],
        target_group_stickiness_config: {
          enabled: false,
          duration_seconds: 1,
        },
      },
    },
  ],
  alpn_policy: ["AlpnPolicyValue"],
  tags: [
    {
      key: "TagKey", # required
      value: "TagValue",
    },
  ],
})

Response structure


resp.listeners #=> Array
resp.listeners[0].listener_arn #=> String
resp.listeners[0].load_balancer_arn #=> String
resp.listeners[0].port #=> Integer
resp.listeners[0].protocol #=> String, one of "HTTP", "HTTPS", "TCP", "TLS", "UDP", "TCP_UDP", "GENEVE"
resp.listeners[0].certificates #=> Array
resp.listeners[0].certificates[0].certificate_arn #=> String
resp.listeners[0].certificates[0].is_default #=> true/false
resp.listeners[0].ssl_policy #=> String
resp.listeners[0].default_actions #=> Array
resp.listeners[0].default_actions[0].type #=> String, one of "forward", "authenticate-oidc", "authenticate-cognito", "redirect", "fixed-response"
resp.listeners[0].default_actions[0].target_group_arn #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.issuer #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.authorization_endpoint #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.token_endpoint #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config. #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.client_id #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.client_secret #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.session_cookie_name #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.scope #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.session_timeout #=> Integer
resp.listeners[0].default_actions[0].authenticate_oidc_config.authentication_request_extra_params #=> Hash
resp.listeners[0].default_actions[0].authenticate_oidc_config.authentication_request_extra_params["AuthenticateOidcActionAuthenticationRequestParamName"] #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.on_unauthenticated_request #=> String, one of "deny", "allow", "authenticate"
resp.listeners[0].default_actions[0].authenticate_oidc_config.use_existing_client_secret #=> true/false
resp.listeners[0].default_actions[0].authenticate_cognito_config.user_pool_arn #=> String
resp.listeners[0].default_actions[0].authenticate_cognito_config.user_pool_client_id #=> String
resp.listeners[0].default_actions[0].authenticate_cognito_config.user_pool_domain #=> String
resp.listeners[0].default_actions[0].authenticate_cognito_config.session_cookie_name #=> String
resp.listeners[0].default_actions[0].authenticate_cognito_config.scope #=> String
resp.listeners[0].default_actions[0].authenticate_cognito_config.session_timeout #=> Integer
resp.listeners[0].default_actions[0].authenticate_cognito_config.authentication_request_extra_params #=> Hash
resp.listeners[0].default_actions[0].authenticate_cognito_config.authentication_request_extra_params["AuthenticateCognitoActionAuthenticationRequestParamName"] #=> String
resp.listeners[0].default_actions[0].authenticate_cognito_config.on_unauthenticated_request #=> String, one of "deny", "allow", "authenticate"
resp.listeners[0].default_actions[0].order #=> Integer
resp.listeners[0].default_actions[0].redirect_config.protocol #=> String
resp.listeners[0].default_actions[0].redirect_config.port #=> String
resp.listeners[0].default_actions[0].redirect_config.host #=> String
resp.listeners[0].default_actions[0].redirect_config.path #=> String
resp.listeners[0].default_actions[0].redirect_config.query #=> String
resp.listeners[0].default_actions[0].redirect_config.status_code #=> String, one of "HTTP_301", "HTTP_302"
resp.listeners[0].default_actions[0].fixed_response_config.message_body #=> String
resp.listeners[0].default_actions[0].fixed_response_config.status_code #=> String
resp.listeners[0].default_actions[0].fixed_response_config.content_type #=> String
resp.listeners[0].default_actions[0].forward_config.target_groups #=> Array
resp.listeners[0].default_actions[0].forward_config.target_groups[0].target_group_arn #=> String
resp.listeners[0].default_actions[0].forward_config.target_groups[0].weight #=> Integer
resp.listeners[0].default_actions[0].forward_config.target_group_stickiness_config.enabled #=> true/false
resp.listeners[0].default_actions[0].forward_config.target_group_stickiness_config.duration_seconds #=> Integer
resp.listeners[0].alpn_policy #=> Array
resp.listeners[0].alpn_policy[0] #=> String

Options Hash (options):

  • :load_balancer_arn (required, String)

    The Amazon Resource Name (ARN) of the load balancer.

  • :protocol (String)

    The protocol for connections from clients to the load balancer. For Application Load Balancers, the supported protocols are HTTP and HTTPS. For Network Load Balancers, the supported protocols are TCP, TLS, UDP, and TCP_UDP. You can’t specify the UDP or TCP_UDP protocol if dual-stack mode is enabled. You cannot specify a protocol for a Gateway Load Balancer.

  • :port (Integer)

    The port on which the load balancer is listening. You cannot specify a port for a Gateway Load Balancer.

  • :ssl_policy (String)

    [HTTPS and TLS listeners] The security policy that defines which protocols and ciphers are supported.

    For more information, see Security policies in the Application Load Balancers Guide and Security policies in the Network Load Balancers Guide.

  • :certificates (Array<Types::Certificate>)

    [HTTPS and TLS listeners] The default certificate for the listener. You must provide exactly one certificate. Set CertificateArn to the certificate ARN but do not set IsDefault.

  • :default_actions (required, Array<Types::Action>)

    The actions for the default rule.

  • :alpn_policy (Array<String>)

    [TLS listeners] The name of the Application-Layer Protocol Negotiation (ALPN) policy. You can specify one policy name. The following are the possible values:

    • HTTP1Only

    • HTTP2Only

    • HTTP2Optional

    • HTTP2Preferred

    • None

    For more information, see ALPN policies in the Network Load Balancers Guide.

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

    The tags to assign to the listener.

Returns:

See Also:

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

Creates an Application Load Balancer, Network Load Balancer, or Gateway Load Balancer.

For more information, see the following:

This operation is idempotent, which means that it completes at most one time. If you attempt to create multiple load balancers with the same settings, each call succeeds.

Examples:

Example: To create an Internet-facing load balancer


# This example creates an Internet-facing load balancer and enables the Availability Zones for the specified subnets.

resp = client.create_load_balancer({
  name: "my-load-balancer", 
  subnets: [
    "subnet-b7d581c0", 
    "subnet-8360a9e7", 
  ], 
})

# resp.to_h outputs the following:
{
  load_balancers: [
    {
      availability_zones: [
        {
          subnet_id: "subnet-8360a9e7", 
          zone_name: "us-west-2a", 
        }, 
        {
          subnet_id: "subnet-b7d581c0", 
          zone_name: "us-west-2b", 
        }, 
      ], 
      canonical_hosted_zone_id: "Z2P70J7EXAMPLE", 
      created_time: Time.parse("2016-03-25T21:26:12.920Z"), 
      dns_name: "my-load-balancer-424835706.us-west-2.elb.amazonaws.com", 
      load_balancer_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
      load_balancer_name: "my-load-balancer", 
      scheme: "internet-facing", 
      security_groups: [
        "sg-5943793c", 
      ], 
      state: {
        code: "provisioning", 
      }, 
      type: "application", 
      vpc_id: "vpc-3ac0fb5f", 
    }, 
  ], 
}

Example: To create an internal load balancer


# This example creates an internal load balancer and enables the Availability Zones for the specified subnets.

resp = client.create_load_balancer({
  name: "my-internal-load-balancer", 
  scheme: "internal", 
  security_groups: [
  ], 
  subnets: [
    "subnet-b7d581c0", 
    "subnet-8360a9e7", 
  ], 
})

# resp.to_h outputs the following:
{
  load_balancers: [
    {
      availability_zones: [
        {
          subnet_id: "subnet-8360a9e7", 
          zone_name: "us-west-2a", 
        }, 
        {
          subnet_id: "subnet-b7d581c0", 
          zone_name: "us-west-2b", 
        }, 
      ], 
      canonical_hosted_zone_id: "Z2P70J7EXAMPLE", 
      created_time: Time.parse("2016-03-25T21:29:48.850Z"), 
      dns_name: "internal-my-internal-load-balancer-1529930873.us-west-2.elb.amazonaws.com", 
      load_balancer_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-internal-load-balancer/5b49b8d4303115c2", 
      load_balancer_name: "my-internal-load-balancer", 
      scheme: "internal", 
      security_groups: [
        "sg-5943793c", 
      ], 
      state: {
        code: "provisioning", 
      }, 
      type: "application", 
      vpc_id: "vpc-3ac0fb5f", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.create_load_balancer({
  name: "LoadBalancerName", # required
  subnets: ["SubnetId"],
  subnet_mappings: [
    {
      subnet_id: "SubnetId",
      allocation_id: "AllocationId",
      private_i_pv_4_address: "PrivateIPv4Address",
      i_pv_6_address: "IPv6Address",
    },
  ],
  security_groups: ["SecurityGroupId"],
  scheme: "internet-facing", # accepts internet-facing, internal
  tags: [
    {
      key: "TagKey", # required
      value: "TagValue",
    },
  ],
  type: "application", # accepts application, network, gateway
  ip_address_type: "ipv4", # accepts ipv4, dualstack
  customer_owned_ipv_4_pool: "CustomerOwnedIpv4Pool",
})

Response structure


resp.load_balancers #=> Array
resp.load_balancers[0].load_balancer_arn #=> String
resp.load_balancers[0].dns_name #=> String
resp.load_balancers[0].canonical_hosted_zone_id #=> String
resp.load_balancers[0].created_time #=> Time
resp.load_balancers[0].load_balancer_name #=> String
resp.load_balancers[0].scheme #=> String, one of "internet-facing", "internal"
resp.load_balancers[0].vpc_id #=> String
resp.load_balancers[0].state.code #=> String, one of "active", "provisioning", "active_impaired", "failed"
resp.load_balancers[0].state.reason #=> String
resp.load_balancers[0].type #=> String, one of "application", "network", "gateway"
resp.load_balancers[0].availability_zones #=> Array
resp.load_balancers[0].availability_zones[0].zone_name #=> String
resp.load_balancers[0].availability_zones[0].subnet_id #=> String
resp.load_balancers[0].availability_zones[0].outpost_id #=> String
resp.load_balancers[0].availability_zones[0].load_balancer_addresses #=> Array
resp.load_balancers[0].availability_zones[0].load_balancer_addresses[0].ip_address #=> String
resp.load_balancers[0].availability_zones[0].load_balancer_addresses[0].allocation_id #=> String
resp.load_balancers[0].availability_zones[0].load_balancer_addresses[0].private_i_pv_4_address #=> String
resp.load_balancers[0].availability_zones[0].load_balancer_addresses[0].i_pv_6_address #=> String
resp.load_balancers[0].security_groups #=> Array
resp.load_balancers[0].security_groups[0] #=> String
resp.load_balancers[0].ip_address_type #=> String, one of "ipv4", "dualstack"
resp.load_balancers[0].customer_owned_ipv_4_pool #=> String

Options Hash (options):

  • :name (required, String)

    The name of the load balancer.

    This name must be unique per region per account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, must not begin or end with a hyphen, and must not begin with \"internal-\".

  • :subnets (Array<String>)

    The IDs of the public subnets. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings.

    [Application Load Balancers] You must specify subnets from at least two Availability Zones.

    [Application Load Balancers on Outposts] You must specify one Outpost subnet.

    [Application Load Balancers on Local Zones] You can specify subnets from one or more Local Zones.

    [Network Load Balancers] You can specify subnets from one or more Availability Zones.

    [Gateway Load Balancers] You can specify subnets from one or more Availability Zones.

  • :subnet_mappings (Array<Types::SubnetMapping>)

    The IDs of the public subnets. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings.

    [Application Load Balancers] You must specify subnets from at least two Availability Zones. You cannot specify Elastic IP addresses for your subnets.

    [Application Load Balancers on Outposts] You must specify one Outpost subnet.

    [Application Load Balancers on Local Zones] You can specify subnets from one or more Local Zones.

    [Network Load Balancers] You can specify subnets from one or more Availability Zones. You can specify one Elastic IP address per subnet if you need static IP addresses for your internet-facing load balancer. For internal load balancers, you can specify one private IP address per subnet from the IPv4 range of the subnet. For internet-facing load balancer, you can specify one IPv6 address per subnet.

    [Gateway Load Balancers] You can specify subnets from one or more Availability Zones. You cannot specify Elastic IP addresses for your subnets.

  • :security_groups (Array<String>)

    [Application Load Balancers] The IDs of the security groups for the load balancer.

  • :scheme (String)

    The nodes of an Internet-facing load balancer have public IP addresses. The DNS name of an Internet-facing load balancer is publicly resolvable to the public IP addresses of the nodes. Therefore, Internet-facing load balancers can route requests from clients over the internet.

    The nodes of an internal load balancer have only private IP addresses. The DNS name of an internal load balancer is publicly resolvable to the private IP addresses of the nodes. Therefore, internal load balancers can route requests only from clients with access to the VPC for the load balancer.

    The default is an Internet-facing load balancer.

    You cannot specify a scheme for a Gateway Load Balancer.

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

    The tags to assign to the load balancer.

  • :type (String)

    The type of load balancer. The default is application.

  • :ip_address_type (String)

    The type of IP addresses used by the subnets for your load balancer. The possible values are ipv4 (for IPv4 addresses) and dualstack (for IPv4 and IPv6 addresses). Internal load balancers must use ipv4.

  • :customer_owned_ipv_4_pool (String)

    [Application Load Balancers on Outposts] The ID of the customer-owned address pool (CoIP pool).

Returns:

See Also:

#create_rule(options = {}) ⇒ Types::CreateRuleOutput

Creates a rule for the specified listener. The listener must be associated with an Application Load Balancer.

Each rule consists of a priority, one or more actions, and one or more conditions. Rules are evaluated in priority order, from the lowest value to the highest value. When the conditions for a rule are met, its actions are performed. If the conditions for no rules are met, the actions for the default rule are performed. For more information, see Listener rules in the Application Load Balancers Guide.

Examples:

Example: To create a rule


# This example creates a rule that forwards requests to the specified target group if the URL contains the specified pattern (for example, /img/*).

resp = client.create_rule({
  actions: [
    {
      target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
      type: "forward", 
    }, 
  ], 
  conditions: [
    {
      field: "path-pattern", 
      values: [
        "/img/*", 
      ], 
    }, 
  ], 
  listener_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2", 
  priority: 10, 
})

# resp.to_h outputs the following:
{
  rules: [
    {
      actions: [
        {
          target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
          type: "forward", 
        }, 
      ], 
      conditions: [
        {
          field: "path-pattern", 
          values: [
            "/img/*", 
          ], 
        }, 
      ], 
      is_default: false, 
      priority: "10", 
      rule_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/9683b2d02a6cabee", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.create_rule({
  listener_arn: "ListenerArn", # required
  conditions: [ # required
    {
      field: "ConditionFieldName",
      values: ["StringValue"],
      host_header_config: {
        values: ["StringValue"],
      },
      path_pattern_config: {
        values: ["StringValue"],
      },
      http_header_config: {
        http_header_name: "HttpHeaderConditionName",
        values: ["StringValue"],
      },
      query_string_config: {
        values: [
          {
            key: "StringValue",
            value: "StringValue",
          },
        ],
      },
      http_request_method_config: {
        values: ["StringValue"],
      },
      source_ip_config: {
        values: ["StringValue"],
      },
    },
  ],
  priority: 1, # required
  actions: [ # required
    {
      type: "forward", # required, accepts forward, authenticate-oidc, authenticate-cognito, redirect, fixed-response
      target_group_arn: "TargetGroupArn",
      authenticate_oidc_config: {
        issuer: "AuthenticateOidcActionIssuer", # required
        authorization_endpoint: "AuthenticateOidcActionAuthorizationEndpoint", # required
        token_endpoint: "AuthenticateOidcActionTokenEndpoint", # required
        user_info_endpoint: "AuthenticateOidcActionUserInfoEndpoint", # required
        client_id: "AuthenticateOidcActionClientId", # required
        client_secret: "AuthenticateOidcActionClientSecret",
        session_cookie_name: "AuthenticateOidcActionSessionCookieName",
        scope: "AuthenticateOidcActionScope",
        session_timeout: 1,
        authentication_request_extra_params: {
          "AuthenticateOidcActionAuthenticationRequestParamName" => "AuthenticateOidcActionAuthenticationRequestParamValue",
        },
        on_unauthenticated_request: "deny", # accepts deny, allow, authenticate
        use_existing_client_secret: false,
      },
      authenticate_cognito_config: {
        user_pool_arn: "AuthenticateCognitoActionUserPoolArn", # required
        user_pool_client_id: "AuthenticateCognitoActionUserPoolClientId", # required
        user_pool_domain: "AuthenticateCognitoActionUserPoolDomain", # required
        session_cookie_name: "AuthenticateCognitoActionSessionCookieName",
        scope: "AuthenticateCognitoActionScope",
        session_timeout: 1,
        authentication_request_extra_params: {
          "AuthenticateCognitoActionAuthenticationRequestParamName" => "AuthenticateCognitoActionAuthenticationRequestParamValue",
        },
        on_unauthenticated_request: "deny", # accepts deny, allow, authenticate
      },
      order: 1,
      redirect_config: {
        protocol: "RedirectActionProtocol",
        port: "RedirectActionPort",
        host: "RedirectActionHost",
        path: "RedirectActionPath",
        query: "RedirectActionQuery",
        status_code: "HTTP_301", # required, accepts HTTP_301, HTTP_302
      },
      fixed_response_config: {
        message_body: "FixedResponseActionMessage",
        status_code: "FixedResponseActionStatusCode", # required
        content_type: "FixedResponseActionContentType",
      },
      forward_config: {
        target_groups: [
          {
            target_group_arn: "TargetGroupArn",
            weight: 1,
          },
        ],
        target_group_stickiness_config: {
          enabled: false,
          duration_seconds: 1,
        },
      },
    },
  ],
  tags: [
    {
      key: "TagKey", # required
      value: "TagValue",
    },
  ],
})

Response structure


resp.rules #=> Array
resp.rules[0].rule_arn #=> String
resp.rules[0].priority #=> String
resp.rules[0].conditions #=> Array
resp.rules[0].conditions[0].field #=> String
resp.rules[0].conditions[0].values #=> Array
resp.rules[0].conditions[0].values[0] #=> String
resp.rules[0].conditions[0].host_header_config.values #=> Array
resp.rules[0].conditions[0].host_header_config.values[0] #=> String
resp.rules[0].conditions[0].path_pattern_config.values #=> Array
resp.rules[0].conditions[0].path_pattern_config.values[0] #=> String
resp.rules[0].conditions[0].http_header_config.http_header_name #=> String
resp.rules[0].conditions[0].http_header_config.values #=> Array
resp.rules[0].conditions[0].http_header_config.values[0] #=> String
resp.rules[0].conditions[0].query_string_config.values #=> Array
resp.rules[0].conditions[0].query_string_config.values[0].key #=> String
resp.rules[0].conditions[0].query_string_config.values[0].value #=> String
resp.rules[0].conditions[0].http_request_method_config.values #=> Array
resp.rules[0].conditions[0].http_request_method_config.values[0] #=> String
resp.rules[0].conditions[0].source_ip_config.values #=> Array
resp.rules[0].conditions[0].source_ip_config.values[0] #=> String
resp.rules[0].actions #=> Array
resp.rules[0].actions[0].type #=> String, one of "forward", "authenticate-oidc", "authenticate-cognito", "redirect", "fixed-response"
resp.rules[0].actions[0].target_group_arn #=> String
resp.rules[0].actions[0].authenticate_oidc_config.issuer #=> String
resp.rules[0].actions[0].authenticate_oidc_config.authorization_endpoint #=> String
resp.rules[0].actions[0].authenticate_oidc_config.token_endpoint #=> String
resp.rules[0].actions[0].authenticate_oidc_config. #=> String
resp.rules[0].actions[0].authenticate_oidc_config.client_id #=> String
resp.rules[0].actions[0].authenticate_oidc_config.client_secret #=> String
resp.rules[0].actions[0].authenticate_oidc_config.session_cookie_name #=> String
resp.rules[0].actions[0].authenticate_oidc_config.scope #=> String
resp.rules[0].actions[0].authenticate_oidc_config.session_timeout #=> Integer
resp.rules[0].actions[0].authenticate_oidc_config.authentication_request_extra_params #=> Hash
resp.rules[0].actions[0].authenticate_oidc_config.authentication_request_extra_params["AuthenticateOidcActionAuthenticationRequestParamName"] #=> String
resp.rules[0].actions[0].authenticate_oidc_config.on_unauthenticated_request #=> String, one of "deny", "allow", "authenticate"
resp.rules[0].actions[0].authenticate_oidc_config.use_existing_client_secret #=> true/false
resp.rules[0].actions[0].authenticate_cognito_config.user_pool_arn #=> String
resp.rules[0].actions[0].authenticate_cognito_config.user_pool_client_id #=> String
resp.rules[0].actions[0].authenticate_cognito_config.user_pool_domain #=> String
resp.rules[0].actions[0].authenticate_cognito_config.session_cookie_name #=> String
resp.rules[0].actions[0].authenticate_cognito_config.scope #=> String
resp.rules[0].actions[0].authenticate_cognito_config.session_timeout #=> Integer
resp.rules[0].actions[0].authenticate_cognito_config.authentication_request_extra_params #=> Hash
resp.rules[0].actions[0].authenticate_cognito_config.authentication_request_extra_params["AuthenticateCognitoActionAuthenticationRequestParamName"] #=> String
resp.rules[0].actions[0].authenticate_cognito_config.on_unauthenticated_request #=> String, one of "deny", "allow", "authenticate"
resp.rules[0].actions[0].order #=> Integer
resp.rules[0].actions[0].redirect_config.protocol #=> String
resp.rules[0].actions[0].redirect_config.port #=> String
resp.rules[0].actions[0].redirect_config.host #=> String
resp.rules[0].actions[0].redirect_config.path #=> String
resp.rules[0].actions[0].redirect_config.query #=> String
resp.rules[0].actions[0].redirect_config.status_code #=> String, one of "HTTP_301", "HTTP_302"
resp.rules[0].actions[0].fixed_response_config.message_body #=> String
resp.rules[0].actions[0].fixed_response_config.status_code #=> String
resp.rules[0].actions[0].fixed_response_config.content_type #=> String
resp.rules[0].actions[0].forward_config.target_groups #=> Array
resp.rules[0].actions[0].forward_config.target_groups[0].target_group_arn #=> String
resp.rules[0].actions[0].forward_config.target_groups[0].weight #=> Integer
resp.rules[0].actions[0].forward_config.target_group_stickiness_config.enabled #=> true/false
resp.rules[0].actions[0].forward_config.target_group_stickiness_config.duration_seconds #=> Integer
resp.rules[0].is_default #=> true/false

Options Hash (options):

  • :listener_arn (required, String)

    The Amazon Resource Name (ARN) of the listener.

  • :conditions (required, Array<Types::RuleCondition>)

    The conditions.

  • :priority (required, Integer)

    The rule priority. A listener can\'t have multiple rules with the same priority.

  • :actions (required, Array<Types::Action>)

    The actions.

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

    The tags to assign to the rule.

Returns:

See Also:

#create_target_group(options = {}) ⇒ Types::CreateTargetGroupOutput

Creates a target group.

For more information, see the following:

This operation is idempotent, which means that it completes at most one time. If you attempt to create multiple target groups with the same settings, each call succeeds.

Examples:

Example: To create a target group


# This example creates a target group that you can use to route traffic to targets using HTTP on port 80. This target group uses the default health check configuration.

resp = client.create_target_group({
  name: "my-targets", 
  port: 80, 
  protocol: "HTTP", 
  vpc_id: "vpc-3ac0fb5f", 
})

# resp.to_h outputs the following:
{
  target_groups: [
    {
      health_check_interval_seconds: 30, 
      health_check_path: "/", 
      health_check_port: "traffic-port", 
      health_check_protocol: "HTTP", 
      health_check_timeout_seconds: 5, 
      healthy_threshold_count: 5, 
      matcher: {
        http_code: "200", 
      }, 
      port: 80, 
      protocol: "HTTP", 
      target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
      target_group_name: "my-targets", 
      unhealthy_threshold_count: 2, 
      vpc_id: "vpc-3ac0fb5f", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.create_target_group({
  name: "TargetGroupName", # required
  protocol: "HTTP", # accepts HTTP, HTTPS, TCP, TLS, UDP, TCP_UDP, GENEVE
  protocol_version: "ProtocolVersion",
  port: 1,
  vpc_id: "VpcId",
  health_check_protocol: "HTTP", # accepts HTTP, HTTPS, TCP, TLS, UDP, TCP_UDP, GENEVE
  health_check_port: "HealthCheckPort",
  health_check_enabled: false,
  health_check_path: "Path",
  health_check_interval_seconds: 1,
  health_check_timeout_seconds: 1,
  healthy_threshold_count: 1,
  unhealthy_threshold_count: 1,
  matcher: {
    http_code: "HttpCode",
    grpc_code: "GrpcCode",
  },
  target_type: "instance", # accepts instance, ip, lambda
  tags: [
    {
      key: "TagKey", # required
      value: "TagValue",
    },
  ],
})

Response structure


resp.target_groups #=> Array
resp.target_groups[0].target_group_arn #=> String
resp.target_groups[0].target_group_name #=> String
resp.target_groups[0].protocol #=> String, one of "HTTP", "HTTPS", "TCP", "TLS", "UDP", "TCP_UDP", "GENEVE"
resp.target_groups[0].port #=> Integer
resp.target_groups[0].vpc_id #=> String
resp.target_groups[0].health_check_protocol #=> String, one of "HTTP", "HTTPS", "TCP", "TLS", "UDP", "TCP_UDP", "GENEVE"
resp.target_groups[0].health_check_port #=> String
resp.target_groups[0].health_check_enabled #=> true/false
resp.target_groups[0].health_check_interval_seconds #=> Integer
resp.target_groups[0].health_check_timeout_seconds #=> Integer
resp.target_groups[0].healthy_threshold_count #=> Integer
resp.target_groups[0].unhealthy_threshold_count #=> Integer
resp.target_groups[0].health_check_path #=> String
resp.target_groups[0].matcher.http_code #=> String
resp.target_groups[0].matcher.grpc_code #=> String
resp.target_groups[0].load_balancer_arns #=> Array
resp.target_groups[0].load_balancer_arns[0] #=> String
resp.target_groups[0].target_type #=> String, one of "instance", "ip", "lambda"
resp.target_groups[0].protocol_version #=> String

Options Hash (options):

  • :name (required, String)

    The name of the target group.

    This name must be unique per region per account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen.

  • :protocol (String)

    The protocol to use for routing traffic to the targets. For Application Load Balancers, the supported protocols are HTTP and HTTPS. For Network Load Balancers, the supported protocols are TCP, TLS, UDP, or TCP_UDP. For Gateway Load Balancers, the supported protocol is GENEVE. A TCP_UDP listener must be associated with a TCP_UDP target group. If the target is a Lambda function, this parameter does not apply.

  • :protocol_version (String)

    [HTTP/HTTPS protocol] The protocol version. Specify GRPC to send requests to targets using gRPC. Specify HTTP2 to send requests to targets using HTTP/2. The default is HTTP1, which sends requests to targets using HTTP/1.1.

  • :port (Integer)

    The port on which the targets receive traffic. This port is used unless you specify a port override when registering the target. If the target is a Lambda function, this parameter does not apply. If the protocol is GENEVE, the supported port is 6081.

  • :vpc_id (String)

    The identifier of the virtual private cloud (VPC). If the target is a Lambda function, this parameter does not apply. Otherwise, this parameter is required.

  • :health_check_protocol (String)

    The protocol the load balancer uses when performing health checks on targets. For Application Load Balancers, the default is HTTP. For Network Load Balancers and Gateway Load Balancers, the default is TCP. The TCP protocol is not supported for health checks if the protocol of the target group is HTTP or HTTPS. The GENEVE, TLS, UDP, and TCP_UDP protocols are not supported for health checks.

  • :health_check_port (String)

    The port the load balancer uses when performing health checks on targets. If the protocol is HTTP, HTTPS, TCP, TLS, UDP, or TCP_UDP, the default is traffic-port, which is the port on which each target receives traffic from the load balancer. If the protocol is GENEVE, the default is port 80.

  • :health_check_enabled (Boolean)

    Indicates whether health checks are enabled. If the target type is lambda, health checks are disabled by default but can be enabled. If the target type is instance or ip, health checks are always enabled and cannot be disabled.

  • :health_check_path (String)

    [HTTP/HTTPS health checks] The destination for health checks on the targets.

    [HTTP1 or HTTP2 protocol version] The ping path. The default is /.

    [GRPC protocol version] The path of a custom health check method with the format /package.service/method. The default is /AWS.ALB/healthcheck.

  • :health_check_interval_seconds (Integer)

    The approximate amount of time, in seconds, between health checks of an individual target. For TCP health checks, the supported values are 10 and 30 seconds. If the target type is instance or ip, the default is 30 seconds. If the target group protocol is GENEVE, the default is 10 seconds. If the target type is lambda, the default is 35 seconds.

  • :health_check_timeout_seconds (Integer)

    The amount of time, in seconds, during which no response from a target means a failed health check. For target groups with a protocol of HTTP, HTTPS, or GENEVE, the default is 5 seconds. For target groups with a protocol of TCP or TLS, this value must be 6 seconds for HTTP health checks and 10 seconds for TCP and HTTPS health checks. If the target type is lambda, the default is 30 seconds.

  • :healthy_threshold_count (Integer)

    The number of consecutive health checks successes required before considering an unhealthy target healthy. For target groups with a protocol of HTTP or HTTPS, the default is 5. For target groups with a protocol of TCP, TLS, or GENEVE, the default is 3. If the target type is lambda, the default is 5.

  • :unhealthy_threshold_count (Integer)

    The number of consecutive health check failures required before considering a target unhealthy. If the target group protocol is HTTP or HTTPS, the default is 2. If the target group protocol is TCP or TLS, this value must be the same as the healthy threshold count. If the target group protocol is GENEVE, the default is 3. If the target type is lambda, the default is 2.

  • :matcher (Types::Matcher)

    [HTTP/HTTPS health checks] The HTTP or gRPC codes to use when checking for a successful response from a target.

  • :target_type (String)

    The type of target that you must specify when registering targets with this target group. You can\'t specify targets for a target group using more than one target type.

    • instance - Register targets by instance ID. This is the default value.

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

    • lambda - Register a single Lambda function as a target.

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

    The tags to assign to the target group.

Returns:

See Also:

#delete_listener(options = {}) ⇒ Struct

Deletes the specified listener.

Alternatively, your listener is deleted when you delete the load balancer to which it is attached.

Examples:

Example: To delete a listener


# This example deletes the specified listener.

resp = client.delete_listener({
  listener_arn: "arn:aws:elasticloadbalancing:ua-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2", 
})

Request syntax with placeholder values


resp = client.delete_listener({
  listener_arn: "ListenerArn", # required
})

Options Hash (options):

  • :listener_arn (required, String)

    The Amazon Resource Name (ARN) of the listener.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#delete_load_balancer(options = {}) ⇒ Struct

Deletes the specified Application Load Balancer, Network Load Balancer, or Gateway Load Balancer. Deleting a load balancer also deletes its listeners.

You can't delete a load balancer if deletion protection is enabled. If the load balancer does not exist or has already been deleted, the call succeeds.

Deleting a load balancer does not affect its registered targets. For example, your EC2 instances continue to run and are still registered to their target groups. If you no longer need these EC2 instances, you can stop or terminate them.

Examples:

Example: To delete a load balancer


# This example deletes the specified load balancer.

resp = client.delete_load_balancer({
  load_balancer_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
})

Request syntax with placeholder values


resp = client.delete_load_balancer({
  load_balancer_arn: "LoadBalancerArn", # required
})

Options Hash (options):

  • :load_balancer_arn (required, String)

    The Amazon Resource Name (ARN) of the load balancer.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#delete_rule(options = {}) ⇒ Struct

Deletes the specified rule.

You can't delete the default rule.

Examples:

Example: To delete a rule


# This example deletes the specified rule.

resp = client.delete_rule({
  rule_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/1291d13826f405c3", 
})

Request syntax with placeholder values


resp = client.delete_rule({
  rule_arn: "RuleArn", # required
})

Options Hash (options):

  • :rule_arn (required, String)

    The Amazon Resource Name (ARN) of the rule.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#delete_target_group(options = {}) ⇒ Struct

Deletes the specified target group.

You can delete a target group if it is not referenced by any actions. Deleting a target group also deletes any associated health checks. Deleting a target group does not affect its registered targets. For example, any EC2 instances continue to run until you stop or terminate them.

Examples:

Example: To delete a target group


# This example deletes the specified target group.

resp = client.delete_target_group({
  target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
})

Request syntax with placeholder values


resp = client.delete_target_group({
  target_group_arn: "TargetGroupArn", # required
})

Options Hash (options):

  • :target_group_arn (required, String)

    The Amazon Resource Name (ARN) of the target group.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#deregister_targets(options = {}) ⇒ Struct

Deregisters the specified targets from the specified target group. After the targets are deregistered, they no longer receive traffic from the load balancer.

Examples:

Example: To deregister a target from a target group


# This example deregisters the specified instance from the specified target group.

resp = client.deregister_targets({
  target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
  targets: [
    {
      id: "i-0f76fade", 
    }, 
  ], 
})

Request syntax with placeholder values


resp = client.deregister_targets({
  target_group_arn: "TargetGroupArn", # required
  targets: [ # required
    {
      id: "TargetId", # required
      port: 1,
      availability_zone: "ZoneName",
    },
  ],
})

Options Hash (options):

  • :target_group_arn (required, String)

    The Amazon Resource Name (ARN) of the target group.

  • :targets (required, Array<Types::TargetDescription>)

    The targets. If you specified a port override when you registered a target, you must specify both the target ID and the port when you deregister it.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

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

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

For more information, see the following:

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_listener_certificates(options = {}) ⇒ Types::DescribeListenerCertificatesOutput

Describes the default certificate and the certificate list for the specified HTTPS or TLS listener.

If the default certificate is also in the certificate list, it appears twice in the results (once with IsDefault set to true and once with IsDefault set to false).

For more information, see SSL certificates in the Application Load Balancers Guide or Server certificates in the Network Load Balancers Guide.

Examples:

Request syntax with placeholder values


resp = client.describe_listener_certificates({
  listener_arn: "ListenerArn", # required
  marker: "Marker",
  page_size: 1,
})

Response structure


resp.certificates #=> Array
resp.certificates[0].certificate_arn #=> String
resp.certificates[0].is_default #=> true/false
resp.next_marker #=> String

Options Hash (options):

  • :listener_arn (required, String)

    The Amazon Resource Names (ARN) of the listener.

  • :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_listeners(options = {}) ⇒ Types::DescribeListenersOutput

Describes the specified listeners or the listeners for the specified Application Load Balancer, Network Load Balancer, or Gateway Load Balancer. You must specify either a load balancer or one or more listeners.

Examples:

Example: To describe a listener


# This example describes the specified listener.

resp = client.describe_listeners({
  listener_arns: [
    "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2", 
  ], 
})

# resp.to_h outputs the following:
{
  listeners: [
    {
      default_actions: [
        {
          target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
          type: "forward", 
        }, 
      ], 
      listener_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2", 
      load_balancer_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
      port: 80, 
      protocol: "HTTP", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.describe_listeners({
  load_balancer_arn: "LoadBalancerArn",
  listener_arns: ["ListenerArn"],
  marker: "Marker",
  page_size: 1,
})

Response structure


resp.listeners #=> Array
resp.listeners[0].listener_arn #=> String
resp.listeners[0].load_balancer_arn #=> String
resp.listeners[0].port #=> Integer
resp.listeners[0].protocol #=> String, one of "HTTP", "HTTPS", "TCP", "TLS", "UDP", "TCP_UDP", "GENEVE"
resp.listeners[0].certificates #=> Array
resp.listeners[0].certificates[0].certificate_arn #=> String
resp.listeners[0].certificates[0].is_default #=> true/false
resp.listeners[0].ssl_policy #=> String
resp.listeners[0].default_actions #=> Array
resp.listeners[0].default_actions[0].type #=> String, one of "forward", "authenticate-oidc", "authenticate-cognito", "redirect", "fixed-response"
resp.listeners[0].default_actions[0].target_group_arn #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.issuer #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.authorization_endpoint #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.token_endpoint #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config. #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.client_id #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.client_secret #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.session_cookie_name #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.scope #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.session_timeout #=> Integer
resp.listeners[0].default_actions[0].authenticate_oidc_config.authentication_request_extra_params #=> Hash
resp.listeners[0].default_actions[0].authenticate_oidc_config.authentication_request_extra_params["AuthenticateOidcActionAuthenticationRequestParamName"] #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.on_unauthenticated_request #=> String, one of "deny", "allow", "authenticate"
resp.listeners[0].default_actions[0].authenticate_oidc_config.use_existing_client_secret #=> true/false
resp.listeners[0].default_actions[0].authenticate_cognito_config.user_pool_arn #=> String
resp.listeners[0].default_actions[0].authenticate_cognito_config.user_pool_client_id #=> String
resp.listeners[0].default_actions[0].authenticate_cognito_config.user_pool_domain #=> String
resp.listeners[0].default_actions[0].authenticate_cognito_config.session_cookie_name #=> String
resp.listeners[0].default_actions[0].authenticate_cognito_config.scope #=> String
resp.listeners[0].default_actions[0].authenticate_cognito_config.session_timeout #=> Integer
resp.listeners[0].default_actions[0].authenticate_cognito_config.authentication_request_extra_params #=> Hash
resp.listeners[0].default_actions[0].authenticate_cognito_config.authentication_request_extra_params["AuthenticateCognitoActionAuthenticationRequestParamName"] #=> String
resp.listeners[0].default_actions[0].authenticate_cognito_config.on_unauthenticated_request #=> String, one of "deny", "allow", "authenticate"
resp.listeners[0].default_actions[0].order #=> Integer
resp.listeners[0].default_actions[0].redirect_config.protocol #=> String
resp.listeners[0].default_actions[0].redirect_config.port #=> String
resp.listeners[0].default_actions[0].redirect_config.host #=> String
resp.listeners[0].default_actions[0].redirect_config.path #=> String
resp.listeners[0].default_actions[0].redirect_config.query #=> String
resp.listeners[0].default_actions[0].redirect_config.status_code #=> String, one of "HTTP_301", "HTTP_302"
resp.listeners[0].default_actions[0].fixed_response_config.message_body #=> String
resp.listeners[0].default_actions[0].fixed_response_config.status_code #=> String
resp.listeners[0].default_actions[0].fixed_response_config.content_type #=> String
resp.listeners[0].default_actions[0].forward_config.target_groups #=> Array
resp.listeners[0].default_actions[0].forward_config.target_groups[0].target_group_arn #=> String
resp.listeners[0].default_actions[0].forward_config.target_groups[0].weight #=> Integer
resp.listeners[0].default_actions[0].forward_config.target_group_stickiness_config.enabled #=> true/false
resp.listeners[0].default_actions[0].forward_config.target_group_stickiness_config.duration_seconds #=> Integer
resp.listeners[0].alpn_policy #=> Array
resp.listeners[0].alpn_policy[0] #=> String
resp.next_marker #=> String

Options Hash (options):

  • :load_balancer_arn (String)

    The Amazon Resource Name (ARN) of the load balancer.

  • :listener_arns (Array<String>)

    The Amazon Resource Names (ARN) of the listeners.

  • :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_load_balancer_attributes(options = {}) ⇒ Types::DescribeLoadBalancerAttributesOutput

Describes the attributes for the specified Application Load Balancer, Network Load Balancer, or Gateway Load Balancer.

For more information, see the following:

Examples:

Example: To describe load balancer attributes


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

resp = client.describe_load_balancer_attributes({
  load_balancer_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
})

# resp.to_h outputs the following:
{
  attributes: [
    {
      key: "access_logs.s3.enabled", 
      value: "false", 
    }, 
    {
      key: "idle_timeout.timeout_seconds", 
      value: "60", 
    }, 
    {
      key: "access_logs.s3.prefix", 
      value: "", 
    }, 
    {
      key: "deletion_protection.enabled", 
      value: "false", 
    }, 
    {
      key: "access_logs.s3.bucket", 
      value: "", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.describe_load_balancer_attributes({
  load_balancer_arn: "LoadBalancerArn", # required
})

Response structure


resp.attributes #=> Array
resp.attributes[0].key #=> String
resp.attributes[0].value #=> String

Options Hash (options):

  • :load_balancer_arn (required, String)

    The Amazon Resource Name (ARN) of the load balancer.

Returns:

See Also:

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

Describes the specified load balancers or all of your load balancers.

Examples:

Example: To describe a load balancer


# This example describes the specified load balancer.

resp = client.describe_load_balancers({
  load_balancer_arns: [
    "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
  ], 
})

# resp.to_h outputs the following:
{
  load_balancers: [
    {
      availability_zones: [
        {
          subnet_id: "subnet-8360a9e7", 
          zone_name: "us-west-2a", 
        }, 
        {
          subnet_id: "subnet-b7d581c0", 
          zone_name: "us-west-2b", 
        }, 
      ], 
      canonical_hosted_zone_id: "Z2P70J7EXAMPLE", 
      created_time: Time.parse("2016-03-25T21:26:12.920Z"), 
      dns_name: "my-load-balancer-424835706.us-west-2.elb.amazonaws.com", 
      load_balancer_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
      load_balancer_name: "my-load-balancer", 
      scheme: "internet-facing", 
      security_groups: [
        "sg-5943793c", 
      ], 
      state: {
        code: "active", 
      }, 
      type: "application", 
      vpc_id: "vpc-3ac0fb5f", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.describe_load_balancers({
  load_balancer_arns: ["LoadBalancerArn"],
  names: ["LoadBalancerName"],
  marker: "Marker",
  page_size: 1,
})

Response structure


resp.load_balancers #=> Array
resp.load_balancers[0].load_balancer_arn #=> String
resp.load_balancers[0].dns_name #=> String
resp.load_balancers[0].canonical_hosted_zone_id #=> String
resp.load_balancers[0].created_time #=> Time
resp.load_balancers[0].load_balancer_name #=> String
resp.load_balancers[0].scheme #=> String, one of "internet-facing", "internal"
resp.load_balancers[0].vpc_id #=> String
resp.load_balancers[0].state.code #=> String, one of "active", "provisioning", "active_impaired", "failed"
resp.load_balancers[0].state.reason #=> String
resp.load_balancers[0].type #=> String, one of "application", "network", "gateway"
resp.load_balancers[0].availability_zones #=> Array
resp.load_balancers[0].availability_zones[0].zone_name #=> String
resp.load_balancers[0].availability_zones[0].subnet_id #=> String
resp.load_balancers[0].availability_zones[0].outpost_id #=> String
resp.load_balancers[0].availability_zones[0].load_balancer_addresses #=> Array
resp.load_balancers[0].availability_zones[0].load_balancer_addresses[0].ip_address #=> String
resp.load_balancers[0].availability_zones[0].load_balancer_addresses[0].allocation_id #=> String
resp.load_balancers[0].availability_zones[0].load_balancer_addresses[0].private_i_pv_4_address #=> String
resp.load_balancers[0].availability_zones[0].load_balancer_addresses[0].i_pv_6_address #=> String
resp.load_balancers[0].security_groups #=> Array
resp.load_balancers[0].security_groups[0] #=> String
resp.load_balancers[0].ip_address_type #=> String, one of "ipv4", "dualstack"
resp.load_balancers[0].customer_owned_ipv_4_pool #=> String
resp.next_marker #=> String

Options Hash (options):

  • :load_balancer_arns (Array<String>)

    The Amazon Resource Names (ARN) of the load balancers. You can specify up to 20 load balancers in a single call.

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

Returns:

See Also:

#describe_rules(options = {}) ⇒ Types::DescribeRulesOutput

Describes the specified rules or the rules for the specified listener. You must specify either a listener or one or more rules.

Examples:

Example: To describe a rule


# This example describes the specified rule.

resp = client.describe_rules({
  rule_arns: [
    "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/9683b2d02a6cabee", 
  ], 
})

# resp.to_h outputs the following:
{
  rules: [
    {
      actions: [
        {
          target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
          type: "forward", 
        }, 
      ], 
      conditions: [
        {
          field: "path-pattern", 
          values: [
            "/img/*", 
          ], 
        }, 
      ], 
      is_default: false, 
      priority: "10", 
      rule_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/9683b2d02a6cabee", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.describe_rules({
  listener_arn: "ListenerArn",
  rule_arns: ["RuleArn"],
  marker: "Marker",
  page_size: 1,
})

Response structure


resp.rules #=> Array
resp.rules[0].rule_arn #=> String
resp.rules[0].priority #=> String
resp.rules[0].conditions #=> Array
resp.rules[0].conditions[0].field #=> String
resp.rules[0].conditions[0].values #=> Array
resp.rules[0].conditions[0].values[0] #=> String
resp.rules[0].conditions[0].host_header_config.values #=> Array
resp.rules[0].conditions[0].host_header_config.values[0] #=> String
resp.rules[0].conditions[0].path_pattern_config.values #=> Array
resp.rules[0].conditions[0].path_pattern_config.values[0] #=> String
resp.rules[0].conditions[0].http_header_config.http_header_name #=> String
resp.rules[0].conditions[0].http_header_config.values #=> Array
resp.rules[0].conditions[0].http_header_config.values[0] #=> String
resp.rules[0].conditions[0].query_string_config.values #=> Array
resp.rules[0].conditions[0].query_string_config.values[0].key #=> String
resp.rules[0].conditions[0].query_string_config.values[0].value #=> String
resp.rules[0].conditions[0].http_request_method_config.values #=> Array
resp.rules[0].conditions[0].http_request_method_config.values[0] #=> String
resp.rules[0].conditions[0].source_ip_config.values #=> Array
resp.rules[0].conditions[0].source_ip_config.values[0] #=> String
resp.rules[0].actions #=> Array
resp.rules[0].actions[0].type #=> String, one of "forward", "authenticate-oidc", "authenticate-cognito", "redirect", "fixed-response"
resp.rules[0].actions[0].target_group_arn #=> String
resp.rules[0].actions[0].authenticate_oidc_config.issuer #=> String
resp.rules[0].actions[0].authenticate_oidc_config.authorization_endpoint #=> String
resp.rules[0].actions[0].authenticate_oidc_config.token_endpoint #=> String
resp.rules[0].actions[0].authenticate_oidc_config. #=> String
resp.rules[0].actions[0].authenticate_oidc_config.client_id #=> String
resp.rules[0].actions[0].authenticate_oidc_config.client_secret #=> String
resp.rules[0].actions[0].authenticate_oidc_config.session_cookie_name #=> String
resp.rules[0].actions[0].authenticate_oidc_config.scope #=> String
resp.rules[0].actions[0].authenticate_oidc_config.session_timeout #=> Integer
resp.rules[0].actions[0].authenticate_oidc_config.authentication_request_extra_params #=> Hash
resp.rules[0].actions[0].authenticate_oidc_config.authentication_request_extra_params["AuthenticateOidcActionAuthenticationRequestParamName"] #=> String
resp.rules[0].actions[0].authenticate_oidc_config.on_unauthenticated_request #=> String, one of "deny", "allow", "authenticate"
resp.rules[0].actions[0].authenticate_oidc_config.use_existing_client_secret #=> true/false
resp.rules[0].actions[0].authenticate_cognito_config.user_pool_arn #=> String
resp.rules[0].actions[0].authenticate_cognito_config.user_pool_client_id #=> String
resp.rules[0].actions[0].authenticate_cognito_config.user_pool_domain #=> String
resp.rules[0].actions[0].authenticate_cognito_config.session_cookie_name #=> String
resp.rules[0].actions[0].authenticate_cognito_config.scope #=> String
resp.rules[0].actions[0].authenticate_cognito_config.session_timeout #=> Integer
resp.rules[0].actions[0].authenticate_cognito_config.authentication_request_extra_params #=> Hash
resp.rules[0].actions[0].authenticate_cognito_config.authentication_request_extra_params["AuthenticateCognitoActionAuthenticationRequestParamName"] #=> String
resp.rules[0].actions[0].authenticate_cognito_config.on_unauthenticated_request #=> String, one of "deny", "allow", "authenticate"
resp.rules[0].actions[0].order #=> Integer
resp.rules[0].actions[0].redirect_config.protocol #=> String
resp.rules[0].actions[0].redirect_config.port #=> String
resp.rules[0].actions[0].redirect_config.host #=> String
resp.rules[0].actions[0].redirect_config.path #=> String
resp.rules[0].actions[0].redirect_config.query #=> String
resp.rules[0].actions[0].redirect_config.status_code #=> String, one of "HTTP_301", "HTTP_302"
resp.rules[0].actions[0].fixed_response_config.message_body #=> String
resp.rules[0].actions[0].fixed_response_config.status_code #=> String
resp.rules[0].actions[0].fixed_response_config.content_type #=> String
resp.rules[0].actions[0].forward_config.target_groups #=> Array
resp.rules[0].actions[0].forward_config.target_groups[0].target_group_arn #=> String
resp.rules[0].actions[0].forward_config.target_groups[0].weight #=> Integer
resp.rules[0].actions[0].forward_config.target_group_stickiness_config.enabled #=> true/false
resp.rules[0].actions[0].forward_config.target_group_stickiness_config.duration_seconds #=> Integer
resp.rules[0].is_default #=> true/false
resp.next_marker #=> String

Options Hash (options):

  • :listener_arn (String)

    The Amazon Resource Name (ARN) of the listener.

  • :rule_arns (Array<String>)

    The Amazon Resource Names (ARN) of the rules.

  • :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_ssl_policies(options = {}) ⇒ Types::DescribeSSLPoliciesOutput

Describes the specified policies or all policies used for SSL negotiation.

For more information, see Security policies in the Application Load Balancers Guide or Security policies in the Network Load Balancers Guide.

Examples:

Example: To describe a policy used for SSL negotiation


# This example describes the specified policy used for SSL negotiation.

resp = client.describe_ssl_policies({
  names: [
    "ELBSecurityPolicy-2015-05", 
  ], 
})

# resp.to_h outputs the following:
{
  ssl_policies: [
    {
      ciphers: [
        {
          name: "ECDHE-ECDSA-AES128-GCM-SHA256", 
          priority: 1, 
        }, 
        {
          name: "ECDHE-RSA-AES128-GCM-SHA256", 
          priority: 2, 
        }, 
        {
          name: "ECDHE-ECDSA-AES128-SHA256", 
          priority: 3, 
        }, 
        {
          name: "ECDHE-RSA-AES128-SHA256", 
          priority: 4, 
        }, 
        {
          name: "ECDHE-ECDSA-AES128-SHA", 
          priority: 5, 
        }, 
        {
          name: "ECDHE-RSA-AES128-SHA", 
          priority: 6, 
        }, 
        {
          name: "DHE-RSA-AES128-SHA", 
          priority: 7, 
        }, 
        {
          name: "ECDHE-ECDSA-AES256-GCM-SHA384", 
          priority: 8, 
        }, 
        {
          name: "ECDHE-RSA-AES256-GCM-SHA384", 
          priority: 9, 
        }, 
        {
          name: "ECDHE-ECDSA-AES256-SHA384", 
          priority: 10, 
        }, 
        {
          name: "ECDHE-RSA-AES256-SHA384", 
          priority: 11, 
        }, 
        {
          name: "ECDHE-RSA-AES256-SHA", 
          priority: 12, 
        }, 
        {
          name: "ECDHE-ECDSA-AES256-SHA", 
          priority: 13, 
        }, 
        {
          name: "AES128-GCM-SHA256", 
          priority: 14, 
        }, 
        {
          name: "AES128-SHA256", 
          priority: 15, 
        }, 
        {
          name: "AES128-SHA", 
          priority: 16, 
        }, 
        {
          name: "AES256-GCM-SHA384", 
          priority: 17, 
        }, 
        {
          name: "AES256-SHA256", 
          priority: 18, 
        }, 
        {
          name: "AES256-SHA", 
          priority: 19, 
        }, 
      ], 
      name: "ELBSecurityPolicy-2015-05", 
      ssl_protocols: [
        "TLSv1", 
        "TLSv1.1", 
        "TLSv1.2", 
      ], 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.describe_ssl_policies({
  names: ["SslPolicyName"],
  marker: "Marker",
  page_size: 1,
})

Response structure


resp.ssl_policies #=> Array
resp.ssl_policies[0].ssl_protocols #=> Array
resp.ssl_policies[0].ssl_protocols[0] #=> String
resp.ssl_policies[0].ciphers #=> Array
resp.ssl_policies[0].ciphers[0].name #=> String
resp.ssl_policies[0].ciphers[0].priority #=> Integer
resp.ssl_policies[0].name #=> String
resp.next_marker #=> String

Options Hash (options):

  • :names (Array<String>)

    The names of the policies.

  • :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_tags(options = {}) ⇒ Types::DescribeTagsOutput

Describes the tags for the specified Elastic Load Balancing resources. You can describe the tags for one or more Application Load Balancers, Network Load Balancers, Gateway Load Balancers, target groups, listeners, or rules.

Examples:

Example: To describe the tags assigned to a load balancer


# This example describes the tags assigned to the specified load balancer.

resp = client.describe_tags({
  resource_arns: [
    "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
  ], 
})

# resp.to_h outputs the following:
{
  tag_descriptions: [
    {
      resource_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
      tags: [
        {
          key: "project", 
          value: "lima", 
        }, 
        {
          key: "department", 
          value: "digital-media", 
        }, 
      ], 
    }, 
  ], 
}

Request syntax with placeholder values


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

Response structure


resp.tag_descriptions #=> Array
resp.tag_descriptions[0].resource_arn #=> 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):

  • :resource_arns (required, Array<String>)

    The Amazon Resource Names (ARN) of the resources. You can specify up to 20 resources in a single call.

Returns:

See Also:

#describe_target_group_attributes(options = {}) ⇒ Types::DescribeTargetGroupAttributesOutput

Describes the attributes for the specified target group.

For more information, see the following:

Examples:

Example: To describe target group attributes


# This example describes the attributes of the specified target group.

resp = client.describe_target_group_attributes({
  target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
})

# resp.to_h outputs the following:
{
  attributes: [
    {
      key: "stickiness.enabled", 
      value: "false", 
    }, 
    {
      key: "deregistration_delay.timeout_seconds", 
      value: "300", 
    }, 
    {
      key: "stickiness.type", 
      value: "lb_cookie", 
    }, 
    {
      key: "stickiness.lb_cookie.duration_seconds", 
      value: "86400", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.describe_target_group_attributes({
  target_group_arn: "TargetGroupArn", # required
})

Response structure


resp.attributes #=> Array
resp.attributes[0].key #=> String
resp.attributes[0].value #=> String

Options Hash (options):

  • :target_group_arn (required, String)

    The Amazon Resource Name (ARN) of the target group.

Returns:

See Also:

#describe_target_groups(options = {}) ⇒ Types::DescribeTargetGroupsOutput

Describes the specified target groups or all of your target groups. By default, all target groups are described. Alternatively, you can specify one of the following to filter the results: the ARN of the load balancer, the names of one or more target groups, or the ARNs of one or more target groups.

Examples:

Example: To describe a target group


# This example describes the specified target group.

resp = client.describe_target_groups({
  target_group_arns: [
    "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
  ], 
})

# resp.to_h outputs the following:
{
  target_groups: [
    {
      health_check_interval_seconds: 30, 
      health_check_path: "/", 
      health_check_port: "traffic-port", 
      health_check_protocol: "HTTP", 
      health_check_timeout_seconds: 5, 
      healthy_threshold_count: 5, 
      load_balancer_arns: [
        "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
      ], 
      matcher: {
        http_code: "200", 
      }, 
      port: 80, 
      protocol: "HTTP", 
      target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
      target_group_name: "my-targets", 
      unhealthy_threshold_count: 2, 
      vpc_id: "vpc-3ac0fb5f", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.describe_target_groups({
  load_balancer_arn: "LoadBalancerArn",
  target_group_arns: ["TargetGroupArn"],
  names: ["TargetGroupName"],
  marker: "Marker",
  page_size: 1,
})

Response structure


resp.target_groups #=> Array
resp.target_groups[0].target_group_arn #=> String
resp.target_groups[0].target_group_name #=> String
resp.target_groups[0].protocol #=> String, one of "HTTP", "HTTPS", "TCP", "TLS", "UDP", "TCP_UDP", "GENEVE"
resp.target_groups[0].port #=> Integer
resp.target_groups[0].vpc_id #=> String
resp.target_groups[0].health_check_protocol #=> String, one of "HTTP", "HTTPS", "TCP", "TLS", "UDP", "TCP_UDP", "GENEVE"
resp.target_groups[0].health_check_port #=> String
resp.target_groups[0].health_check_enabled #=> true/false
resp.target_groups[0].health_check_interval_seconds #=> Integer
resp.target_groups[0].health_check_timeout_seconds #=> Integer
resp.target_groups[0].healthy_threshold_count #=> Integer
resp.target_groups[0].unhealthy_threshold_count #=> Integer
resp.target_groups[0].health_check_path #=> String
resp.target_groups[0].matcher.http_code #=> String
resp.target_groups[0].matcher.grpc_code #=> String
resp.target_groups[0].load_balancer_arns #=> Array
resp.target_groups[0].load_balancer_arns[0] #=> String
resp.target_groups[0].target_type #=> String, one of "instance", "ip", "lambda"
resp.target_groups[0].protocol_version #=> String
resp.next_marker #=> String

Options Hash (options):

  • :load_balancer_arn (String)

    The Amazon Resource Name (ARN) of the load balancer.

  • :target_group_arns (Array<String>)

    The Amazon Resource Names (ARN) of the target groups.

  • :names (Array<String>)

    The names of the target groups.

  • :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_target_health(options = {}) ⇒ Types::DescribeTargetHealthOutput

Describes the health of the specified targets or all of your targets.

Examples:

Example: To describe the health of the targets for a target group


# This example describes the health of the targets for the specified target group. One target is healthy but the other is not specified in an action, so it can't receive traffic from the load balancer.

resp = client.describe_target_health({
  target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
})

# resp.to_h outputs the following:
{
  target_health_descriptions: [
    {
      target: {
        id: "i-0f76fade", 
        port: 80, 
      }, 
      target_health: {
        description: "Given target group is not configured to receive traffic from ELB", 
        reason: "Target.NotInUse", 
        state: "unused", 
      }, 
    }, 
    {
      health_check_port: "80", 
      target: {
        id: "i-0f76fade", 
        port: 80, 
      }, 
      target_health: {
        state: "healthy", 
      }, 
    }, 
  ], 
}

Example: To describe the health of a target


# This example describes the health of the specified target. This target is healthy.

resp = client.describe_target_health({
  target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
  targets: [
    {
      id: "i-0f76fade", 
      port: 80, 
    }, 
  ], 
})

# resp.to_h outputs the following:
{
  target_health_descriptions: [
    {
      health_check_port: "80", 
      target: {
        id: "i-0f76fade", 
        port: 80, 
      }, 
      target_health: {
        state: "healthy", 
      }, 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.describe_target_health({
  target_group_arn: "TargetGroupArn", # required
  targets: [
    {
      id: "TargetId", # required
      port: 1,
      availability_zone: "ZoneName",
    },
  ],
})

Response structure


resp.target_health_descriptions #=> Array
resp.target_health_descriptions[0].target.id #=> String
resp.target_health_descriptions[0].target.port #=> Integer
resp.target_health_descriptions[0].target.availability_zone #=> String
resp.target_health_descriptions[0].health_check_port #=> String
resp.target_health_descriptions[0].target_health.state #=> String, one of "initial", "healthy", "unhealthy", "unused", "draining", "unavailable"
resp.target_health_descriptions[0].target_health.reason #=> String, one of "Elb.RegistrationInProgress", "Elb.InitialHealthChecking", "Target.ResponseCodeMismatch", "Target.Timeout", "Target.FailedHealthChecks", "Target.NotRegistered", "Target.NotInUse", "Target.DeregistrationInProgress", "Target.InvalidState", "Target.IpUnusable", "Target.HealthCheckDisabled", "Elb.InternalError"
resp.target_health_descriptions[0].target_health.description #=> String

Options Hash (options):

  • :target_group_arn (required, String)

    The Amazon Resource Name (ARN) of the target group.

  • :targets (Array<Types::TargetDescription>)

    The targets.

Returns:

See Also:

#modify_listener(options = {}) ⇒ Types::ModifyListenerOutput

Replaces the specified properties of the specified listener. Any properties that you do not specify remain unchanged.

Changing the protocol from HTTPS to HTTP, or from TLS to TCP, removes the security policy and default certificate properties. If you change the protocol from HTTP to HTTPS, or from TCP to TLS, you must add the security policy and default certificate properties.

To add an item to a list, remove an item from a list, or update an item in a list, you must provide the entire list. For example, to add an action, specify a list with the current actions plus the new action.

Examples:

Example: To change the default action for a listener


# This example changes the default action for the specified listener.

resp = client.modify_listener({
  default_actions: [
    {
      target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/2453ed029918f21f", 
      type: "forward", 
    }, 
  ], 
  listener_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2", 
})

# resp.to_h outputs the following:
{
  listeners: [
    {
      default_actions: [
        {
          target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/2453ed029918f21f", 
          type: "forward", 
        }, 
      ], 
      listener_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2", 
      load_balancer_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
      port: 80, 
      protocol: "HTTP", 
    }, 
  ], 
}

Example: To change the server certificate


# This example changes the server certificate for the specified HTTPS listener.

resp = client.modify_listener({
  certificates: [
    {
      certificate_arn: "arn:aws:iam::123456789012:server-certificate/my-new-server-cert", 
    }, 
  ], 
  listener_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/0467ef3c8400ae65", 
})

# resp.to_h outputs the following:
{
  listeners: [
    {
      certificates: [
        {
          certificate_arn: "arn:aws:iam::123456789012:server-certificate/my-new-server-cert", 
        }, 
      ], 
      default_actions: [
        {
          target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
          type: "forward", 
        }, 
      ], 
      listener_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/0467ef3c8400ae65", 
      load_balancer_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
      port: 443, 
      protocol: "HTTPS", 
      ssl_policy: "ELBSecurityPolicy-2015-05", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.modify_listener({
  listener_arn: "ListenerArn", # required
  port: 1,
  protocol: "HTTP", # accepts HTTP, HTTPS, TCP, TLS, UDP, TCP_UDP, GENEVE
  ssl_policy: "SslPolicyName",
  certificates: [
    {
      certificate_arn: "CertificateArn",
      is_default: false,
    },
  ],
  default_actions: [
    {
      type: "forward", # required, accepts forward, authenticate-oidc, authenticate-cognito, redirect, fixed-response
      target_group_arn: "TargetGroupArn",
      authenticate_oidc_config: {
        issuer: "AuthenticateOidcActionIssuer", # required
        authorization_endpoint: "AuthenticateOidcActionAuthorizationEndpoint", # required
        token_endpoint: "AuthenticateOidcActionTokenEndpoint", # required
        user_info_endpoint: "AuthenticateOidcActionUserInfoEndpoint", # required
        client_id: "AuthenticateOidcActionClientId", # required
        client_secret: "AuthenticateOidcActionClientSecret",
        session_cookie_name: "AuthenticateOidcActionSessionCookieName",
        scope: "AuthenticateOidcActionScope",
        session_timeout: 1,
        authentication_request_extra_params: {
          "AuthenticateOidcActionAuthenticationRequestParamName" => "AuthenticateOidcActionAuthenticationRequestParamValue",
        },
        on_unauthenticated_request: "deny", # accepts deny, allow, authenticate
        use_existing_client_secret: false,
      },
      authenticate_cognito_config: {
        user_pool_arn: "AuthenticateCognitoActionUserPoolArn", # required
        user_pool_client_id: "AuthenticateCognitoActionUserPoolClientId", # required
        user_pool_domain: "AuthenticateCognitoActionUserPoolDomain", # required
        session_cookie_name: "AuthenticateCognitoActionSessionCookieName",
        scope: "AuthenticateCognitoActionScope",
        session_timeout: 1,
        authentication_request_extra_params: {
          "AuthenticateCognitoActionAuthenticationRequestParamName" => "AuthenticateCognitoActionAuthenticationRequestParamValue",
        },
        on_unauthenticated_request: "deny", # accepts deny, allow, authenticate
      },
      order: 1,
      redirect_config: {
        protocol: "RedirectActionProtocol",
        port: "RedirectActionPort",
        host: "RedirectActionHost",
        path: "RedirectActionPath",
        query: "RedirectActionQuery",
        status_code: "HTTP_301", # required, accepts HTTP_301, HTTP_302
      },
      fixed_response_config: {
        message_body: "FixedResponseActionMessage",
        status_code: "FixedResponseActionStatusCode", # required
        content_type: "FixedResponseActionContentType",
      },
      forward_config: {
        target_groups: [
          {
            target_group_arn: "TargetGroupArn",
            weight: 1,
          },
        ],
        target_group_stickiness_config: {
          enabled: false,
          duration_seconds: 1,
        },
      },
    },
  ],
  alpn_policy: ["AlpnPolicyValue"],
})

Response structure


resp.listeners #=> Array
resp.listeners[0].listener_arn #=> String
resp.listeners[0].load_balancer_arn #=> String
resp.listeners[0].port #=> Integer
resp.listeners[0].protocol #=> String, one of "HTTP", "HTTPS", "TCP", "TLS", "UDP", "TCP_UDP", "GENEVE"
resp.listeners[0].certificates #=> Array
resp.listeners[0].certificates[0].certificate_arn #=> String
resp.listeners[0].certificates[0].is_default #=> true/false
resp.listeners[0].ssl_policy #=> String
resp.listeners[0].default_actions #=> Array
resp.listeners[0].default_actions[0].type #=> String, one of "forward", "authenticate-oidc", "authenticate-cognito", "redirect", "fixed-response"
resp.listeners[0].default_actions[0].target_group_arn #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.issuer #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.authorization_endpoint #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.token_endpoint #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config. #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.client_id #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.client_secret #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.session_cookie_name #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.scope #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.session_timeout #=> Integer
resp.listeners[0].default_actions[0].authenticate_oidc_config.authentication_request_extra_params #=> Hash
resp.listeners[0].default_actions[0].authenticate_oidc_config.authentication_request_extra_params["AuthenticateOidcActionAuthenticationRequestParamName"] #=> String
resp.listeners[0].default_actions[0].authenticate_oidc_config.on_unauthenticated_request #=> String, one of "deny", "allow", "authenticate"
resp.listeners[0].default_actions[0].authenticate_oidc_config.use_existing_client_secret #=> true/false
resp.listeners[0].default_actions[0].authenticate_cognito_config.user_pool_arn #=> String
resp.listeners[0].default_actions[0].authenticate_cognito_config.user_pool_client_id #=> String
resp.listeners[0].default_actions[0].authenticate_cognito_config.user_pool_domain #=> String
resp.listeners[0].default_actions[0].authenticate_cognito_config.session_cookie_name #=> String
resp.listeners[0].default_actions[0].authenticate_cognito_config.scope #=> String
resp.listeners[0].default_actions[0].authenticate_cognito_config.session_timeout #=> Integer
resp.listeners[0].default_actions[0].authenticate_cognito_config.authentication_request_extra_params #=> Hash
resp.listeners[0].default_actions[0].authenticate_cognito_config.authentication_request_extra_params["AuthenticateCognitoActionAuthenticationRequestParamName"] #=> String
resp.listeners[0].default_actions[0].authenticate_cognito_config.on_unauthenticated_request #=> String, one of "deny", "allow", "authenticate"
resp.listeners[0].default_actions[0].order #=> Integer
resp.listeners[0].default_actions[0].redirect_config.protocol #=> String
resp.listeners[0].default_actions[0].redirect_config.port #=> String
resp.listeners[0].default_actions[0].redirect_config.host #=> String
resp.listeners[0].default_actions[0].redirect_config.path #=> String
resp.listeners[0].default_actions[0].redirect_config.query #=> String
resp.listeners[0].default_actions[0].redirect_config.status_code #=> String, one of "HTTP_301", "HTTP_302"
resp.listeners[0].default_actions[0].fixed_response_config.message_body #=> String
resp.listeners[0].default_actions[0].fixed_response_config.status_code #=> String
resp.listeners[0].default_actions[0].fixed_response_config.content_type #=> String
resp.listeners[0].default_actions[0].forward_config.target_groups #=> Array
resp.listeners[0].default_actions[0].forward_config.target_groups[0].target_group_arn #=> String
resp.listeners[0].default_actions[0].forward_config.target_groups[0].weight #=> Integer
resp.listeners[0].default_actions[0].forward_config.target_group_stickiness_config.enabled #=> true/false
resp.listeners[0].default_actions[0].forward_config.target_group_stickiness_config.duration_seconds #=> Integer
resp.listeners[0].alpn_policy #=> Array
resp.listeners[0].alpn_policy[0] #=> String

Options Hash (options):

  • :listener_arn (required, String)

    The Amazon Resource Name (ARN) of the listener.

  • :port (Integer)

    The port for connections from clients to the load balancer. You cannot specify a port for a Gateway Load Balancer.

  • :protocol (String)

    The protocol for connections from clients to the load balancer. Application Load Balancers support the HTTP and HTTPS protocols. Network Load Balancers support the TCP, TLS, UDP, and TCP_UDP protocols. You can’t change the protocol to UDP or TCP_UDP if dual-stack mode is enabled. You cannot specify a protocol for a Gateway Load Balancer.

  • :ssl_policy (String)

    [HTTPS and TLS listeners] The security policy that defines which protocols and ciphers are supported.

    For more information, see Security policies in the Application Load Balancers Guide or Security policies in the Network Load Balancers Guide.

  • :certificates (Array<Types::Certificate>)

    [HTTPS and TLS listeners] The default certificate for the listener. You must provide exactly one certificate. Set CertificateArn to the certificate ARN but do not set IsDefault.

  • :default_actions (Array<Types::Action>)

    The actions for the default rule.

  • :alpn_policy (Array<String>)

    [TLS listeners] The name of the Application-Layer Protocol Negotiation (ALPN) policy. You can specify one policy name. The following are the possible values:

    • HTTP1Only

    • HTTP2Only

    • HTTP2Optional

    • HTTP2Preferred

    • None

    For more information, see ALPN policies in the Network Load Balancers Guide.

Returns:

See Also:

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

Modifies the specified attributes of the specified Application Load Balancer, Network Load Balancer, or Gateway Load Balancer.

If any of the specified attributes can't be modified as requested, the call fails. Any existing attributes that you do not modify retain their current values.

Examples:

Example: To enable deletion protection


# This example enables deletion protection for the specified load balancer.

resp = client.modify_load_balancer_attributes({
  attributes: [
    {
      key: "deletion_protection.enabled", 
      value: "true", 
    }, 
  ], 
  load_balancer_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
})

# resp.to_h outputs the following:
{
  attributes: [
    {
      key: "deletion_protection.enabled", 
      value: "true", 
    }, 
    {
      key: "access_logs.s3.enabled", 
      value: "false", 
    }, 
    {
      key: "idle_timeout.timeout_seconds", 
      value: "60", 
    }, 
    {
      key: "access_logs.s3.prefix", 
      value: "", 
    }, 
    {
      key: "access_logs.s3.bucket", 
      value: "", 
    }, 
  ], 
}

Example: To change the idle timeout


# This example changes the idle timeout value for the specified load balancer.

resp = client.modify_load_balancer_attributes({
  attributes: [
    {
      key: "idle_timeout.timeout_seconds", 
      value: "30", 
    }, 
  ], 
  load_balancer_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
})

# resp.to_h outputs the following:
{
  attributes: [
    {
      key: "idle_timeout.timeout_seconds", 
      value: "30", 
    }, 
    {
      key: "access_logs.s3.enabled", 
      value: "false", 
    }, 
    {
      key: "access_logs.s3.prefix", 
      value: "", 
    }, 
    {
      key: "deletion_protection.enabled", 
      value: "true", 
    }, 
    {
      key: "access_logs.s3.bucket", 
      value: "", 
    }, 
  ], 
}

Example: To enable access logs


# This example enables access logs for the specified load balancer. Note that the S3 bucket must exist in the same region as the load balancer and must have a policy attached that grants access to the Elastic Load Balancing service.

resp = client.modify_load_balancer_attributes({
  attributes: [
    {
      key: "access_logs.s3.enabled", 
      value: "true", 
    }, 
    {
      key: "access_logs.s3.bucket", 
      value: "my-loadbalancer-logs", 
    }, 
    {
      key: "access_logs.s3.prefix", 
      value: "myapp", 
    }, 
  ], 
  load_balancer_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
})

# resp.to_h outputs the following:
{
  attributes: [
    {
      key: "access_logs.s3.enabled", 
      value: "true", 
    }, 
    {
      key: "access_logs.s3.bucket", 
      value: "my-load-balancer-logs", 
    }, 
    {
      key: "access_logs.s3.prefix", 
      value: "myapp", 
    }, 
    {
      key: "idle_timeout.timeout_seconds", 
      value: "60", 
    }, 
    {
      key: "deletion_protection.enabled", 
      value: "false", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.modify_load_balancer_attributes({
  load_balancer_arn: "LoadBalancerArn", # required
  attributes: [ # required
    {
      key: "LoadBalancerAttributeKey",
      value: "LoadBalancerAttributeValue",
    },
  ],
})

Response structure


resp.attributes #=> Array
resp.attributes[0].key #=> String
resp.attributes[0].value #=> String

Options Hash (options):

  • :load_balancer_arn (required, String)

    The Amazon Resource Name (ARN) of the load balancer.

  • :attributes (required, Array<Types::LoadBalancerAttribute>)

    The load balancer attributes.

Returns:

See Also:

#modify_rule(options = {}) ⇒ Types::ModifyRuleOutput

Replaces the specified properties of the specified rule. Any properties that you do not specify are unchanged.

To add an item to a list, remove an item from a list, or update an item in a list, you must provide the entire list. For example, to add an action, specify a list with the current actions plus the new action.

Examples:

Example: To modify a rule


# This example modifies the condition for the specified rule.

resp = client.modify_rule({
  conditions: [
    {
      field: "path-pattern", 
      values: [
        "/images/*", 
      ], 
    }, 
  ], 
  rule_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/9683b2d02a6cabee", 
})

# resp.to_h outputs the following:
{
  rules: [
    {
      actions: [
        {
          target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
          type: "forward", 
        }, 
      ], 
      conditions: [
        {
          field: "path-pattern", 
          values: [
            "/images/*", 
          ], 
        }, 
      ], 
      is_default: false, 
      priority: "10", 
      rule_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/9683b2d02a6cabee", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.modify_rule({
  rule_arn: "RuleArn", # required
  conditions: [
    {
      field: "ConditionFieldName",
      values: ["StringValue"],
      host_header_config: {
        values: ["StringValue"],
      },
      path_pattern_config: {
        values: ["StringValue"],
      },
      http_header_config: {
        http_header_name: "HttpHeaderConditionName",
        values: ["StringValue"],
      },
      query_string_config: {
        values: [
          {
            key: "StringValue",
            value: "StringValue",
          },
        ],
      },
      http_request_method_config: {
        values: ["StringValue"],
      },
      source_ip_config: {
        values: ["StringValue"],
      },
    },
  ],
  actions: [
    {
      type: "forward", # required, accepts forward, authenticate-oidc, authenticate-cognito, redirect, fixed-response
      target_group_arn: "TargetGroupArn",
      authenticate_oidc_config: {
        issuer: "AuthenticateOidcActionIssuer", # required
        authorization_endpoint: "AuthenticateOidcActionAuthorizationEndpoint", # required
        token_endpoint: "AuthenticateOidcActionTokenEndpoint", # required
        user_info_endpoint: "AuthenticateOidcActionUserInfoEndpoint", # required
        client_id: "AuthenticateOidcActionClientId", # required
        client_secret: "AuthenticateOidcActionClientSecret",
        session_cookie_name: "AuthenticateOidcActionSessionCookieName",
        scope: "AuthenticateOidcActionScope",
        session_timeout: 1,
        authentication_request_extra_params: {
          "AuthenticateOidcActionAuthenticationRequestParamName" => "AuthenticateOidcActionAuthenticationRequestParamValue",
        },
        on_unauthenticated_request: "deny", # accepts deny, allow, authenticate
        use_existing_client_secret: false,
      },
      authenticate_cognito_config: {
        user_pool_arn: "AuthenticateCognitoActionUserPoolArn", # required
        user_pool_client_id: "AuthenticateCognitoActionUserPoolClientId", # required
        user_pool_domain: "AuthenticateCognitoActionUserPoolDomain", # required
        session_cookie_name: "AuthenticateCognitoActionSessionCookieName",
        scope: "AuthenticateCognitoActionScope",
        session_timeout: 1,
        authentication_request_extra_params: {
          "AuthenticateCognitoActionAuthenticationRequestParamName" => "AuthenticateCognitoActionAuthenticationRequestParamValue",
        },
        on_unauthenticated_request: "deny", # accepts deny, allow, authenticate
      },
      order: 1,
      redirect_config: {
        protocol: "RedirectActionProtocol",
        port: "RedirectActionPort",
        host: "RedirectActionHost",
        path: "RedirectActionPath",
        query: "RedirectActionQuery",
        status_code: "HTTP_301", # required, accepts HTTP_301, HTTP_302
      },
      fixed_response_config: {
        message_body: "FixedResponseActionMessage",
        status_code: "FixedResponseActionStatusCode", # required
        content_type: "FixedResponseActionContentType",
      },
      forward_config: {
        target_groups: [
          {
            target_group_arn: "TargetGroupArn",
            weight: 1,
          },
        ],
        target_group_stickiness_config: {
          enabled: false,
          duration_seconds: 1,
        },
      },
    },
  ],
})

Response structure


resp.rules #=> Array
resp.rules[0].rule_arn #=> String
resp.rules[0].priority #=> String
resp.rules[0].conditions #=> Array
resp.rules[0].conditions[0].field #=> String
resp.rules[0].conditions[0].values #=> Array
resp.rules[0].conditions[0].values[0] #=> String
resp.rules[0].conditions[0].host_header_config.values #=> Array
resp.rules[0].conditions[0].host_header_config.values[0] #=> String
resp.rules[0].conditions[0].path_pattern_config.values #=> Array
resp.rules[0].conditions[0].path_pattern_config.values[0] #=> String
resp.rules[0].conditions[0].http_header_config.http_header_name #=> String
resp.rules[0].conditions[0].http_header_config.values #=> Array
resp.rules[0].conditions[0].http_header_config.values[0] #=> String
resp.rules[0].conditions[0].query_string_config.values #=> Array
resp.rules[0].conditions[0].query_string_config.values[0].key #=> String
resp.rules[0].conditions[0].query_string_config.values[0].value #=> String
resp.rules[0].conditions[0].http_request_method_config.values #=> Array
resp.rules[0].conditions[0].http_request_method_config.values[0] #=> String
resp.rules[0].conditions[0].source_ip_config.values #=> Array
resp.rules[0].conditions[0].source_ip_config.values[0] #=> String
resp.rules[0].actions #=> Array
resp.rules[0].actions[0].type #=> String, one of "forward", "authenticate-oidc", "authenticate-cognito", "redirect", "fixed-response"
resp.rules[0].actions[0].target_group_arn #=> String
resp.rules[0].actions[0].authenticate_oidc_config.issuer #=> String
resp.rules[0].actions[0].authenticate_oidc_config.authorization_endpoint #=> String
resp.rules[0].actions[0].authenticate_oidc_config.token_endpoint #=> String
resp.rules[0].actions[0].authenticate_oidc_config. #=> String
resp.rules[0].actions[0].authenticate_oidc_config.client_id #=> String
resp.rules[0].actions[0].authenticate_oidc_config.client_secret #=> String
resp.rules[0].actions[0].authenticate_oidc_config.session_cookie_name #=> String
resp.rules[0].actions[0].authenticate_oidc_config.scope #=> String
resp.rules[0].actions[0].authenticate_oidc_config.session_timeout #=> Integer
resp.rules[0].actions[0].authenticate_oidc_config.authentication_request_extra_params #=> Hash
resp.rules[0].actions[0].authenticate_oidc_config.authentication_request_extra_params["AuthenticateOidcActionAuthenticationRequestParamName"] #=> String
resp.rules[0].actions[0].authenticate_oidc_config.on_unauthenticated_request #=> String, one of "deny", "allow", "authenticate"
resp.rules[0].actions[0].authenticate_oidc_config.use_existing_client_secret #=> true/false
resp.rules[0].actions[0].authenticate_cognito_config.user_pool_arn #=> String
resp.rules[0].actions[0].authenticate_cognito_config.user_pool_client_id #=> String
resp.rules[0].actions[0].authenticate_cognito_config.user_pool_domain #=> String
resp.rules[0].actions[0].authenticate_cognito_config.session_cookie_name #=> String
resp.rules[0].actions[0].authenticate_cognito_config.scope #=> String
resp.rules[0].actions[0].authenticate_cognito_config.session_timeout #=> Integer
resp.rules[0].actions[0].authenticate_cognito_config.authentication_request_extra_params #=> Hash
resp.rules[0].actions[0].authenticate_cognito_config.authentication_request_extra_params["AuthenticateCognitoActionAuthenticationRequestParamName"] #=> String
resp.rules[0].actions[0].authenticate_cognito_config.on_unauthenticated_request #=> String, one of "deny", "allow", "authenticate"
resp.rules[0].actions[0].order #=> Integer
resp.rules[0].actions[0].redirect_config.protocol #=> String
resp.rules[0].actions[0].redirect_config.port #=> String
resp.rules[0].actions[0].redirect_config.host #=> String
resp.rules[0].actions[0].redirect_config.path #=> String
resp.rules[0].actions[0].redirect_config.query #=> String
resp.rules[0].actions[0].redirect_config.status_code #=> String, one of "HTTP_301", "HTTP_302"
resp.rules[0].actions[0].fixed_response_config.message_body #=> String
resp.rules[0].actions[0].fixed_response_config.status_code #=> String
resp.rules[0].actions[0].fixed_response_config.content_type #=> String
resp.rules[0].actions[0].forward_config.target_groups #=> Array
resp.rules[0].actions[0].forward_config.target_groups[0].target_group_arn #=> String
resp.rules[0].actions[0].forward_config.target_groups[0].weight #=> Integer
resp.rules[0].actions[0].forward_config.target_group_stickiness_config.enabled #=> true/false
resp.rules[0].actions[0].forward_config.target_group_stickiness_config.duration_seconds #=> Integer
resp.rules[0].is_default #=> true/false

Options Hash (options):

  • :rule_arn (required, String)

    The Amazon Resource Name (ARN) of the rule.

  • :conditions (Array<Types::RuleCondition>)

    The conditions.

  • :actions (Array<Types::Action>)

    The actions.

Returns:

See Also:

#modify_target_group(options = {}) ⇒ Types::ModifyTargetGroupOutput

Modifies the health checks used when evaluating the health state of the targets in the specified target group.

Examples:

Example: To modify the health check configuration for a target group


# This example changes the configuration of the health checks used to evaluate the health of the targets for the specified target group.

resp = client.modify_target_group({
  health_check_port: "443", 
  health_check_protocol: "HTTPS", 
  target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-https-targets/2453ed029918f21f", 
})

# resp.to_h outputs the following:
{
  target_groups: [
    {
      health_check_interval_seconds: 30, 
      health_check_port: "443", 
      health_check_protocol: "HTTPS", 
      health_check_timeout_seconds: 5, 
      healthy_threshold_count: 5, 
      load_balancer_arns: [
        "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
      ], 
      matcher: {
        http_code: "200", 
      }, 
      port: 443, 
      protocol: "HTTPS", 
      target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-https-targets/2453ed029918f21f", 
      target_group_name: "my-https-targets", 
      unhealthy_threshold_count: 2, 
      vpc_id: "vpc-3ac0fb5f", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.modify_target_group({
  target_group_arn: "TargetGroupArn", # required
  health_check_protocol: "HTTP", # accepts HTTP, HTTPS, TCP, TLS, UDP, TCP_UDP, GENEVE
  health_check_port: "HealthCheckPort",
  health_check_path: "Path",
  health_check_enabled: false,
  health_check_interval_seconds: 1,
  health_check_timeout_seconds: 1,
  healthy_threshold_count: 1,
  unhealthy_threshold_count: 1,
  matcher: {
    http_code: "HttpCode",
    grpc_code: "GrpcCode",
  },
})

Response structure


resp.target_groups #=> Array
resp.target_groups[0].target_group_arn #=> String
resp.target_groups[0].target_group_name #=> String
resp.target_groups[0].protocol #=> String, one of "HTTP", "HTTPS", "TCP", "TLS", "UDP", "TCP_UDP", "GENEVE"
resp.target_groups[0].port #=> Integer
resp.target_groups[0].vpc_id #=> String
resp.target_groups[0].health_check_protocol #=> String, one of "HTTP", "HTTPS", "TCP", "TLS", "UDP", "TCP_UDP", "GENEVE"
resp.target_groups[0].health_check_port #=> String
resp.target_groups[0].health_check_enabled #=> true/false
resp.target_groups[0].health_check_interval_seconds #=> Integer
resp.target_groups[0].health_check_timeout_seconds #=> Integer
resp.target_groups[0].healthy_threshold_count #=> Integer
resp.target_groups[0].unhealthy_threshold_count #=> Integer
resp.target_groups[0].health_check_path #=> String
resp.target_groups[0].matcher.http_code #=> String
resp.target_groups[0].matcher.grpc_code #=> String
resp.target_groups[0].load_balancer_arns #=> Array
resp.target_groups[0].load_balancer_arns[0] #=> String
resp.target_groups[0].target_type #=> String, one of "instance", "ip", "lambda"
resp.target_groups[0].protocol_version #=> String

Options Hash (options):

  • :target_group_arn (required, String)

    The Amazon Resource Name (ARN) of the target group.

  • :health_check_protocol (String)

    The protocol the load balancer uses when performing health checks on targets. The TCP protocol is supported for health checks only if the protocol of the target group is TCP, TLS, UDP, or TCP_UDP. The GENEVE, TLS, UDP, and TCP_UDP protocols are not supported for health checks.

    With Network Load Balancers, you can\'t modify this setting.

  • :health_check_port (String)

    The port the load balancer uses when performing health checks on targets.

  • :health_check_path (String)

    [HTTP/HTTPS health checks] The destination for health checks on the targets.

    [HTTP1 or HTTP2 protocol version] The ping path. The default is /.

    [GRPC protocol version] The path of a custom health check method with the format /package.service/method. The default is /AWS.ALB/healthcheck.

  • :health_check_enabled (Boolean)

    Indicates whether health checks are enabled.

  • :health_check_interval_seconds (Integer)

    The approximate amount of time, in seconds, between health checks of an individual target. For TCP health checks, the supported values are 10 or 30 seconds.

    With Network Load Balancers, you can\'t modify this setting.

  • :health_check_timeout_seconds (Integer)

    [HTTP/HTTPS health checks] The amount of time, in seconds, during which no response means a failed health check.

    With Network Load Balancers, you can\'t modify this setting.

  • :healthy_threshold_count (Integer)

    The number of consecutive health checks successes required before considering an unhealthy target healthy.

  • :unhealthy_threshold_count (Integer)

    The number of consecutive health check failures required before considering the target unhealthy. For target groups with a protocol of TCP or TLS, this value must be the same as the healthy threshold count.

  • :matcher (Types::Matcher)

    [HTTP/HTTPS health checks] The HTTP or gRPC codes to use when checking for a successful response from a target.

    With Network Load Balancers, you can\'t modify this setting.

Returns:

See Also:

#modify_target_group_attributes(options = {}) ⇒ Types::ModifyTargetGroupAttributesOutput

Modifies the specified attributes of the specified target group.

Examples:

Example: To modify the deregistration delay timeout


# This example sets the deregistration delay timeout to the specified value for the specified target group.

resp = client.modify_target_group_attributes({
  attributes: [
    {
      key: "deregistration_delay.timeout_seconds", 
      value: "600", 
    }, 
  ], 
  target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
})

# resp.to_h outputs the following:
{
  attributes: [
    {
      key: "stickiness.enabled", 
      value: "false", 
    }, 
    {
      key: "deregistration_delay.timeout_seconds", 
      value: "600", 
    }, 
    {
      key: "stickiness.type", 
      value: "lb_cookie", 
    }, 
    {
      key: "stickiness.lb_cookie.duration_seconds", 
      value: "86400", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.modify_target_group_attributes({
  target_group_arn: "TargetGroupArn", # required
  attributes: [ # required
    {
      key: "TargetGroupAttributeKey",
      value: "TargetGroupAttributeValue",
    },
  ],
})

Response structure


resp.attributes #=> Array
resp.attributes[0].key #=> String
resp.attributes[0].value #=> String

Options Hash (options):

  • :target_group_arn (required, String)

    The Amazon Resource Name (ARN) of the target group.

  • :attributes (required, Array<Types::TargetGroupAttribute>)

    The attributes.

Returns:

See Also:

#register_targets(options = {}) ⇒ Struct

Registers the specified targets with the specified target group.

If the target is an EC2 instance, it must be in the running state when you register it.

By default, the load balancer routes requests to registered targets using the protocol and port for the target group. Alternatively, you can override the port for a target when you register it. You can register each EC2 instance or IP address with the same target group multiple times using different ports.

With a Network Load Balancer, you cannot register instances by instance ID if they have the following instance types: C1, CC1, CC2, CG1, CG2, CR1, CS1, G1, G2, HI1, HS1, M1, M2, M3, and T1. You can register instances of these types by IP address.

Examples:

Example: To register targets with a target group


# This example registers the specified instances with the specified target group.

resp = client.register_targets({
  target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
  targets: [
    {
      id: "i-80c8dd94", 
    }, 
    {
      id: "i-ceddcd4d", 
    }, 
  ], 
})

Example: To register targets with a target group using port overrides


# This example registers the specified instance with the specified target group using multiple ports. This enables you to register ECS containers on the same instance as targets in the target group.

resp = client.register_targets({
  target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/3bb63f11dfb0faf9", 
  targets: [
    {
      id: "i-80c8dd94", 
      port: 80, 
    }, 
    {
      id: "i-80c8dd94", 
      port: 766, 
    }, 
  ], 
})

Request syntax with placeholder values


resp = client.register_targets({
  target_group_arn: "TargetGroupArn", # required
  targets: [ # required
    {
      id: "TargetId", # required
      port: 1,
      availability_zone: "ZoneName",
    },
  ],
})

Options Hash (options):

  • :target_group_arn (required, String)

    The Amazon Resource Name (ARN) of the target group.

  • :targets (required, Array<Types::TargetDescription>)

    The targets.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#remove_listener_certificates(options = {}) ⇒ Struct

Removes the specified certificate from the certificate list for the specified HTTPS or TLS listener.

Examples:

Request syntax with placeholder values


resp = client.remove_listener_certificates({
  listener_arn: "ListenerArn", # required
  certificates: [ # required
    {
      certificate_arn: "CertificateArn",
      is_default: false,
    },
  ],
})

Options Hash (options):

  • :listener_arn (required, String)

    The Amazon Resource Name (ARN) of the listener.

  • :certificates (required, Array<Types::Certificate>)

    The certificate to remove. You can specify one certificate per call. Set CertificateArn to the certificate ARN but do not set IsDefault.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#remove_tags(options = {}) ⇒ Struct

Removes the specified tags from the specified Elastic Load Balancing resources. You can remove the tags for one or more Application Load Balancers, Network Load Balancers, Gateway Load Balancers, target groups, listeners, or rules.

Examples:

Example: To remove tags from a load balancer


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

resp = client.remove_tags({
  resource_arns: [
    "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
  ], 
  tag_keys: [
    "project", 
    "department", 
  ], 
})

Request syntax with placeholder values


resp = client.remove_tags({
  resource_arns: ["ResourceArn"], # required
  tag_keys: ["TagKey"], # required
})

Options Hash (options):

  • :resource_arns (required, Array<String>)

    The Amazon Resource Name (ARN) of the resource.

  • :tag_keys (required, Array<String>)

    The tag keys for the tags to remove.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#set_ip_address_type(options = {}) ⇒ Types::SetIpAddressTypeOutput

Sets the type of IP addresses used by the subnets of the specified Application Load Balancer or Network Load Balancer.

Examples:

Request syntax with placeholder values


resp = client.set_ip_address_type({
  load_balancer_arn: "LoadBalancerArn", # required
  ip_address_type: "ipv4", # required, accepts ipv4, dualstack
})

Response structure


resp.ip_address_type #=> String, one of "ipv4", "dualstack"

Options Hash (options):

  • :load_balancer_arn (required, String)

    The Amazon Resource Name (ARN) of the load balancer.

  • :ip_address_type (required, String)

    The IP address type. The possible values are ipv4 (for IPv4 addresses) and dualstack (for IPv4 and IPv6 addresses). Internal load balancers must use ipv4. You can’t specify dualstack for a load balancer with a UDP or TCP_UDP listener.

Returns:

See Also:

#set_rule_priorities(options = {}) ⇒ Types::SetRulePrioritiesOutput

Sets the priorities of the specified rules.

You can reorder the rules as long as there are no priority conflicts in the new order. Any existing rules that you do not specify retain their current priority.

Examples:

Example: To set the rule priority


# This example sets the priority of the specified rule.

resp = client.set_rule_priorities({
  rule_priorities: [
    {
      priority: 5, 
      rule_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/1291d13826f405c3", 
    }, 
  ], 
})

# resp.to_h outputs the following:
{
  rules: [
    {
      actions: [
        {
          target_group_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
          type: "forward", 
        }, 
      ], 
      conditions: [
        {
          field: "path-pattern", 
          values: [
            "/img/*", 
          ], 
        }, 
      ], 
      is_default: false, 
      priority: "5", 
      rule_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/1291d13826f405c3", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.set_rule_priorities({
  rule_priorities: [ # required
    {
      rule_arn: "RuleArn",
      priority: 1,
    },
  ],
})

Response structure


resp.rules #=> Array
resp.rules[0].rule_arn #=> String
resp.rules[0].priority #=> String
resp.rules[0].conditions #=> Array
resp.rules[0].conditions[0].field #=> String
resp.rules[0].conditions[0].values #=> Array
resp.rules[0].conditions[0].values[0] #=> String
resp.rules[0].conditions[0].host_header_config.values #=> Array
resp.rules[0].conditions[0].host_header_config.values[0] #=> String
resp.rules[0].conditions[0].path_pattern_config.values #=> Array
resp.rules[0].conditions[0].path_pattern_config.values[0] #=> String
resp.rules[0].conditions[0].http_header_config.http_header_name #=> String
resp.rules[0].conditions[0].http_header_config.values #=> Array
resp.rules[0].conditions[0].http_header_config.values[0] #=> String
resp.rules[0].conditions[0].query_string_config.values #=> Array
resp.rules[0].conditions[0].query_string_config.values[0].key #=> String
resp.rules[0].conditions[0].query_string_config.values[0].value #=> String
resp.rules[0].conditions[0].http_request_method_config.values #=> Array
resp.rules[0].conditions[0].http_request_method_config.values[0] #=> String
resp.rules[0].conditions[0].source_ip_config.values #=> Array
resp.rules[0].conditions[0].source_ip_config.values[0] #=> String
resp.rules[0].actions #=> Array
resp.rules[0].actions[0].type #=> String, one of "forward", "authenticate-oidc", "authenticate-cognito", "redirect", "fixed-response"
resp.rules[0].actions[0].target_group_arn #=> String
resp.rules[0].actions[0].authenticate_oidc_config.issuer #=> String
resp.rules[0].actions[0].authenticate_oidc_config.authorization_endpoint #=> String
resp.rules[0].actions[0].authenticate_oidc_config.token_endpoint #=> String
resp.rules[0].actions[0].authenticate_oidc_config. #=> String
resp.rules[0].actions[0].authenticate_oidc_config.client_id #=> String
resp.rules[0].actions[0].authenticate_oidc_config.client_secret #=> String
resp.rules[0].actions[0].authenticate_oidc_config.session_cookie_name #=> String
resp.rules[0].actions[0].authenticate_oidc_config.scope #=> String
resp.rules[0].actions[0].authenticate_oidc_config.session_timeout #=> Integer
resp.rules[0].actions[0].authenticate_oidc_config.authentication_request_extra_params #=> Hash
resp.rules[0].actions[0].authenticate_oidc_config.authentication_request_extra_params["AuthenticateOidcActionAuthenticationRequestParamName"] #=> String
resp.rules[0].actions[0].authenticate_oidc_config.on_unauthenticated_request #=> String, one of "deny", "allow", "authenticate"
resp.rules[0].actions[0].authenticate_oidc_config.use_existing_client_secret #=> true/false
resp.rules[0].actions[0].authenticate_cognito_config.user_pool_arn #=> String
resp.rules[0].actions[0].authenticate_cognito_config.user_pool_client_id #=> String
resp.rules[0].actions[0].authenticate_cognito_config.user_pool_domain #=> String
resp.rules[0].actions[0].authenticate_cognito_config.session_cookie_name #=> String
resp.rules[0].actions[0].authenticate_cognito_config.scope #=> String
resp.rules[0].actions[0].authenticate_cognito_config.session_timeout #=> Integer
resp.rules[0].actions[0].authenticate_cognito_config.authentication_request_extra_params #=> Hash
resp.rules[0].actions[0].authenticate_cognito_config.authentication_request_extra_params["AuthenticateCognitoActionAuthenticationRequestParamName"] #=> String
resp.rules[0].actions[0].authenticate_cognito_config.on_unauthenticated_request #=> String, one of "deny", "allow", "authenticate"
resp.rules[0].actions[0].order #=> Integer
resp.rules[0].actions[0].redirect_config.protocol #=> String
resp.rules[0].actions[0].redirect_config.port #=> String
resp.rules[0].actions[0].redirect_config.host #=> String
resp.rules[0].actions[0].redirect_config.path #=> String
resp.rules[0].actions[0].redirect_config.query #=> String
resp.rules[0].actions[0].redirect_config.status_code #=> String, one of "HTTP_301", "HTTP_302"
resp.rules[0].actions[0].fixed_response_config.message_body #=> String
resp.rules[0].actions[0].fixed_response_config.status_code #=> String
resp.rules[0].actions[0].fixed_response_config.content_type #=> String
resp.rules[0].actions[0].forward_config.target_groups #=> Array
resp.rules[0].actions[0].forward_config.target_groups[0].target_group_arn #=> String
resp.rules[0].actions[0].forward_config.target_groups[0].weight #=> Integer
resp.rules[0].actions[0].forward_config.target_group_stickiness_config.enabled #=> true/false
resp.rules[0].actions[0].forward_config.target_group_stickiness_config.duration_seconds #=> Integer
resp.rules[0].is_default #=> true/false

Options Hash (options):

Returns:

See Also:

#set_security_groups(options = {}) ⇒ Types::SetSecurityGroupsOutput

Associates the specified security groups with the specified Application Load Balancer. The specified security groups override the previously associated security groups.

You can't specify a security group for a Network Load Balancer or Gateway Load Balancer.

Examples:

Example: To associate a security group with a load balancer


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

resp = client.set_security_groups({
  load_balancer_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
  security_groups: [
    "sg-5943793c", 
  ], 
})

# resp.to_h outputs the following:
{
  security_group_ids: [
    "sg-5943793c", 
  ], 
}

Request syntax with placeholder values


resp = client.set_security_groups({
  load_balancer_arn: "LoadBalancerArn", # required
  security_groups: ["SecurityGroupId"], # required
})

Response structure


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

Options Hash (options):

  • :load_balancer_arn (required, String)

    The Amazon Resource Name (ARN) of the load balancer.

  • :security_groups (required, Array<String>)

    The IDs of the security groups.

Returns:

See Also:

#set_subnets(options = {}) ⇒ Types::SetSubnetsOutput

Enables the Availability Zones for the specified public subnets for the specified Application Load Balancer or Network Load Balancer. The specified subnets replace the previously enabled subnets.

When you specify subnets for a Network Load Balancer, you must include all subnets that were enabled previously, with their existing configurations, plus any additional subnets.

Examples:

Example: To enable Availability Zones for a load balancer


# This example enables the Availability Zones for the specified subnets for the specified load balancer.

resp = client.set_subnets({
  load_balancer_arn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
  subnets: [
    "subnet-8360a9e7", 
    "subnet-b7d581c0", 
  ], 
})

# resp.to_h outputs the following:
{
  availability_zones: [
    {
      subnet_id: "subnet-8360a9e7", 
      zone_name: "us-west-2a", 
    }, 
    {
      subnet_id: "subnet-b7d581c0", 
      zone_name: "us-west-2b", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.set_subnets({
  load_balancer_arn: "LoadBalancerArn", # required
  subnets: ["SubnetId"],
  subnet_mappings: [
    {
      subnet_id: "SubnetId",
      allocation_id: "AllocationId",
      private_i_pv_4_address: "PrivateIPv4Address",
      i_pv_6_address: "IPv6Address",
    },
  ],
  ip_address_type: "ipv4", # accepts ipv4, dualstack
})

Response structure


resp.availability_zones #=> Array
resp.availability_zones[0].zone_name #=> String
resp.availability_zones[0].subnet_id #=> String
resp.availability_zones[0].outpost_id #=> String
resp.availability_zones[0].load_balancer_addresses #=> Array
resp.availability_zones[0].load_balancer_addresses[0].ip_address #=> String
resp.availability_zones[0].load_balancer_addresses[0].allocation_id #=> String
resp.availability_zones[0].load_balancer_addresses[0].private_i_pv_4_address #=> String
resp.availability_zones[0].load_balancer_addresses[0].i_pv_6_address #=> String
resp.ip_address_type #=> String, one of "ipv4", "dualstack"

Options Hash (options):

  • :load_balancer_arn (required, String)

    The Amazon Resource Name (ARN) of the load balancer.

  • :subnets (Array<String>)

    The IDs of the public subnets. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings.

    [Application Load Balancers] You must specify subnets from at least two Availability Zones.

    [Application Load Balancers on Outposts] You must specify one Outpost subnet.

    [Application Load Balancers on Local Zones] You can specify subnets from one or more Local Zones.

    [Network Load Balancers] You can specify subnets from one or more Availability Zones.

  • :subnet_mappings (Array<Types::SubnetMapping>)

    The IDs of the public subnets. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings.

    [Application Load Balancers] You must specify subnets from at least two Availability Zones. You cannot specify Elastic IP addresses for your subnets.

    [Application Load Balancers on Outposts] You must specify one Outpost subnet.

    [Application Load Balancers on Local Zones] You can specify subnets from one or more Local Zones.

    [Network Load Balancers] You can specify subnets from one or more Availability Zones. You can specify one Elastic IP address per subnet if you need static IP addresses for your internet-facing load balancer. For internal load balancers, you can specify one private IP address per subnet from the IPv4 range of the subnet. For internet-facing load balancer, you can specify one IPv6 address per subnet.

  • :ip_address_type (String)

    [Network Load Balancers] The type of IP addresses used by the subnets for your load balancer. The possible values are ipv4 (for IPv4 addresses) and dualstack (for IPv4 and IPv6 addresses). You can’t specify dualstack for a load balancer with a UDP or TCP_UDP listener. Internal load balancers must use ipv4.

Returns:

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:
:load_balancer_available#describe_load_balancers1540
:load_balancer_exists#describe_load_balancers1540
:load_balancers_deleted#describe_load_balancers1540
:target_deregistered#describe_target_health1540
:target_in_service#describe_target_health1540

Returns:

  • (Array<Symbol>)

    the list of supported waiters.