You are viewing the documentation for an older major version of the AWS SDK for JavaScript.
The modular AWS SDK for JavaScript (v3), the latest major version of AWS SDK for JavaScript, is now stable and recommended for general use. For more information, see the Migration Guide and API Reference.

Class: AWS.ELBv2

Inherits:
AWS.Service show all
Identifier:
elbv2
API Version:
2015-12-01
Defined in:
(unknown)

Overview

Constructs a service interface object. Each API operation is exposed as a function on service.

Service Description

A load balancer distributes incoming traffic across targets, such as your EC2 instances. This enables you to increase the availability of your application. The load balancer also monitors the health of its registered targets and ensures that it routes traffic only to healthy targets. You configure your load balancer to accept incoming traffic by specifying one or more listeners, which are configured with a protocol and port number for connections from clients to the load balancer. You configure a target group with a protocol and port number for connections from the load balancer to the targets, and with health check settings to be used when checking the health status of the targets.

Elastic Load Balancing supports the following types of load balancers: Application Load Balancers, Network Load Balancers, Gateway Load Balancers, and Classic Load Balancers. This reference covers the following load balancer types:

  • Application Load Balancer - Operates at the application layer (layer 7) and supports HTTP and HTTPS.

  • Network Load Balancer - Operates at the transport layer (layer 4) and supports TCP, TLS, and UDP.

  • Gateway Load Balancer - Operates at the network layer (layer 3).

For more information, see the Elastic Load Balancing User Guide.

All Elastic Load Balancing operations are idempotent, which means that they complete at most one time. If you repeat an operation, it succeeds.

Sending a Request Using ELBv2

var elbv2 = new AWS.ELBv2();
elbv2.createTargetGroup(params, function (err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Locking the API Version

In order to ensure that the ELBv2 object uses this specific API, you can construct the object by passing the apiVersion option to the constructor:

var elbv2 = new AWS.ELBv2({apiVersion: '2015-12-01'});

You can also set the API version globally in AWS.config.apiVersions using the elbv2 service identifier:

AWS.config.apiVersions = {
  elbv2: '2015-12-01',
  // other service API versions
};

var elbv2 = new AWS.ELBv2();

Version:

  • 2015-12-01

Waiter Resource States

This service supports a list of resource states that can be polled using the waitFor() method. The resource states are:

loadBalancerExists, loadBalancerAvailable, loadBalancersDeleted, targetInService, targetDeregistered

Constructor Summary collapse

Property Summary collapse

Properties inherited from AWS.Service

apiVersions

Method Summary collapse

Methods inherited from AWS.Service

makeRequest, makeUnauthenticatedRequest, setupRequestListeners, defineService

Constructor Details

new AWS.ELBv2(options = {}) ⇒ Object

Constructs a service object. This object has one method for each API operation.

Examples:

Constructing a ELBv2 object

var elbv2 = new AWS.ELBv2({apiVersion: '2015-12-01'});

Options Hash (options):

  • params (map)

    An optional map of parameters to bind to every request sent by this service object. For more information on bound parameters, see "Working with Services" in the Getting Started Guide.

  • endpoint (String|AWS.Endpoint)

    The endpoint URI to send requests to. The default endpoint is built from the configured region. The endpoint should be a string like 'https://{service}.{region}.amazonaws.com' or an Endpoint object.

  • accessKeyId (String)

    your AWS access key ID.

  • secretAccessKey (String)

    your AWS secret access key.

  • sessionToken (AWS.Credentials)

    the optional AWS session token to sign requests with.

  • credentials (AWS.Credentials)

    the AWS credentials to sign requests with. You can either specify this object, or specify the accessKeyId and secretAccessKey options directly.

  • credentialProvider (AWS.CredentialProviderChain)

    the provider chain used to resolve credentials if no static credentials property is set.

  • region (String)

    the region to send service requests to. See AWS.ELBv2.region for more information.

  • maxRetries (Integer)

    the maximum amount of retries to attempt with a request. See AWS.ELBv2.maxRetries for more information.

  • maxRedirects (Integer)

    the maximum amount of redirects to follow with a request. See AWS.ELBv2.maxRedirects for more information.

  • sslEnabled (Boolean)

    whether to enable SSL for requests.

  • paramValidation (Boolean|map)

    whether input parameters should be validated against the operation description before sending the request. Defaults to true. Pass a map to enable any of the following specific validation features:

    • min [Boolean] — Validates that a value meets the min constraint. This is enabled by default when paramValidation is set to true.
    • max [Boolean] — Validates that a value meets the max constraint.
    • pattern [Boolean] — Validates that a string value matches a regular expression.
    • enum [Boolean] — Validates that a string value matches one of the allowable enum values.
  • computeChecksums (Boolean)

    whether to compute checksums for payload bodies when the service accepts it (currently supported in S3 only)

  • convertResponseTypes (Boolean)

    whether types are converted when parsing response data. Currently only supported for JSON based services. Turning this off may improve performance on large response payloads. Defaults to true.

  • correctClockSkew (Boolean)

    whether to apply a clock skew correction and retry requests that fail because of an skewed client clock. Defaults to false.

  • s3ForcePathStyle (Boolean)

    whether to force path style URLs for S3 objects.

  • s3BucketEndpoint (Boolean)

    whether the provided endpoint addresses an individual bucket (false if it addresses the root API endpoint). Note that setting this configuration option requires an endpoint to be provided explicitly to the service constructor.

  • s3DisableBodySigning (Boolean)

    whether S3 body signing should be disabled when using signature version v4. Body signing can only be disabled when using https. Defaults to true.

  • s3UsEast1RegionalEndpoint ('legacy'|'regional')

    when region is set to 'us-east-1', whether to send s3 request to global endpoints or 'us-east-1' regional endpoints. This config is only applicable to S3 client. Defaults to legacy

  • s3UseArnRegion (Boolean)

    whether to override the request region with the region inferred from requested resource's ARN. Only available for S3 buckets Defaults to true

  • retryDelayOptions (map)

    A set of options to configure the retry delay on retryable errors. Currently supported options are:

    • base [Integer] — The base number of milliseconds to use in the exponential backoff for operation retries. Defaults to 100 ms for all services except DynamoDB, where it defaults to 50ms.
    • customBackoff [function] — A custom function that accepts a retry count and error and returns the amount of time to delay in milliseconds. If the result is a non-zero negative value, no further retry attempts will be made. The base option will be ignored if this option is supplied. The function is only called for retryable errors.
  • httpOptions (map)

    A set of options to pass to the low-level HTTP request. Currently supported options are:

    • proxy [String] — the URL to proxy requests through
    • agent [http.Agent, https.Agent] — the Agent object to perform HTTP requests with. Used for connection pooling. Defaults to the global agent (http.globalAgent) for non-SSL connections. Note that for SSL connections, a special Agent object is used in order to enable peer certificate verification. This feature is only available in the Node.js environment.
    • connectTimeout [Integer] — Sets the socket to timeout after failing to establish a connection with the server after connectTimeout milliseconds. This timeout has no effect once a socket connection has been established.
    • timeout [Integer] — Sets the socket to timeout after timeout milliseconds of inactivity on the socket. Defaults to two minutes (120000).
    • xhrAsync [Boolean] — Whether the SDK will send asynchronous HTTP requests. Used in the browser environment only. Set to false to send requests synchronously. Defaults to true (async on).
    • xhrWithCredentials [Boolean] — Sets the "withCredentials" property of an XMLHttpRequest object. Used in the browser environment only. Defaults to false.
  • apiVersion (String, Date)

    a String in YYYY-MM-DD format (or a date) that represents the latest possible API version that can be used in all services (unless overridden by apiVersions). Specify 'latest' to use the latest possible version.

  • apiVersions (map<String, String|Date>)

    a map of service identifiers (the lowercase service class name) with the API version to use when instantiating a service. Specify 'latest' for each individual that can use the latest available version.

  • logger (#write, #log)

    an object that responds to .write() (like a stream) or .log() (like the console object) in order to log information about requests

  • systemClockOffset (Number)

    an offset value in milliseconds to apply to all signing times. Use this to compensate for clock skew when your system may be out of sync with the service time. Note that this configuration option can only be applied to the global AWS.config object and cannot be overridden in service-specific configuration. Defaults to 0 milliseconds.

  • signatureVersion (String)

    the signature version to sign requests with (overriding the API configuration). Possible values are: 'v2', 'v3', 'v4'.

  • signatureCache (Boolean)

    whether the signature to sign requests with (overriding the API configuration) is cached. Only applies to the signature version 'v4'. Defaults to true.

  • dynamoDbCrc32 (Boolean)

    whether to validate the CRC32 checksum of HTTP response bodies returned by DynamoDB. Default: true.

  • useAccelerateEndpoint (Boolean)

    Whether to use the S3 Transfer Acceleration endpoint with the S3 service. Default: false.

  • clientSideMonitoring (Boolean)

    whether to collect and publish this client's performance metrics of all its API requests.

  • endpointDiscoveryEnabled (Boolean|undefined)

    whether to call operations with endpoints given by service dynamically. Setting this

  • endpointCacheSize (Number)

    the size of the global cache storing endpoints from endpoint discovery operations. Once endpoint cache is created, updating this setting cannot change existing cache size. Defaults to 1000

  • hostPrefixEnabled (Boolean)

    whether to marshal request parameters to the prefix of hostname. Defaults to true.

  • stsRegionalEndpoints ('legacy'|'regional')

    whether to send sts request to global endpoints or regional endpoints. Defaults to 'legacy'.

Property Details

endpointAWS.Endpoint (readwrite)

Returns an Endpoint object representing the endpoint URL for service requests.

Returns:

  • (AWS.Endpoint)

    an Endpoint object representing the endpoint URL for service requests.

Method Details

addListenerCertificates(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the addListenerCertificates operation

var params = {
  Certificates: [ /* required */
    {
      CertificateArn: 'STRING_VALUE',
      IsDefault: true || false
    },
    /* more items */
  ],
  ListenerArn: 'STRING_VALUE' /* required */
};
elbv2.addListenerCertificates(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ListenerArn — (String)

      The Amazon Resource Name (ARN) of the listener.

    • Certificates — (Array<map>)

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

      • CertificateArn — (String)

        The Amazon Resource Name (ARN) of the certificate.

      • IsDefault — (Boolean)

        Indicates whether the certificate is the default certificate. Do not set this value when specifying a certificate as an input. This value is not included in the output when describing a listener, but is included when describing listener certificates.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Certificates — (Array<map>)

        Information about the certificates in the certificate list.

        • CertificateArn — (String)

          The Amazon Resource Name (ARN) of the certificate.

        • IsDefault — (Boolean)

          Indicates whether the certificate is the default certificate. Do not set this value when specifying a certificate as an input. This value is not included in the output when describing a listener, but is included when describing listener certificates.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

addTags(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

To add tags to a load balancer


/* This example adds the specified tags to the specified load balancer. */

 var params = {
  ResourceArns: [
     "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"
  ], 
  Tags: [
     {
    Key: "project", 
    Value: "lima"
   }, 
     {
    Key: "department", 
    Value: "digital-media"
   }
  ]
 };
 elbv2.addTags(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
   }
   */
 });

Calling the addTags operation

var params = {
  ResourceArns: [ /* required */
    'STRING_VALUE',
    /* more items */
  ],
  Tags: [ /* required */
    {
      Key: 'STRING_VALUE', /* required */
      Value: 'STRING_VALUE'
    },
    /* more items */
  ]
};
elbv2.addTags(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ResourceArns — (Array<String>)

      The Amazon Resource Name (ARN) of the resource.

    • Tags — (Array<map>)

      The tags.

      • Keyrequired — (String)

        The key of the tag.

      • Value — (String)

        The value of the tag.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

createListener(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

To create an HTTP listener


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

 var params = {
  DefaultActions: [
     {
    TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
    Type: "forward"
   }
  ], 
  LoadBalancerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
  Port: 80, 
  Protocol: "HTTP"
 };
 elbv2.createListener(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    Listeners: [
       {
      DefaultActions: [
         {
        TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
        Type: "forward"
       }
      ], 
      ListenerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2", 
      LoadBalancerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
      Port: 80, 
      Protocol: "HTTP"
     }
    ]
   }
   */
 });

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

 var params = {
  Certificates: [
     {
    CertificateArn: "arn:aws:iam::123456789012:server-certificate/my-server-cert"
   }
  ], 
  DefaultActions: [
     {
    TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
    Type: "forward"
   }
  ], 
  LoadBalancerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
  Port: 443, 
  Protocol: "HTTPS", 
  SslPolicy: "ELBSecurityPolicy-2015-05"
 };
 elbv2.createListener(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    Listeners: [
       {
      Certificates: [
         {
        CertificateArn: "arn:aws:iam::123456789012:server-certificate/my-server-cert"
       }
      ], 
      DefaultActions: [
         {
        TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
        Type: "forward"
       }
      ], 
      ListenerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2", 
      LoadBalancerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
      Port: 443, 
      Protocol: "HTTPS", 
      SslPolicy: "ELBSecurityPolicy-2015-05"
     }
    ]
   }
   */
 });

Calling the createListener operation

var params = {
  DefaultActions: [ /* required */
    {
      Type: forward | authenticate-oidc | authenticate-cognito | redirect | fixed-response, /* required */
      AuthenticateCognitoConfig: {
        UserPoolArn: 'STRING_VALUE', /* required */
        UserPoolClientId: 'STRING_VALUE', /* required */
        UserPoolDomain: 'STRING_VALUE', /* required */
        AuthenticationRequestExtraParams: {
          '<AuthenticateCognitoActionAuthenticationRequestParamName>': 'STRING_VALUE',
          /* '<AuthenticateCognitoActionAuthenticationRequestParamName>': ... */
        },
        OnUnauthenticatedRequest: deny | allow | authenticate,
        Scope: 'STRING_VALUE',
        SessionCookieName: 'STRING_VALUE',
        SessionTimeout: 'NUMBER_VALUE'
      },
      AuthenticateOidcConfig: {
        AuthorizationEndpoint: 'STRING_VALUE', /* required */
        ClientId: 'STRING_VALUE', /* required */
        Issuer: 'STRING_VALUE', /* required */
        TokenEndpoint: 'STRING_VALUE', /* required */
        UserInfoEndpoint: 'STRING_VALUE', /* required */
        AuthenticationRequestExtraParams: {
          '<AuthenticateOidcActionAuthenticationRequestParamName>': 'STRING_VALUE',
          /* '<AuthenticateOidcActionAuthenticationRequestParamName>': ... */
        },
        ClientSecret: 'STRING_VALUE',
        OnUnauthenticatedRequest: deny | allow | authenticate,
        Scope: 'STRING_VALUE',
        SessionCookieName: 'STRING_VALUE',
        SessionTimeout: 'NUMBER_VALUE',
        UseExistingClientSecret: true || false
      },
      FixedResponseConfig: {
        StatusCode: 'STRING_VALUE', /* required */
        ContentType: 'STRING_VALUE',
        MessageBody: 'STRING_VALUE'
      },
      ForwardConfig: {
        TargetGroupStickinessConfig: {
          DurationSeconds: 'NUMBER_VALUE',
          Enabled: true || false
        },
        TargetGroups: [
          {
            TargetGroupArn: 'STRING_VALUE',
            Weight: 'NUMBER_VALUE'
          },
          /* more items */
        ]
      },
      Order: 'NUMBER_VALUE',
      RedirectConfig: {
        StatusCode: HTTP_301 | HTTP_302, /* required */
        Host: 'STRING_VALUE',
        Path: 'STRING_VALUE',
        Port: 'STRING_VALUE',
        Protocol: 'STRING_VALUE',
        Query: 'STRING_VALUE'
      },
      TargetGroupArn: 'STRING_VALUE'
    },
    /* more items */
  ],
  LoadBalancerArn: 'STRING_VALUE', /* required */
  AlpnPolicy: [
    'STRING_VALUE',
    /* more items */
  ],
  Certificates: [
    {
      CertificateArn: 'STRING_VALUE',
      IsDefault: true || false
    },
    /* more items */
  ],
  Port: 'NUMBER_VALUE',
  Protocol: HTTP | HTTPS | TCP | TLS | UDP | TCP_UDP | GENEVE,
  SslPolicy: 'STRING_VALUE',
  Tags: [
    {
      Key: 'STRING_VALUE', /* required */
      Value: 'STRING_VALUE'
    },
    /* more items */
  ]
};
elbv2.createListener(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • LoadBalancerArn — (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.

      Possible values include:
      • "HTTP"
      • "HTTPS"
      • "TCP"
      • "TLS"
      • "UDP"
      • "TCP_UDP"
      • "GENEVE"
    • Port — (Integer)

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

    • SslPolicy — (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<map>)

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

      • CertificateArn — (String)

        The Amazon Resource Name (ARN) of the certificate.

      • IsDefault — (Boolean)

        Indicates whether the certificate is the default certificate. Do not set this value when specifying a certificate as an input. This value is not included in the output when describing a listener, but is included when describing listener certificates.

    • DefaultActions — (Array<map>)

      The actions for the default rule.

      • Typerequired — (String)

        The type of action.

        Possible values include:
        • "forward"
        • "authenticate-oidc"
        • "authenticate-cognito"
        • "redirect"
        • "fixed-response"
      • TargetGroupArn — (String)

        The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward and you want to route to a single target group. To route to one or more target groups, use ForwardConfig instead.

      • AuthenticateOidcConfig — (map)

        [HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc.

        • Issuerrequired — (String)

          The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

        • AuthorizationEndpointrequired — (String)

          The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

        • TokenEndpointrequired — (String)

          The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

        • UserInfoEndpointrequired — (String)

          The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

        • ClientIdrequired — (String)

          The OAuth 2.0 client identifier.

        • ClientSecret — (String)

          The OAuth 2.0 client secret. This parameter is required if you are creating a rule. If you are modifying a rule, you can omit this parameter if you set UseExistingClientSecret to true.

        • SessionCookieName — (String)

          The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.

        • Scope — (String)

          The set of user claims to be requested from the IdP. The default is openid.

          To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.

        • SessionTimeout — (Integer)

          The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).

        • AuthenticationRequestExtraParams — (map<String>)

          The query parameters (up to 10) to include in the redirect request to the authorization endpoint.

        • OnUnauthenticatedRequest — (String)

          The behavior if the user is not authenticated. The following are possible values:

          • deny - Return an HTTP 401 Unauthorized error.

          • allow - Allow the request to be forwarded to the target.

          • authenticate - Redirect the request to the IdP authorization endpoint. This is the default value.

          Possible values include:
          • "deny"
          • "allow"
          • "authenticate"
        • UseExistingClientSecret — (Boolean)

          Indicates whether to use the existing client secret when modifying a rule. If you are creating a rule, you can omit this parameter or set it to false.

      • AuthenticateCognitoConfig — (map)

        [HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only when Type is authenticate-cognito.

        • UserPoolArnrequired — (String)

          The Amazon Resource Name (ARN) of the Amazon Cognito user pool.

        • UserPoolClientIdrequired — (String)

          The ID of the Amazon Cognito user pool client.

        • UserPoolDomainrequired — (String)

          The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.

        • SessionCookieName — (String)

          The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.

        • Scope — (String)

          The set of user claims to be requested from the IdP. The default is openid.

          To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.

        • SessionTimeout — (Integer)

          The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).

        • AuthenticationRequestExtraParams — (map<String>)

          The query parameters (up to 10) to include in the redirect request to the authorization endpoint.

        • OnUnauthenticatedRequest — (String)

          The behavior if the user is not authenticated. The following are possible values:

          • deny - Return an HTTP 401 Unauthorized error.

          • allow - Allow the request to be forwarded to the target.

          • authenticate - Redirect the request to the IdP authorization endpoint. This is the default value.

          Possible values include:
          • "deny"
          • "allow"
          • "authenticate"
      • Order — (Integer)

        The order for the action. This value is required for rules with multiple actions. The action with the lowest value for order is performed first.

      • RedirectConfig — (map)

        [Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect.

        • Protocol — (String)

          The protocol. You can specify HTTP, HTTPS, or #{protocol}. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You cannot redirect HTTPS to HTTP.

        • Port — (String)

          The port. You can specify a value from 1 to 65535 or #{port}.

        • Host — (String)

          The hostname. This component is not percent-encoded. The hostname can contain #{host}.

        • Path — (String)

          The absolute path, starting with the leading "/". This component is not percent-encoded. The path can contain #{host}, #{path}, and #{port}.

        • Query — (String)

          The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.

        • StatusCoderequired — (String)

          The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).

          Possible values include:
          • "HTTP_301"
          • "HTTP_302"
      • FixedResponseConfig — (map)

        [Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only when Type is fixed-response.

        • MessageBody — (String)

          The message.

        • StatusCoderequired — (String)

          The HTTP response code (2XX, 4XX, or 5XX).

        • ContentType — (String)

          The content type.

          Valid Values: text/plain | text/css | text/html | application/javascript | application/json

      • ForwardConfig — (map)

        Information for creating an action that distributes requests among one or more target groups. For Network Load Balancers, you can specify a single target group. Specify only when Type is forward. If you specify both ForwardConfig and TargetGroupArn, you can specify only one target group using ForwardConfig and it must be the same target group specified in TargetGroupArn.

        • TargetGroups — (Array<map>)

          One or more target groups. For Network Load Balancers, you can specify a single target group.

          • TargetGroupArn — (String)

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

          • Weight — (Integer)

            The weight. The range is 0 to 999.

        • TargetGroupStickinessConfig — (map)

          The target group stickiness for the rule.

          • Enabled — (Boolean)

            Indicates whether target group stickiness is enabled.

          • DurationSeconds — (Integer)

            The time period, in seconds, during which requests from a client should be routed to the same target group. The range is 1-604800 seconds (7 days).

    • AlpnPolicy — (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<map>)

      The tags to assign to the listener.

      • Keyrequired — (String)

        The key of the tag.

      • Value — (String)

        The value of the tag.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Listeners — (Array<map>)

        Information about the listener.

        • ListenerArn — (String)

          The Amazon Resource Name (ARN) of the listener.

        • LoadBalancerArn — (String)

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

        • Port — (Integer)

          The port on which the load balancer is listening.

        • Protocol — (String)

          The protocol for connections from clients to the load balancer.

          Possible values include:
          • "HTTP"
          • "HTTPS"
          • "TCP"
          • "TLS"
          • "UDP"
          • "TCP_UDP"
          • "GENEVE"
        • Certificates — (Array<map>)

          [HTTPS or TLS listener] The default certificate for the listener.

          • CertificateArn — (String)

            The Amazon Resource Name (ARN) of the certificate.

          • IsDefault — (Boolean)

            Indicates whether the certificate is the default certificate. Do not set this value when specifying a certificate as an input. This value is not included in the output when describing a listener, but is included when describing listener certificates.

        • SslPolicy — (String)

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

        • DefaultActions — (Array<map>)

          The default actions for the listener.

          • Typerequired — (String)

            The type of action.

            Possible values include:
            • "forward"
            • "authenticate-oidc"
            • "authenticate-cognito"
            • "redirect"
            • "fixed-response"
          • TargetGroupArn — (String)

            The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward and you want to route to a single target group. To route to one or more target groups, use ForwardConfig instead.

          • AuthenticateOidcConfig — (map)

            [HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc.

            • Issuerrequired — (String)

              The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • AuthorizationEndpointrequired — (String)

              The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • TokenEndpointrequired — (String)

              The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • UserInfoEndpointrequired — (String)

              The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • ClientIdrequired — (String)

              The OAuth 2.0 client identifier.

            • ClientSecret — (String)

              The OAuth 2.0 client secret. This parameter is required if you are creating a rule. If you are modifying a rule, you can omit this parameter if you set UseExistingClientSecret to true.

            • SessionCookieName — (String)

              The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.

            • Scope — (String)

              The set of user claims to be requested from the IdP. The default is openid.

              To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.

            • SessionTimeout — (Integer)

              The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).

            • AuthenticationRequestExtraParams — (map<String>)

              The query parameters (up to 10) to include in the redirect request to the authorization endpoint.

            • OnUnauthenticatedRequest — (String)

              The behavior if the user is not authenticated. The following are possible values:

              • deny - Return an HTTP 401 Unauthorized error.

              • allow - Allow the request to be forwarded to the target.

              • authenticate - Redirect the request to the IdP authorization endpoint. This is the default value.

              Possible values include:
              • "deny"
              • "allow"
              • "authenticate"
            • UseExistingClientSecret — (Boolean)

              Indicates whether to use the existing client secret when modifying a rule. If you are creating a rule, you can omit this parameter or set it to false.

          • AuthenticateCognitoConfig — (map)

            [HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only when Type is authenticate-cognito.

            • UserPoolArnrequired — (String)

              The Amazon Resource Name (ARN) of the Amazon Cognito user pool.

            • UserPoolClientIdrequired — (String)

              The ID of the Amazon Cognito user pool client.

            • UserPoolDomainrequired — (String)

              The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.

            • SessionCookieName — (String)

              The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.

            • Scope — (String)

              The set of user claims to be requested from the IdP. The default is openid.

              To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.

            • SessionTimeout — (Integer)

              The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).

            • AuthenticationRequestExtraParams — (map<String>)

              The query parameters (up to 10) to include in the redirect request to the authorization endpoint.

            • OnUnauthenticatedRequest — (String)

              The behavior if the user is not authenticated. The following are possible values:

              • deny - Return an HTTP 401 Unauthorized error.

              • allow - Allow the request to be forwarded to the target.

              • authenticate - Redirect the request to the IdP authorization endpoint. This is the default value.

              Possible values include:
              • "deny"
              • "allow"
              • "authenticate"
          • Order — (Integer)

            The order for the action. This value is required for rules with multiple actions. The action with the lowest value for order is performed first.

          • RedirectConfig — (map)

            [Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect.

            • Protocol — (String)

              The protocol. You can specify HTTP, HTTPS, or #{protocol}. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You cannot redirect HTTPS to HTTP.

            • Port — (String)

              The port. You can specify a value from 1 to 65535 or #{port}.

            • Host — (String)

              The hostname. This component is not percent-encoded. The hostname can contain #{host}.

            • Path — (String)

              The absolute path, starting with the leading "/". This component is not percent-encoded. The path can contain #{host}, #{path}, and #{port}.

            • Query — (String)

              The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.

            • StatusCoderequired — (String)

              The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).

              Possible values include:
              • "HTTP_301"
              • "HTTP_302"
          • FixedResponseConfig — (map)

            [Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only when Type is fixed-response.

            • MessageBody — (String)

              The message.

            • StatusCoderequired — (String)

              The HTTP response code (2XX, 4XX, or 5XX).

            • ContentType — (String)

              The content type.

              Valid Values: text/plain | text/css | text/html | application/javascript | application/json

          • ForwardConfig — (map)

            Information for creating an action that distributes requests among one or more target groups. For Network Load Balancers, you can specify a single target group. Specify only when Type is forward. If you specify both ForwardConfig and TargetGroupArn, you can specify only one target group using ForwardConfig and it must be the same target group specified in TargetGroupArn.

            • TargetGroups — (Array<map>)

              One or more target groups. For Network Load Balancers, you can specify a single target group.

              • TargetGroupArn — (String)

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

              • Weight — (Integer)

                The weight. The range is 0 to 999.

            • TargetGroupStickinessConfig — (map)

              The target group stickiness for the rule.

              • Enabled — (Boolean)

                Indicates whether target group stickiness is enabled.

              • DurationSeconds — (Integer)

                The time period, in seconds, during which requests from a client should be routed to the same target group. The range is 1-604800 seconds (7 days).

        • AlpnPolicy — (Array<String>)

          [TLS listener] The name of the Application-Layer Protocol Negotiation (ALPN) policy.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

createLoadBalancer(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

To create an Internet-facing load balancer


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

 var params = {
  Name: "my-load-balancer", 
  Subnets: [
     "subnet-b7d581c0", 
     "subnet-8360a9e7"
  ]
 };
 elbv2.createLoadBalancer(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    LoadBalancers: [
       {
      AvailabilityZones: [
         {
        SubnetId: "subnet-8360a9e7", 
        ZoneName: "us-west-2a"
       }, 
         {
        SubnetId: "subnet-b7d581c0", 
        ZoneName: "us-west-2b"
       }
      ], 
      CanonicalHostedZoneId: "Z2P70J7EXAMPLE", 
      CreatedTime: <Date Representation>, 
      DNSName: "my-load-balancer-424835706.us-west-2.elb.amazonaws.com", 
      LoadBalancerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
      LoadBalancerName: "my-load-balancer", 
      Scheme: "internet-facing", 
      SecurityGroups: [
         "sg-5943793c"
      ], 
      State: {
       Code: "provisioning"
      }, 
      Type: "application", 
      VpcId: "vpc-3ac0fb5f"
     }
    ]
   }
   */
 });

To create an internal load balancer


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

 var params = {
  Name: "my-internal-load-balancer", 
  Scheme: "internal", 
  SecurityGroups: [
  ], 
  Subnets: [
     "subnet-b7d581c0", 
     "subnet-8360a9e7"
  ]
 };
 elbv2.createLoadBalancer(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    LoadBalancers: [
       {
      AvailabilityZones: [
         {
        SubnetId: "subnet-8360a9e7", 
        ZoneName: "us-west-2a"
       }, 
         {
        SubnetId: "subnet-b7d581c0", 
        ZoneName: "us-west-2b"
       }
      ], 
      CanonicalHostedZoneId: "Z2P70J7EXAMPLE", 
      CreatedTime: <Date Representation>, 
      DNSName: "internal-my-internal-load-balancer-1529930873.us-west-2.elb.amazonaws.com", 
      LoadBalancerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-internal-load-balancer/5b49b8d4303115c2", 
      LoadBalancerName: "my-internal-load-balancer", 
      Scheme: "internal", 
      SecurityGroups: [
         "sg-5943793c"
      ], 
      State: {
       Code: "provisioning"
      }, 
      Type: "application", 
      VpcId: "vpc-3ac0fb5f"
     }
    ]
   }
   */
 });

Calling the createLoadBalancer operation

var params = {
  Name: 'STRING_VALUE', /* required */
  CustomerOwnedIpv4Pool: 'STRING_VALUE',
  IpAddressType: ipv4 | dualstack,
  Scheme: internet-facing | internal,
  SecurityGroups: [
    'STRING_VALUE',
    /* more items */
  ],
  SubnetMappings: [
    {
      AllocationId: 'STRING_VALUE',
      IPv6Address: 'STRING_VALUE',
      PrivateIPv4Address: 'STRING_VALUE',
      SubnetId: 'STRING_VALUE'
    },
    /* more items */
  ],
  Subnets: [
    'STRING_VALUE',
    /* more items */
  ],
  Tags: [
    {
      Key: 'STRING_VALUE', /* required */
      Value: 'STRING_VALUE'
    },
    /* more items */
  ],
  Type: application | network | gateway
};
elbv2.createLoadBalancer(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Name — (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.

    • SubnetMappings — (Array<map>)

      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.

      • SubnetId — (String)

        The ID of the subnet.

      • AllocationId — (String)

        [Network Load Balancers] The allocation ID of the Elastic IP address for an internet-facing load balancer.

      • PrivateIPv4Address — (String)

        [Network Load Balancers] The private IPv4 address for an internal load balancer.

      • IPv6Address — (String)

        [Network Load Balancers] The IPv6 address.

    • SecurityGroups — (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.

      Possible values include:
      • "internet-facing"
      • "internal"
    • Tags — (Array<map>)

      The tags to assign to the load balancer.

      • Keyrequired — (String)

        The key of the tag.

      • Value — (String)

        The value of the tag.

    • Type — (String)

      The type of load balancer. The default is application.

      Possible values include:
      • "application"
      • "network"
      • "gateway"
    • IpAddressType — (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.

      Possible values include:
      • "ipv4"
      • "dualstack"
    • CustomerOwnedIpv4Pool — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • LoadBalancers — (Array<map>)

        Information about the load balancer.

        • LoadBalancerArn — (String)

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

        • DNSName — (String)

          The public DNS name of the load balancer.

        • CanonicalHostedZoneId — (String)

          The ID of the Amazon Route 53 hosted zone associated with the load balancer.

        • CreatedTime — (Date)

          The date and time the load balancer was created.

        • LoadBalancerName — (String)

          The name of 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.

          Possible values include:
          • "internet-facing"
          • "internal"
        • VpcId — (String)

          The ID of the VPC for the load balancer.

        • State — (map)

          The state of the load balancer.

          • Code — (String)

            The state code. The initial state of the load balancer is provisioning. After the load balancer is fully set up and ready to route traffic, its state is active. If load balancer is routing traffic but does not have the resources it needs to scale, its state isactive_impaired. If the load balancer could not be set up, its state is failed.

            Possible values include:
            • "active"
            • "provisioning"
            • "active_impaired"
            • "failed"
          • Reason — (String)

            A description of the state.

        • Type — (String)

          The type of load balancer.

          Possible values include:
          • "application"
          • "network"
          • "gateway"
        • AvailabilityZones — (Array<map>)

          The subnets for the load balancer.

          • ZoneName — (String)

            The name of the Availability Zone.

          • SubnetId — (String)

            The ID of the subnet. You can specify one subnet per Availability Zone.

          • OutpostId — (String)

            [Application Load Balancers on Outposts] The ID of the Outpost.

          • LoadBalancerAddresses — (Array<map>)

            [Network Load Balancers] If you need static IP addresses for your load balancer, you can specify one Elastic IP address per Availability Zone when you create an internal-facing load balancer. For internal load balancers, you can specify a private IP address from the IPv4 range of the subnet.

            • IpAddress — (String)

              The static IP address.

            • AllocationId — (String)

              [Network Load Balancers] The allocation ID of the Elastic IP address for an internal-facing load balancer.

            • PrivateIPv4Address — (String)

              [Network Load Balancers] The private IPv4 address for an internal load balancer.

            • IPv6Address — (String)

              [Network Load Balancers] The IPv6 address.

        • SecurityGroups — (Array<String>)

          The IDs of the security groups for the load balancer.

        • IpAddressType — (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).

          Possible values include:
          • "ipv4"
          • "dualstack"
        • CustomerOwnedIpv4Pool — (String)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

createRule(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

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

 var params = {
  Actions: [
     {
    TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
    Type: "forward"
   }
  ], 
  Conditions: [
     {
    Field: "path-pattern", 
    Values: [
       "/img/*"
    ]
   }
  ], 
  ListenerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2", 
  Priority: 10
 };
 elbv2.createRule(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    Rules: [
       {
      Actions: [
         {
        TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
        Type: "forward"
       }
      ], 
      Conditions: [
         {
        Field: "path-pattern", 
        Values: [
           "/img/*"
        ]
       }
      ], 
      IsDefault: false, 
      Priority: "10", 
      RuleArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/9683b2d02a6cabee"
     }
    ]
   }
   */
 });

Calling the createRule operation

var params = {
  Actions: [ /* required */
    {
      Type: forward | authenticate-oidc | authenticate-cognito | redirect | fixed-response, /* required */
      AuthenticateCognitoConfig: {
        UserPoolArn: 'STRING_VALUE', /* required */
        UserPoolClientId: 'STRING_VALUE', /* required */
        UserPoolDomain: 'STRING_VALUE', /* required */
        AuthenticationRequestExtraParams: {
          '<AuthenticateCognitoActionAuthenticationRequestParamName>': 'STRING_VALUE',
          /* '<AuthenticateCognitoActionAuthenticationRequestParamName>': ... */
        },
        OnUnauthenticatedRequest: deny | allow | authenticate,
        Scope: 'STRING_VALUE',
        SessionCookieName: 'STRING_VALUE',
        SessionTimeout: 'NUMBER_VALUE'
      },
      AuthenticateOidcConfig: {
        AuthorizationEndpoint: 'STRING_VALUE', /* required */
        ClientId: 'STRING_VALUE', /* required */
        Issuer: 'STRING_VALUE', /* required */
        TokenEndpoint: 'STRING_VALUE', /* required */
        UserInfoEndpoint: 'STRING_VALUE', /* required */
        AuthenticationRequestExtraParams: {
          '<AuthenticateOidcActionAuthenticationRequestParamName>': 'STRING_VALUE',
          /* '<AuthenticateOidcActionAuthenticationRequestParamName>': ... */
        },
        ClientSecret: 'STRING_VALUE',
        OnUnauthenticatedRequest: deny | allow | authenticate,
        Scope: 'STRING_VALUE',
        SessionCookieName: 'STRING_VALUE',
        SessionTimeout: 'NUMBER_VALUE',
        UseExistingClientSecret: true || false
      },
      FixedResponseConfig: {
        StatusCode: 'STRING_VALUE', /* required */
        ContentType: 'STRING_VALUE',
        MessageBody: 'STRING_VALUE'
      },
      ForwardConfig: {
        TargetGroupStickinessConfig: {
          DurationSeconds: 'NUMBER_VALUE',
          Enabled: true || false
        },
        TargetGroups: [
          {
            TargetGroupArn: 'STRING_VALUE',
            Weight: 'NUMBER_VALUE'
          },
          /* more items */
        ]
      },
      Order: 'NUMBER_VALUE',
      RedirectConfig: {
        StatusCode: HTTP_301 | HTTP_302, /* required */
        Host: 'STRING_VALUE',
        Path: 'STRING_VALUE',
        Port: 'STRING_VALUE',
        Protocol: 'STRING_VALUE',
        Query: 'STRING_VALUE'
      },
      TargetGroupArn: 'STRING_VALUE'
    },
    /* more items */
  ],
  Conditions: [ /* required */
    {
      Field: 'STRING_VALUE',
      HostHeaderConfig: {
        Values: [
          'STRING_VALUE',
          /* more items */
        ]
      },
      HttpHeaderConfig: {
        HttpHeaderName: 'STRING_VALUE',
        Values: [
          'STRING_VALUE',
          /* more items */
        ]
      },
      HttpRequestMethodConfig: {
        Values: [
          'STRING_VALUE',
          /* more items */
        ]
      },
      PathPatternConfig: {
        Values: [
          'STRING_VALUE',
          /* more items */
        ]
      },
      QueryStringConfig: {
        Values: [
          {
            Key: 'STRING_VALUE',
            Value: 'STRING_VALUE'
          },
          /* more items */
        ]
      },
      SourceIpConfig: {
        Values: [
          'STRING_VALUE',
          /* more items */
        ]
      },
      Values: [
        'STRING_VALUE',
        /* more items */
      ]
    },
    /* more items */
  ],
  ListenerArn: 'STRING_VALUE', /* required */
  Priority: 'NUMBER_VALUE', /* required */
  Tags: [
    {
      Key: 'STRING_VALUE', /* required */
      Value: 'STRING_VALUE'
    },
    /* more items */
  ]
};
elbv2.createRule(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ListenerArn — (String)

      The Amazon Resource Name (ARN) of the listener.

    • Conditions — (Array<map>)

      The conditions.

      • Field — (String)

        The field in the HTTP request. The following are the possible values:

        • http-header

        • http-request-method

        • host-header

        • path-pattern

        • query-string

        • source-ip

      • Values — (Array<String>)

        The condition value. Specify only when Field is host-header or path-pattern. Alternatively, to specify multiple host names or multiple path patterns, use HostHeaderConfig or PathPatternConfig.

        If Field is host-header and you are not using HostHeaderConfig, you can specify a single host name (for example, my.example.com) in Values. A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters.

        • A-Z, a-z, 0-9

        • - .

        • (matches 0 or more characters)

        • ? (matches exactly 1 character)

        If Field is path-pattern and you are not using PathPatternConfig, you can specify a single path pattern (for example, /img/) in Values. A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters.

        • A-Z, a-z, 0-9

        • _ - . $ / ~ " ' @ : +

        • & (using &amp;)

        • * (matches 0 or more characters)

        • ? (matches exactly 1 character)

      • HostHeaderConfig — (map)

        Information for a host header condition. Specify only when Field is host-header.

        • Values — (Array<String>)

          One or more host names. The maximum size of each name is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).

          If you specify multiple strings, the condition is satisfied if one of the strings matches the host name.

      • PathPatternConfig — (map)

        Information for a path pattern condition. Specify only when Field is path-pattern.

        • Values — (Array<String>)

          One or more path patterns to compare against the request URL. The maximum size of each string is 128 characters. The comparison is case sensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).

          If you specify multiple strings, the condition is satisfied if one of them matches the request URL. The path pattern is compared only to the path of the URL, not to its query string. To compare against the query string, use QueryStringConditionConfig.

      • HttpHeaderConfig — (map)

        Information for an HTTP header condition. Specify only when Field is http-header.

        • HttpHeaderName — (String)

          The name of the HTTP header field. The maximum size is 40 characters. The header name is case insensitive. The allowed characters are specified by RFC 7230. Wildcards are not supported.

          You can't use an HTTP header condition to specify the host header. Use HostHeaderConditionConfig to specify a host header condition.

        • Values — (Array<String>)

          One or more strings to compare against the value of the HTTP header. The maximum size of each string is 128 characters. The comparison strings are case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).

          If the same header appears multiple times in the request, we search them in order until a match is found.

          If you specify multiple strings, the condition is satisfied if one of the strings matches the value of the HTTP header. To require that all of the strings are a match, create one condition per string.

      • QueryStringConfig — (map)

        Information for a query string condition. Specify only when Field is query-string.

        • Values — (Array<map>)

          One or more key/value pairs or values to find in the query string. The maximum size of each string is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character). To search for a literal '*' or '?' character in a query string, you must escape these characters in Values using a '\' character.

          If you specify multiple key/value pairs or values, the condition is satisfied if one of them is found in the query string.

          • Key — (String)

            The key. You can omit the key.

          • Value — (String)

            The value.

      • HttpRequestMethodConfig — (map)

        Information for an HTTP method condition. Specify only when Field is http-request-method.

        • Values — (Array<String>)

          The name of the request method. The maximum size is 40 characters. The allowed characters are A-Z, hyphen (-), and underscore (_). The comparison is case sensitive. Wildcards are not supported; therefore, the method name must be an exact match.

          If you specify multiple strings, the condition is satisfied if one of the strings matches the HTTP request method. We recommend that you route GET and HEAD requests in the same way, because the response to a HEAD request may be cached.

      • SourceIpConfig — (map)

        Information for a source IP condition. Specify only when Field is source-ip.

        • Values — (Array<String>)

          One or more source IP addresses, in CIDR format. You can use both IPv4 and IPv6 addresses. Wildcards are not supported.

          If you specify multiple addresses, the condition is satisfied if the source IP address of the request matches one of the CIDR blocks. This condition is not satisfied by the addresses in the X-Forwarded-For header. To search for addresses in the X-Forwarded-For header, use HttpHeaderConditionConfig.

    • Priority — (Integer)

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

    • Actions — (Array<map>)

      The actions.

      • Typerequired — (String)

        The type of action.

        Possible values include:
        • "forward"
        • "authenticate-oidc"
        • "authenticate-cognito"
        • "redirect"
        • "fixed-response"
      • TargetGroupArn — (String)

        The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward and you want to route to a single target group. To route to one or more target groups, use ForwardConfig instead.

      • AuthenticateOidcConfig — (map)

        [HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc.

        • Issuerrequired — (String)

          The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

        • AuthorizationEndpointrequired — (String)

          The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

        • TokenEndpointrequired — (String)

          The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

        • UserInfoEndpointrequired — (String)

          The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

        • ClientIdrequired — (String)

          The OAuth 2.0 client identifier.

        • ClientSecret — (String)

          The OAuth 2.0 client secret. This parameter is required if you are creating a rule. If you are modifying a rule, you can omit this parameter if you set UseExistingClientSecret to true.

        • SessionCookieName — (String)

          The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.

        • Scope — (String)

          The set of user claims to be requested from the IdP. The default is openid.

          To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.

        • SessionTimeout — (Integer)

          The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).

        • AuthenticationRequestExtraParams — (map<String>)

          The query parameters (up to 10) to include in the redirect request to the authorization endpoint.

        • OnUnauthenticatedRequest — (String)

          The behavior if the user is not authenticated. The following are possible values:

          • deny - Return an HTTP 401 Unauthorized error.

          • allow - Allow the request to be forwarded to the target.

          • authenticate - Redirect the request to the IdP authorization endpoint. This is the default value.

          Possible values include:
          • "deny"
          • "allow"
          • "authenticate"
        • UseExistingClientSecret — (Boolean)

          Indicates whether to use the existing client secret when modifying a rule. If you are creating a rule, you can omit this parameter or set it to false.

      • AuthenticateCognitoConfig — (map)

        [HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only when Type is authenticate-cognito.

        • UserPoolArnrequired — (String)

          The Amazon Resource Name (ARN) of the Amazon Cognito user pool.

        • UserPoolClientIdrequired — (String)

          The ID of the Amazon Cognito user pool client.

        • UserPoolDomainrequired — (String)

          The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.

        • SessionCookieName — (String)

          The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.

        • Scope — (String)

          The set of user claims to be requested from the IdP. The default is openid.

          To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.

        • SessionTimeout — (Integer)

          The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).

        • AuthenticationRequestExtraParams — (map<String>)

          The query parameters (up to 10) to include in the redirect request to the authorization endpoint.

        • OnUnauthenticatedRequest — (String)

          The behavior if the user is not authenticated. The following are possible values:

          • deny - Return an HTTP 401 Unauthorized error.

          • allow - Allow the request to be forwarded to the target.

          • authenticate - Redirect the request to the IdP authorization endpoint. This is the default value.

          Possible values include:
          • "deny"
          • "allow"
          • "authenticate"
      • Order — (Integer)

        The order for the action. This value is required for rules with multiple actions. The action with the lowest value for order is performed first.

      • RedirectConfig — (map)

        [Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect.

        • Protocol — (String)

          The protocol. You can specify HTTP, HTTPS, or #{protocol}. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You cannot redirect HTTPS to HTTP.

        • Port — (String)

          The port. You can specify a value from 1 to 65535 or #{port}.

        • Host — (String)

          The hostname. This component is not percent-encoded. The hostname can contain #{host}.

        • Path — (String)

          The absolute path, starting with the leading "/". This component is not percent-encoded. The path can contain #{host}, #{path}, and #{port}.

        • Query — (String)

          The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.

        • StatusCoderequired — (String)

          The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).

          Possible values include:
          • "HTTP_301"
          • "HTTP_302"
      • FixedResponseConfig — (map)

        [Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only when Type is fixed-response.

        • MessageBody — (String)

          The message.

        • StatusCoderequired — (String)

          The HTTP response code (2XX, 4XX, or 5XX).

        • ContentType — (String)

          The content type.

          Valid Values: text/plain | text/css | text/html | application/javascript | application/json

      • ForwardConfig — (map)

        Information for creating an action that distributes requests among one or more target groups. For Network Load Balancers, you can specify a single target group. Specify only when Type is forward. If you specify both ForwardConfig and TargetGroupArn, you can specify only one target group using ForwardConfig and it must be the same target group specified in TargetGroupArn.

        • TargetGroups — (Array<map>)

          One or more target groups. For Network Load Balancers, you can specify a single target group.

          • TargetGroupArn — (String)

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

          • Weight — (Integer)

            The weight. The range is 0 to 999.

        • TargetGroupStickinessConfig — (map)

          The target group stickiness for the rule.

          • Enabled — (Boolean)

            Indicates whether target group stickiness is enabled.

          • DurationSeconds — (Integer)

            The time period, in seconds, during which requests from a client should be routed to the same target group. The range is 1-604800 seconds (7 days).

    • Tags — (Array<map>)

      The tags to assign to the rule.

      • Keyrequired — (String)

        The key of the tag.

      • Value — (String)

        The value of the tag.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Rules — (Array<map>)

        Information about the rule.

        • RuleArn — (String)

          The Amazon Resource Name (ARN) of the rule.

        • Priority — (String)

          The priority.

        • Conditions — (Array<map>)

          The conditions. Each rule can include zero or one of the following conditions: http-request-method, host-header, path-pattern, and source-ip, and zero or more of the following conditions: http-header and query-string.

          • Field — (String)

            The field in the HTTP request. The following are the possible values:

            • http-header

            • http-request-method

            • host-header

            • path-pattern

            • query-string

            • source-ip

          • Values — (Array<String>)

            The condition value. Specify only when Field is host-header or path-pattern. Alternatively, to specify multiple host names or multiple path patterns, use HostHeaderConfig or PathPatternConfig.

            If Field is host-header and you are not using HostHeaderConfig, you can specify a single host name (for example, my.example.com) in Values. A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters.

            • A-Z, a-z, 0-9

            • - .

            • (matches 0 or more characters)

            • ? (matches exactly 1 character)

            If Field is path-pattern and you are not using PathPatternConfig, you can specify a single path pattern (for example, /img/) in Values. A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters.

            • A-Z, a-z, 0-9

            • _ - . $ / ~ " ' @ : +

            • & (using &amp;)

            • * (matches 0 or more characters)

            • ? (matches exactly 1 character)

          • HostHeaderConfig — (map)

            Information for a host header condition. Specify only when Field is host-header.

            • Values — (Array<String>)

              One or more host names. The maximum size of each name is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).

              If you specify multiple strings, the condition is satisfied if one of the strings matches the host name.

          • PathPatternConfig — (map)

            Information for a path pattern condition. Specify only when Field is path-pattern.

            • Values — (Array<String>)

              One or more path patterns to compare against the request URL. The maximum size of each string is 128 characters. The comparison is case sensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).

              If you specify multiple strings, the condition is satisfied if one of them matches the request URL. The path pattern is compared only to the path of the URL, not to its query string. To compare against the query string, use QueryStringConditionConfig.

          • HttpHeaderConfig — (map)

            Information for an HTTP header condition. Specify only when Field is http-header.

            • HttpHeaderName — (String)

              The name of the HTTP header field. The maximum size is 40 characters. The header name is case insensitive. The allowed characters are specified by RFC 7230. Wildcards are not supported.

              You can't use an HTTP header condition to specify the host header. Use HostHeaderConditionConfig to specify a host header condition.

            • Values — (Array<String>)

              One or more strings to compare against the value of the HTTP header. The maximum size of each string is 128 characters. The comparison strings are case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).

              If the same header appears multiple times in the request, we search them in order until a match is found.

              If you specify multiple strings, the condition is satisfied if one of the strings matches the value of the HTTP header. To require that all of the strings are a match, create one condition per string.

          • QueryStringConfig — (map)

            Information for a query string condition. Specify only when Field is query-string.

            • Values — (Array<map>)

              One or more key/value pairs or values to find in the query string. The maximum size of each string is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character). To search for a literal '*' or '?' character in a query string, you must escape these characters in Values using a '\' character.

              If you specify multiple key/value pairs or values, the condition is satisfied if one of them is found in the query string.

              • Key — (String)

                The key. You can omit the key.

              • Value — (String)

                The value.

          • HttpRequestMethodConfig — (map)

            Information for an HTTP method condition. Specify only when Field is http-request-method.

            • Values — (Array<String>)

              The name of the request method. The maximum size is 40 characters. The allowed characters are A-Z, hyphen (-), and underscore (_). The comparison is case sensitive. Wildcards are not supported; therefore, the method name must be an exact match.

              If you specify multiple strings, the condition is satisfied if one of the strings matches the HTTP request method. We recommend that you route GET and HEAD requests in the same way, because the response to a HEAD request may be cached.

          • SourceIpConfig — (map)

            Information for a source IP condition. Specify only when Field is source-ip.

            • Values — (Array<String>)

              One or more source IP addresses, in CIDR format. You can use both IPv4 and IPv6 addresses. Wildcards are not supported.

              If you specify multiple addresses, the condition is satisfied if the source IP address of the request matches one of the CIDR blocks. This condition is not satisfied by the addresses in the X-Forwarded-For header. To search for addresses in the X-Forwarded-For header, use HttpHeaderConditionConfig.

        • Actions — (Array<map>)

          The actions. Each rule must include exactly one of the following types of actions: forward, redirect, or fixed-response, and it must be the last action to be performed.

          • Typerequired — (String)

            The type of action.

            Possible values include:
            • "forward"
            • "authenticate-oidc"
            • "authenticate-cognito"
            • "redirect"
            • "fixed-response"
          • TargetGroupArn — (String)

            The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward and you want to route to a single target group. To route to one or more target groups, use ForwardConfig instead.

          • AuthenticateOidcConfig — (map)

            [HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc.

            • Issuerrequired — (String)

              The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • AuthorizationEndpointrequired — (String)

              The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • TokenEndpointrequired — (String)

              The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • UserInfoEndpointrequired — (String)

              The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • ClientIdrequired — (String)

              The OAuth 2.0 client identifier.

            • ClientSecret — (String)

              The OAuth 2.0 client secret. This parameter is required if you are creating a rule. If you are modifying a rule, you can omit this parameter if you set UseExistingClientSecret to true.

            • SessionCookieName — (String)

              The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.

            • Scope — (String)

              The set of user claims to be requested from the IdP. The default is openid.

              To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.

            • SessionTimeout — (Integer)

              The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).

            • AuthenticationRequestExtraParams — (map<String>)

              The query parameters (up to 10) to include in the redirect request to the authorization endpoint.

            • OnUnauthenticatedRequest — (String)

              The behavior if the user is not authenticated. The following are possible values:

              • deny - Return an HTTP 401 Unauthorized error.

              • allow - Allow the request to be forwarded to the target.

              • authenticate - Redirect the request to the IdP authorization endpoint. This is the default value.

              Possible values include:
              • "deny"
              • "allow"
              • "authenticate"
            • UseExistingClientSecret — (Boolean)

              Indicates whether to use the existing client secret when modifying a rule. If you are creating a rule, you can omit this parameter or set it to false.

          • AuthenticateCognitoConfig — (map)

            [HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only when Type is authenticate-cognito.

            • UserPoolArnrequired — (String)

              The Amazon Resource Name (ARN) of the Amazon Cognito user pool.

            • UserPoolClientIdrequired — (String)

              The ID of the Amazon Cognito user pool client.

            • UserPoolDomainrequired — (String)

              The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.

            • SessionCookieName — (String)

              The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.

            • Scope — (String)

              The set of user claims to be requested from the IdP. The default is openid.

              To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.

            • SessionTimeout — (Integer)

              The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).

            • AuthenticationRequestExtraParams — (map<String>)

              The query parameters (up to 10) to include in the redirect request to the authorization endpoint.

            • OnUnauthenticatedRequest — (String)

              The behavior if the user is not authenticated. The following are possible values:

              • deny - Return an HTTP 401 Unauthorized error.

              • allow - Allow the request to be forwarded to the target.

              • authenticate - Redirect the request to the IdP authorization endpoint. This is the default value.

              Possible values include:
              • "deny"
              • "allow"
              • "authenticate"
          • Order — (Integer)

            The order for the action. This value is required for rules with multiple actions. The action with the lowest value for order is performed first.

          • RedirectConfig — (map)

            [Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect.

            • Protocol — (String)

              The protocol. You can specify HTTP, HTTPS, or #{protocol}. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You cannot redirect HTTPS to HTTP.

            • Port — (String)

              The port. You can specify a value from 1 to 65535 or #{port}.

            • Host — (String)

              The hostname. This component is not percent-encoded. The hostname can contain #{host}.

            • Path — (String)

              The absolute path, starting with the leading "/". This component is not percent-encoded. The path can contain #{host}, #{path}, and #{port}.

            • Query — (String)

              The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.

            • StatusCoderequired — (String)

              The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).

              Possible values include:
              • "HTTP_301"
              • "HTTP_302"
          • FixedResponseConfig — (map)

            [Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only when Type is fixed-response.

            • MessageBody — (String)

              The message.

            • StatusCoderequired — (String)

              The HTTP response code (2XX, 4XX, or 5XX).

            • ContentType — (String)

              The content type.

              Valid Values: text/plain | text/css | text/html | application/javascript | application/json

          • ForwardConfig — (map)

            Information for creating an action that distributes requests among one or more target groups. For Network Load Balancers, you can specify a single target group. Specify only when Type is forward. If you specify both ForwardConfig and TargetGroupArn, you can specify only one target group using ForwardConfig and it must be the same target group specified in TargetGroupArn.

            • TargetGroups — (Array<map>)

              One or more target groups. For Network Load Balancers, you can specify a single target group.

              • TargetGroupArn — (String)

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

              • Weight — (Integer)

                The weight. The range is 0 to 999.

            • TargetGroupStickinessConfig — (map)

              The target group stickiness for the rule.

              • Enabled — (Boolean)

                Indicates whether target group stickiness is enabled.

              • DurationSeconds — (Integer)

                The time period, in seconds, during which requests from a client should be routed to the same target group. The range is 1-604800 seconds (7 days).

        • IsDefault — (Boolean)

          Indicates whether this is the default rule.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

createTargetGroup(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

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

 var params = {
  Name: "my-targets", 
  Port: 80, 
  Protocol: "HTTP", 
  VpcId: "vpc-3ac0fb5f"
 };
 elbv2.createTargetGroup(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    TargetGroups: [
       {
      HealthCheckIntervalSeconds: 30, 
      HealthCheckPath: "/", 
      HealthCheckPort: "traffic-port", 
      HealthCheckProtocol: "HTTP", 
      HealthCheckTimeoutSeconds: 5, 
      HealthyThresholdCount: 5, 
      Matcher: {
       HttpCode: "200"
      }, 
      Port: 80, 
      Protocol: "HTTP", 
      TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
      TargetGroupName: "my-targets", 
      UnhealthyThresholdCount: 2, 
      VpcId: "vpc-3ac0fb5f"
     }
    ]
   }
   */
 });

Calling the createTargetGroup operation

var params = {
  Name: 'STRING_VALUE', /* required */
  HealthCheckEnabled: true || false,
  HealthCheckIntervalSeconds: 'NUMBER_VALUE',
  HealthCheckPath: 'STRING_VALUE',
  HealthCheckPort: 'STRING_VALUE',
  HealthCheckProtocol: HTTP | HTTPS | TCP | TLS | UDP | TCP_UDP | GENEVE,
  HealthCheckTimeoutSeconds: 'NUMBER_VALUE',
  HealthyThresholdCount: 'NUMBER_VALUE',
  IpAddressType: ipv4 | ipv6,
  Matcher: {
    GrpcCode: 'STRING_VALUE',
    HttpCode: 'STRING_VALUE'
  },
  Port: 'NUMBER_VALUE',
  Protocol: HTTP | HTTPS | TCP | TLS | UDP | TCP_UDP | GENEVE,
  ProtocolVersion: 'STRING_VALUE',
  Tags: [
    {
      Key: 'STRING_VALUE', /* required */
      Value: 'STRING_VALUE'
    },
    /* more items */
  ],
  TargetType: instance | ip | lambda | alb,
  UnhealthyThresholdCount: 'NUMBER_VALUE',
  VpcId: 'STRING_VALUE'
};
elbv2.createTargetGroup(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Name — (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.

      Possible values include:
      • "HTTP"
      • "HTTPS"
      • "TCP"
      • "TLS"
      • "UDP"
      • "TCP_UDP"
      • "GENEVE"
    • ProtocolVersion — (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.

    • VpcId — (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.

    • HealthCheckProtocol — (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.

      Possible values include:
      • "HTTP"
      • "HTTPS"
      • "TCP"
      • "TLS"
      • "UDP"
      • "TCP_UDP"
      • "GENEVE"
    • HealthCheckPort — (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.

    • HealthCheckEnabled — (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, ip, or alb, health checks are always enabled and cannot be disabled.

    • HealthCheckPath — (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 /Amazon Web Services.ALB/healthcheck.

    • HealthCheckIntervalSeconds — (Integer)

      The approximate amount of time, in seconds, between health checks of an individual target. If the target group protocol is TCP, TLS, UDP, or TCP_UDP, the supported values are 10 and 30 seconds. If the target group protocol is HTTP or HTTPS, 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.

    • HealthCheckTimeoutSeconds — (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.

    • HealthyThresholdCount — (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.

    • UnhealthyThresholdCount — (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 — (map)

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

      • HttpCode — (String)

        For Application Load Balancers, you can specify values between 200 and 499, and the default value is 200. You can specify multiple values (for example, "200,202") or a range of values (for example, "200-299").

        For Network Load Balancers and Gateway Load Balancers, this must be "200–399".

        Note that when using shorthand syntax, some values such as commas need to be escaped.

      • GrpcCode — (String)

        You can specify values between 0 and 99. You can specify multiple values (for example, "0,1") or a range of values (for example, "0-5"). The default value is 12.

    • TargetType — (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.

      • alb - Register a single Application Load Balancer as a target.

      Possible values include:
      • "instance"
      • "ip"
      • "lambda"
      • "alb"
    • Tags — (Array<map>)

      The tags to assign to the target group.

      • Keyrequired — (String)

        The key of the tag.

      • Value — (String)

        The value of the tag.

    • IpAddressType — (String)

      The type of IP address used for this target group. The possible values are ipv4 and ipv6. This is an optional parameter. If not specified, the IP address type defaults to ipv4.

      Possible values include:
      • "ipv4"
      • "ipv6"

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • TargetGroups — (Array<map>)

        Information about the target group.

        • TargetGroupArn — (String)

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

        • TargetGroupName — (String)

          The name of the target group.

        • Protocol — (String)

          The protocol to use for routing traffic to the targets.

          Possible values include:
          • "HTTP"
          • "HTTPS"
          • "TCP"
          • "TLS"
          • "UDP"
          • "TCP_UDP"
          • "GENEVE"
        • Port — (Integer)

          The port on which the targets are listening. Not used if the target is a Lambda function.

        • VpcId — (String)

          The ID of the VPC for the targets.

        • HealthCheckProtocol — (String)

          The protocol to use to connect with the target. The GENEVE, TLS, UDP, and TCP_UDP protocols are not supported for health checks.

          Possible values include:
          • "HTTP"
          • "HTTPS"
          • "TCP"
          • "TLS"
          • "UDP"
          • "TCP_UDP"
          • "GENEVE"
        • HealthCheckPort — (String)

          The port to use to connect with the target.

        • HealthCheckEnabled — (Boolean)

          Indicates whether health checks are enabled.

        • HealthCheckIntervalSeconds — (Integer)

          The approximate amount of time, in seconds, between health checks of an individual target.

        • HealthCheckTimeoutSeconds — (Integer)

          The amount of time, in seconds, during which no response means a failed health check.

        • HealthyThresholdCount — (Integer)

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

        • UnhealthyThresholdCount — (Integer)

          The number of consecutive health check failures required before considering the target unhealthy.

        • HealthCheckPath — (String)

          The destination for health checks on the targets.

        • Matcher — (map)

          The HTTP or gRPC codes to use when checking for a successful response from a target.

          • HttpCode — (String)

            For Application Load Balancers, you can specify values between 200 and 499, and the default value is 200. You can specify multiple values (for example, "200,202") or a range of values (for example, "200-299").

            For Network Load Balancers and Gateway Load Balancers, this must be "200–399".

            Note that when using shorthand syntax, some values such as commas need to be escaped.

          • GrpcCode — (String)

            You can specify values between 0 and 99. You can specify multiple values (for example, "0,1") or a range of values (for example, "0-5"). The default value is 12.

        • LoadBalancerArns — (Array<String>)

          The Amazon Resource Names (ARN) of the load balancers that route traffic to this target group.

        • TargetType — (String)

          The type of target that you must specify when registering targets with this target group. The possible values are instance (register targets by instance ID), ip (register targets by IP address), lambda (register a single Lambda function as a target), or alb (register a single Application Load Balancer as a target).

          Possible values include:
          • "instance"
          • "ip"
          • "lambda"
          • "alb"
        • ProtocolVersion — (String)

          [HTTP/HTTPS protocol] The protocol version. The possible values are GRPC, HTTP1, and HTTP2.

        • IpAddressType — (String)

          The type of IP address used for this target group. The possible values are ipv4 and ipv6. This is an optional parameter. If not specified, the IP address type defaults to ipv4.

          Possible values include:
          • "ipv4"
          • "ipv6"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteListener(params = {}, callback) ⇒ AWS.Request

Deletes the specified listener.

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

Service Reference:

Examples:

To delete a listener


/* This example deletes the specified listener. */

 var params = {
  ListenerArn: "arn:aws:elasticloadbalancing:ua-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2"
 };
 elbv2.deleteListener(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
   }
   */
 });

Calling the deleteListener operation

var params = {
  ListenerArn: 'STRING_VALUE' /* required */
};
elbv2.deleteListener(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ListenerArn — (String)

      The Amazon Resource Name (ARN) of the listener.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteLoadBalancer(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

To delete a load balancer


/* This example deletes the specified load balancer. */

 var params = {
  LoadBalancerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"
 };
 elbv2.deleteLoadBalancer(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
   }
   */
 });

Calling the deleteLoadBalancer operation

var params = {
  LoadBalancerArn: 'STRING_VALUE' /* required */
};
elbv2.deleteLoadBalancer(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • LoadBalancerArn — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteRule(params = {}, callback) ⇒ AWS.Request

Deletes the specified rule.

You can't delete the default rule.

Service Reference:

Examples:

To delete a rule


/* This example deletes the specified rule. */

 var params = {
  RuleArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/1291d13826f405c3"
 };
 elbv2.deleteRule(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
   }
   */
 });

Calling the deleteRule operation

var params = {
  RuleArn: 'STRING_VALUE' /* required */
};
elbv2.deleteRule(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • RuleArn — (String)

      The Amazon Resource Name (ARN) of the rule.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteTargetGroup(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

To delete a target group


/* This example deletes the specified target group. */

 var params = {
  TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067"
 };
 elbv2.deleteTargetGroup(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
   }
   */
 });

Calling the deleteTargetGroup operation

var params = {
  TargetGroupArn: 'STRING_VALUE' /* required */
};
elbv2.deleteTargetGroup(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • TargetGroupArn — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deregisterTargets(params = {}, callback) ⇒ AWS.Request

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

Service Reference:

Examples:

To deregister a target from a target group


/* This example deregisters the specified instance from the specified target group. */

 var params = {
  TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
  Targets: [
     {
    Id: "i-0f76fade"
   }
  ]
 };
 elbv2.deregisterTargets(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
   }
   */
 });

Calling the deregisterTargets operation

var params = {
  TargetGroupArn: 'STRING_VALUE', /* required */
  Targets: [ /* required */
    {
      Id: 'STRING_VALUE', /* required */
      AvailabilityZone: 'STRING_VALUE',
      Port: 'NUMBER_VALUE'
    },
    /* more items */
  ]
};
elbv2.deregisterTargets(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • TargetGroupArn — (String)

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

    • Targets — (Array<map>)

      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.

      • Idrequired — (String)

        The ID of the target. If the target type of the target group is instance, specify an instance ID. If the target type is ip, specify an IP address. If the target type is lambda, specify the ARN of the Lambda function. If the target type is alb, specify the ARN of the Application Load Balancer target.

      • Port — (Integer)

        The port on which the target is listening. If the target group protocol is GENEVE, the supported port is 6081. If the target type is alb, the targeted Application Load Balancer must have at least one listener whose port matches the target group port. Not used if the target is a Lambda function.

      • AvailabilityZone — (String)

        An Availability Zone or all. This determines whether the target receives traffic from the load balancer nodes in the specified Availability Zone or from all enabled Availability Zones for the load balancer.

        This parameter is not supported if the target type of the target group is instance or alb.

        If the target type is ip and the IP address is in a subnet of the VPC for the target group, the Availability Zone is automatically detected and this parameter is optional. If the IP address is outside the VPC, this parameter is required.

        With an Application Load Balancer, if the target type is ip and the IP address is outside the VPC for the target group, the only supported value is all.

        If the target type is lambda, this parameter is optional and the only supported value is all.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeAccountLimits(params = {}, callback) ⇒ AWS.Request

Describes the current Elastic Load Balancing resource limits for your Amazon Web Services account.

For more information, see the following:

Service Reference:

Examples:

Calling the describeAccountLimits operation

var params = {
  Marker: 'STRING_VALUE',
  PageSize: 'NUMBER_VALUE'
};
elbv2.describeAccountLimits(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Marker — (String)

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

    • PageSize — (Integer)

      The maximum number of results to return with this call.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Limits — (Array<map>)

        Information about the limits.

        • Name — (String)

          The name of the limit. The possible values are:

          • application-load-balancers

          • condition-values-per-alb-rule

          • condition-wildcards-per-alb-rule

          • gateway-load-balancers

          • gateway-load-balancers-per-vpc

          • geneve-target-groups

          • listeners-per-application-load-balancer

          • listeners-per-network-load-balancer

          • network-load-balancers

          • rules-per-application-load-balancer

          • target-groups

          • target-groups-per-action-on-application-load-balancer

          • target-groups-per-action-on-network-load-balancer

          • target-groups-per-application-load-balancer

          • targets-per-application-load-balancer

          • targets-per-availability-zone-per-gateway-load-balancer

          • targets-per-availability-zone-per-network-load-balancer

          • targets-per-network-load-balancer

        • Max — (String)

          The maximum value of the limit.

      • NextMarker — (String)

        If there are additional results, this is the marker for the next set of results. Otherwise, this is null.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeListenerCertificates(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the describeListenerCertificates operation

var params = {
  ListenerArn: 'STRING_VALUE', /* required */
  Marker: 'STRING_VALUE',
  PageSize: 'NUMBER_VALUE'
};
elbv2.describeListenerCertificates(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ListenerArn — (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.)

    • PageSize — (Integer)

      The maximum number of results to return with this call.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Certificates — (Array<map>)

        Information about the certificates.

        • CertificateArn — (String)

          The Amazon Resource Name (ARN) of the certificate.

        • IsDefault — (Boolean)

          Indicates whether the certificate is the default certificate. Do not set this value when specifying a certificate as an input. This value is not included in the output when describing a listener, but is included when describing listener certificates.

      • NextMarker — (String)

        If there are additional results, this is the marker for the next set of results. Otherwise, this is null.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeListeners(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

To describe a listener


/* This example describes the specified listener. */

 var params = {
  ListenerArns: [
     "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2"
  ]
 };
 elbv2.describeListeners(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    Listeners: [
       {
      DefaultActions: [
         {
        TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
        Type: "forward"
       }
      ], 
      ListenerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2", 
      LoadBalancerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
      Port: 80, 
      Protocol: "HTTP"
     }
    ]
   }
   */
 });

Calling the describeListeners operation

var params = {
  ListenerArns: [
    'STRING_VALUE',
    /* more items */
  ],
  LoadBalancerArn: 'STRING_VALUE',
  Marker: 'STRING_VALUE',
  PageSize: 'NUMBER_VALUE'
};
elbv2.describeListeners(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • LoadBalancerArn — (String)

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

    • ListenerArns — (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.)

    • PageSize — (Integer)

      The maximum number of results to return with this call.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Listeners — (Array<map>)

        Information about the listeners.

        • ListenerArn — (String)

          The Amazon Resource Name (ARN) of the listener.

        • LoadBalancerArn — (String)

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

        • Port — (Integer)

          The port on which the load balancer is listening.

        • Protocol — (String)

          The protocol for connections from clients to the load balancer.

          Possible values include:
          • "HTTP"
          • "HTTPS"
          • "TCP"
          • "TLS"
          • "UDP"
          • "TCP_UDP"
          • "GENEVE"
        • Certificates — (Array<map>)

          [HTTPS or TLS listener] The default certificate for the listener.

          • CertificateArn — (String)

            The Amazon Resource Name (ARN) of the certificate.

          • IsDefault — (Boolean)

            Indicates whether the certificate is the default certificate. Do not set this value when specifying a certificate as an input. This value is not included in the output when describing a listener, but is included when describing listener certificates.

        • SslPolicy — (String)

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

        • DefaultActions — (Array<map>)

          The default actions for the listener.

          • Typerequired — (String)

            The type of action.

            Possible values include:
            • "forward"
            • "authenticate-oidc"
            • "authenticate-cognito"
            • "redirect"
            • "fixed-response"
          • TargetGroupArn — (String)

            The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward and you want to route to a single target group. To route to one or more target groups, use ForwardConfig instead.

          • AuthenticateOidcConfig — (map)

            [HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc.

            • Issuerrequired — (String)

              The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • AuthorizationEndpointrequired — (String)

              The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • TokenEndpointrequired — (String)

              The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • UserInfoEndpointrequired — (String)

              The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • ClientIdrequired — (String)

              The OAuth 2.0 client identifier.

            • ClientSecret — (String)

              The OAuth 2.0 client secret. This parameter is required if you are creating a rule. If you are modifying a rule, you can omit this parameter if you set UseExistingClientSecret to true.

            • SessionCookieName — (String)

              The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.

            • Scope — (String)

              The set of user claims to be requested from the IdP. The default is openid.

              To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.

            • SessionTimeout — (Integer)

              The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).

            • AuthenticationRequestExtraParams — (map<String>)

              The query parameters (up to 10) to include in the redirect request to the authorization endpoint.

            • OnUnauthenticatedRequest — (String)

              The behavior if the user is not authenticated. The following are possible values:

              • deny - Return an HTTP 401 Unauthorized error.

              • allow - Allow the request to be forwarded to the target.

              • authenticate - Redirect the request to the IdP authorization endpoint. This is the default value.

              Possible values include:
              • "deny"
              • "allow"
              • "authenticate"
            • UseExistingClientSecret — (Boolean)

              Indicates whether to use the existing client secret when modifying a rule. If you are creating a rule, you can omit this parameter or set it to false.

          • AuthenticateCognitoConfig — (map)

            [HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only when Type is authenticate-cognito.

            • UserPoolArnrequired — (String)

              The Amazon Resource Name (ARN) of the Amazon Cognito user pool.

            • UserPoolClientIdrequired — (String)

              The ID of the Amazon Cognito user pool client.

            • UserPoolDomainrequired — (String)

              The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.

            • SessionCookieName — (String)

              The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.

            • Scope — (String)

              The set of user claims to be requested from the IdP. The default is openid.

              To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.

            • SessionTimeout — (Integer)

              The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).

            • AuthenticationRequestExtraParams — (map<String>)

              The query parameters (up to 10) to include in the redirect request to the authorization endpoint.

            • OnUnauthenticatedRequest — (String)

              The behavior if the user is not authenticated. The following are possible values:

              • deny - Return an HTTP 401 Unauthorized error.

              • allow - Allow the request to be forwarded to the target.

              • authenticate - Redirect the request to the IdP authorization endpoint. This is the default value.

              Possible values include:
              • "deny"
              • "allow"
              • "authenticate"
          • Order — (Integer)

            The order for the action. This value is required for rules with multiple actions. The action with the lowest value for order is performed first.

          • RedirectConfig — (map)

            [Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect.

            • Protocol — (String)

              The protocol. You can specify HTTP, HTTPS, or #{protocol}. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You cannot redirect HTTPS to HTTP.

            • Port — (String)

              The port. You can specify a value from 1 to 65535 or #{port}.

            • Host — (String)

              The hostname. This component is not percent-encoded. The hostname can contain #{host}.

            • Path — (String)

              The absolute path, starting with the leading "/". This component is not percent-encoded. The path can contain #{host}, #{path}, and #{port}.

            • Query — (String)

              The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.

            • StatusCoderequired — (String)

              The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).

              Possible values include:
              • "HTTP_301"
              • "HTTP_302"
          • FixedResponseConfig — (map)

            [Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only when Type is fixed-response.

            • MessageBody — (String)

              The message.

            • StatusCoderequired — (String)

              The HTTP response code (2XX, 4XX, or 5XX).

            • ContentType — (String)

              The content type.

              Valid Values: text/plain | text/css | text/html | application/javascript | application/json

          • ForwardConfig — (map)

            Information for creating an action that distributes requests among one or more target groups. For Network Load Balancers, you can specify a single target group. Specify only when Type is forward. If you specify both ForwardConfig and TargetGroupArn, you can specify only one target group using ForwardConfig and it must be the same target group specified in TargetGroupArn.

            • TargetGroups — (Array<map>)

              One or more target groups. For Network Load Balancers, you can specify a single target group.

              • TargetGroupArn — (String)

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

              • Weight — (Integer)

                The weight. The range is 0 to 999.

            • TargetGroupStickinessConfig — (map)

              The target group stickiness for the rule.

              • Enabled — (Boolean)

                Indicates whether target group stickiness is enabled.

              • DurationSeconds — (Integer)

                The time period, in seconds, during which requests from a client should be routed to the same target group. The range is 1-604800 seconds (7 days).

        • AlpnPolicy — (Array<String>)

          [TLS listener] The name of the Application-Layer Protocol Negotiation (ALPN) policy.

      • NextMarker — (String)

        If there are additional results, this is the marker for the next set of results. Otherwise, this is null.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeLoadBalancerAttributes(params = {}, callback) ⇒ AWS.Request

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

For more information, see the following:

Service Reference:

Examples:

To describe load balancer attributes


/* This example describes the attributes of the specified load balancer. */

 var params = {
  LoadBalancerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"
 };
 elbv2.describeLoadBalancerAttributes(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    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: ""
     }
    ]
   }
   */
 });

Calling the describeLoadBalancerAttributes operation

var params = {
  LoadBalancerArn: 'STRING_VALUE' /* required */
};
elbv2.describeLoadBalancerAttributes(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • LoadBalancerArn — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Attributes — (Array<map>)

        Information about the load balancer attributes.

        • Key — (String)

          The name of the attribute.

          The following attribute is supported by all load balancers:

          • deletion_protection.enabled - Indicates whether deletion protection is enabled. The value is true or false. The default is false.

          The following attributes are supported by both Application Load Balancers and Network Load Balancers:

          • access_logs.s3.enabled - Indicates whether access logs are enabled. The value is true or false. The default is false.

          • access_logs.s3.bucket - The name of the S3 bucket for the access logs. This attribute is required if access logs are enabled. The bucket must exist in the same region as the load balancer and have a bucket policy that grants Elastic Load Balancing permissions to write to the bucket.

          • access_logs.s3.prefix - The prefix for the location in the S3 bucket for the access logs.

          The following attributes are supported by only Application Load Balancers:

          • idle_timeout.timeout_seconds - The idle timeout value, in seconds. The valid range is 1-4000 seconds. The default is 60 seconds.

          • routing.http.desync_mitigation_mode - Determines how the load balancer handles requests that might pose a security risk to your application. The possible values are monitor, defensive, and strictest. The default is defensive.

          • routing.http.drop_invalid_header_fields.enabled - Indicates whether HTTP headers with invalid header fields are removed by the load balancer (true) or routed to targets (false). The default is false.

          • routing.http.x_amzn_tls_version_and_cipher_suite.enabled - Indicates whether the two headers (x-amzn-tls-version and x-amzn-tls-cipher-suite), which contain information about the negotiated TLS version and cipher suite, are added to the client request before sending it to the target. The x-amzn-tls-version header has information about the TLS protocol version negotiated with the client, and the x-amzn-tls-cipher-suite header has information about the cipher suite negotiated with the client. Both headers are in OpenSSL format. The possible values for the attribute are true and false. The default is false.

          • routing.http.xff_client_port.enabled - Indicates whether the X-Forwarded-For header should preserve the source port that the client used to connect to the load balancer. The possible values are true and false. The default is false.

          • routing.http2.enabled - Indicates whether HTTP/2 is enabled. The possible values are true and false. The default is true. Elastic Load Balancing requires that message header names contain only alphanumeric characters and hyphens.

          • waf.fail_open.enabled - Indicates whether to allow a WAF-enabled load balancer to route requests to targets if it is unable to forward the request to Amazon Web Services WAF. The possible values are true and false. The default is false.

          The following attribute is supported by Network Load Balancers and Gateway Load Balancers:

          • load_balancing.cross_zone.enabled - Indicates whether cross-zone load balancing is enabled. The possible values are true and false. The default is false.

        • Value — (String)

          The value of the attribute.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeLoadBalancers(params = {}, callback) ⇒ AWS.Request

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

Service Reference:

Examples:

To describe a load balancer


/* This example describes the specified load balancer. */

 var params = {
  LoadBalancerArns: [
     "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"
  ]
 };
 elbv2.describeLoadBalancers(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    LoadBalancers: [
       {
      AvailabilityZones: [
         {
        SubnetId: "subnet-8360a9e7", 
        ZoneName: "us-west-2a"
       }, 
         {
        SubnetId: "subnet-b7d581c0", 
        ZoneName: "us-west-2b"
       }
      ], 
      CanonicalHostedZoneId: "Z2P70J7EXAMPLE", 
      CreatedTime: <Date Representation>, 
      DNSName: "my-load-balancer-424835706.us-west-2.elb.amazonaws.com", 
      LoadBalancerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
      LoadBalancerName: "my-load-balancer", 
      Scheme: "internet-facing", 
      SecurityGroups: [
         "sg-5943793c"
      ], 
      State: {
       Code: "active"
      }, 
      Type: "application", 
      VpcId: "vpc-3ac0fb5f"
     }
    ]
   }
   */
 });

Calling the describeLoadBalancers operation

var params = {
  LoadBalancerArns: [
    'STRING_VALUE',
    /* more items */
  ],
  Marker: 'STRING_VALUE',
  Names: [
    'STRING_VALUE',
    /* more items */
  ],
  PageSize: 'NUMBER_VALUE'
};
elbv2.describeLoadBalancers(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • LoadBalancerArns — (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.)

    • PageSize — (Integer)

      The maximum number of results to return with this call.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • LoadBalancers — (Array<map>)

        Information about the load balancers.

        • LoadBalancerArn — (String)

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

        • DNSName — (String)

          The public DNS name of the load balancer.

        • CanonicalHostedZoneId — (String)

          The ID of the Amazon Route 53 hosted zone associated with the load balancer.

        • CreatedTime — (Date)

          The date and time the load balancer was created.

        • LoadBalancerName — (String)

          The name of 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.

          Possible values include:
          • "internet-facing"
          • "internal"
        • VpcId — (String)

          The ID of the VPC for the load balancer.

        • State — (map)

          The state of the load balancer.

          • Code — (String)

            The state code. The initial state of the load balancer is provisioning. After the load balancer is fully set up and ready to route traffic, its state is active. If load balancer is routing traffic but does not have the resources it needs to scale, its state isactive_impaired. If the load balancer could not be set up, its state is failed.

            Possible values include:
            • "active"
            • "provisioning"
            • "active_impaired"
            • "failed"
          • Reason — (String)

            A description of the state.

        • Type — (String)

          The type of load balancer.

          Possible values include:
          • "application"
          • "network"
          • "gateway"
        • AvailabilityZones — (Array<map>)

          The subnets for the load balancer.

          • ZoneName — (String)

            The name of the Availability Zone.

          • SubnetId — (String)

            The ID of the subnet. You can specify one subnet per Availability Zone.

          • OutpostId — (String)

            [Application Load Balancers on Outposts] The ID of the Outpost.

          • LoadBalancerAddresses — (Array<map>)

            [Network Load Balancers] If you need static IP addresses for your load balancer, you can specify one Elastic IP address per Availability Zone when you create an internal-facing load balancer. For internal load balancers, you can specify a private IP address from the IPv4 range of the subnet.

            • IpAddress — (String)

              The static IP address.

            • AllocationId — (String)

              [Network Load Balancers] The allocation ID of the Elastic IP address for an internal-facing load balancer.

            • PrivateIPv4Address — (String)

              [Network Load Balancers] The private IPv4 address for an internal load balancer.

            • IPv6Address — (String)

              [Network Load Balancers] The IPv6 address.

        • SecurityGroups — (Array<String>)

          The IDs of the security groups for the load balancer.

        • IpAddressType — (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).

          Possible values include:
          • "ipv4"
          • "dualstack"
        • CustomerOwnedIpv4Pool — (String)

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

      • NextMarker — (String)

        If there are additional results, this is the marker for the next set of results. Otherwise, this is null.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

Waiter Resource States:

describeRules(params = {}, callback) ⇒ AWS.Request

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

Service Reference:

Examples:

To describe a rule


/* This example describes the specified rule. */

 var params = {
  RuleArns: [
     "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/9683b2d02a6cabee"
  ]
 };
 elbv2.describeRules(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    Rules: [
       {
      Actions: [
         {
        TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
        Type: "forward"
       }
      ], 
      Conditions: [
         {
        Field: "path-pattern", 
        Values: [
           "/img/*"
        ]
       }
      ], 
      IsDefault: false, 
      Priority: "10", 
      RuleArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/9683b2d02a6cabee"
     }
    ]
   }
   */
 });

Calling the describeRules operation

var params = {
  ListenerArn: 'STRING_VALUE',
  Marker: 'STRING_VALUE',
  PageSize: 'NUMBER_VALUE',
  RuleArns: [
    'STRING_VALUE',
    /* more items */
  ]
};
elbv2.describeRules(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ListenerArn — (String)

      The Amazon Resource Name (ARN) of the listener.

    • RuleArns — (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.)

    • PageSize — (Integer)

      The maximum number of results to return with this call.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Rules — (Array<map>)

        Information about the rules.

        • RuleArn — (String)

          The Amazon Resource Name (ARN) of the rule.

        • Priority — (String)

          The priority.

        • Conditions — (Array<map>)

          The conditions. Each rule can include zero or one of the following conditions: http-request-method, host-header, path-pattern, and source-ip, and zero or more of the following conditions: http-header and query-string.

          • Field — (String)

            The field in the HTTP request. The following are the possible values:

            • http-header

            • http-request-method

            • host-header

            • path-pattern

            • query-string

            • source-ip

          • Values — (Array<String>)

            The condition value. Specify only when Field is host-header or path-pattern. Alternatively, to specify multiple host names or multiple path patterns, use HostHeaderConfig or PathPatternConfig.

            If Field is host-header and you are not using HostHeaderConfig, you can specify a single host name (for example, my.example.com) in Values. A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters.

            • A-Z, a-z, 0-9

            • - .

            • (matches 0 or more characters)

            • ? (matches exactly 1 character)

            If Field is path-pattern and you are not using PathPatternConfig, you can specify a single path pattern (for example, /img/) in Values. A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters.

            • A-Z, a-z, 0-9

            • _ - . $ / ~ " ' @ : +

            • & (using &amp;)

            • * (matches 0 or more characters)

            • ? (matches exactly 1 character)

          • HostHeaderConfig — (map)

            Information for a host header condition. Specify only when Field is host-header.

            • Values — (Array<String>)

              One or more host names. The maximum size of each name is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).

              If you specify multiple strings, the condition is satisfied if one of the strings matches the host name.

          • PathPatternConfig — (map)

            Information for a path pattern condition. Specify only when Field is path-pattern.

            • Values — (Array<String>)

              One or more path patterns to compare against the request URL. The maximum size of each string is 128 characters. The comparison is case sensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).

              If you specify multiple strings, the condition is satisfied if one of them matches the request URL. The path pattern is compared only to the path of the URL, not to its query string. To compare against the query string, use QueryStringConditionConfig.

          • HttpHeaderConfig — (map)

            Information for an HTTP header condition. Specify only when Field is http-header.

            • HttpHeaderName — (String)

              The name of the HTTP header field. The maximum size is 40 characters. The header name is case insensitive. The allowed characters are specified by RFC 7230. Wildcards are not supported.

              You can't use an HTTP header condition to specify the host header. Use HostHeaderConditionConfig to specify a host header condition.

            • Values — (Array<String>)

              One or more strings to compare against the value of the HTTP header. The maximum size of each string is 128 characters. The comparison strings are case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).

              If the same header appears multiple times in the request, we search them in order until a match is found.

              If you specify multiple strings, the condition is satisfied if one of the strings matches the value of the HTTP header. To require that all of the strings are a match, create one condition per string.

          • QueryStringConfig — (map)

            Information for a query string condition. Specify only when Field is query-string.

            • Values — (Array<map>)

              One or more key/value pairs or values to find in the query string. The maximum size of each string is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character). To search for a literal '*' or '?' character in a query string, you must escape these characters in Values using a '\' character.

              If you specify multiple key/value pairs or values, the condition is satisfied if one of them is found in the query string.

              • Key — (String)

                The key. You can omit the key.

              • Value — (String)

                The value.

          • HttpRequestMethodConfig — (map)

            Information for an HTTP method condition. Specify only when Field is http-request-method.

            • Values — (Array<String>)

              The name of the request method. The maximum size is 40 characters. The allowed characters are A-Z, hyphen (-), and underscore (_). The comparison is case sensitive. Wildcards are not supported; therefore, the method name must be an exact match.

              If you specify multiple strings, the condition is satisfied if one of the strings matches the HTTP request method. We recommend that you route GET and HEAD requests in the same way, because the response to a HEAD request may be cached.

          • SourceIpConfig — (map)

            Information for a source IP condition. Specify only when Field is source-ip.

            • Values — (Array<String>)

              One or more source IP addresses, in CIDR format. You can use both IPv4 and IPv6 addresses. Wildcards are not supported.

              If you specify multiple addresses, the condition is satisfied if the source IP address of the request matches one of the CIDR blocks. This condition is not satisfied by the addresses in the X-Forwarded-For header. To search for addresses in the X-Forwarded-For header, use HttpHeaderConditionConfig.

        • Actions — (Array<map>)

          The actions. Each rule must include exactly one of the following types of actions: forward, redirect, or fixed-response, and it must be the last action to be performed.

          • Typerequired — (String)

            The type of action.

            Possible values include:
            • "forward"
            • "authenticate-oidc"
            • "authenticate-cognito"
            • "redirect"
            • "fixed-response"
          • TargetGroupArn — (String)

            The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward and you want to route to a single target group. To route to one or more target groups, use ForwardConfig instead.

          • AuthenticateOidcConfig — (map)

            [HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc.

            • Issuerrequired — (String)

              The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • AuthorizationEndpointrequired — (String)

              The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • TokenEndpointrequired — (String)

              The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • UserInfoEndpointrequired — (String)

              The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • ClientIdrequired — (String)

              The OAuth 2.0 client identifier.

            • ClientSecret — (String)

              The OAuth 2.0 client secret. This parameter is required if you are creating a rule. If you are modifying a rule, you can omit this parameter if you set UseExistingClientSecret to true.

            • SessionCookieName — (String)

              The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.

            • Scope — (String)

              The set of user claims to be requested from the IdP. The default is openid.

              To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.

            • SessionTimeout — (Integer)

              The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).

            • AuthenticationRequestExtraParams — (map<String>)

              The query parameters (up to 10) to include in the redirect request to the authorization endpoint.

            • OnUnauthenticatedRequest — (String)

              The behavior if the user is not authenticated. The following are possible values:

              • deny - Return an HTTP 401 Unauthorized error.

              • allow - Allow the request to be forwarded to the target.

              • authenticate - Redirect the request to the IdP authorization endpoint. This is the default value.

              Possible values include:
              • "deny"
              • "allow"
              • "authenticate"
            • UseExistingClientSecret — (Boolean)

              Indicates whether to use the existing client secret when modifying a rule. If you are creating a rule, you can omit this parameter or set it to false.

          • AuthenticateCognitoConfig — (map)

            [HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only when Type is authenticate-cognito.

            • UserPoolArnrequired — (String)

              The Amazon Resource Name (ARN) of the Amazon Cognito user pool.

            • UserPoolClientIdrequired — (String)

              The ID of the Amazon Cognito user pool client.

            • UserPoolDomainrequired — (String)

              The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.

            • SessionCookieName — (String)

              The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.

            • Scope — (String)

              The set of user claims to be requested from the IdP. The default is openid.

              To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.

            • SessionTimeout — (Integer)

              The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).

            • AuthenticationRequestExtraParams — (map<String>)

              The query parameters (up to 10) to include in the redirect request to the authorization endpoint.

            • OnUnauthenticatedRequest — (String)

              The behavior if the user is not authenticated. The following are possible values:

              • deny - Return an HTTP 401 Unauthorized error.

              • allow - Allow the request to be forwarded to the target.

              • authenticate - Redirect the request to the IdP authorization endpoint. This is the default value.

              Possible values include:
              • "deny"
              • "allow"
              • "authenticate"
          • Order — (Integer)

            The order for the action. This value is required for rules with multiple actions. The action with the lowest value for order is performed first.

          • RedirectConfig — (map)

            [Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect.

            • Protocol — (String)

              The protocol. You can specify HTTP, HTTPS, or #{protocol}. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You cannot redirect HTTPS to HTTP.

            • Port — (String)

              The port. You can specify a value from 1 to 65535 or #{port}.

            • Host — (String)

              The hostname. This component is not percent-encoded. The hostname can contain #{host}.

            • Path — (String)

              The absolute path, starting with the leading "/". This component is not percent-encoded. The path can contain #{host}, #{path}, and #{port}.

            • Query — (String)

              The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.

            • StatusCoderequired — (String)

              The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).

              Possible values include:
              • "HTTP_301"
              • "HTTP_302"
          • FixedResponseConfig — (map)

            [Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only when Type is fixed-response.

            • MessageBody — (String)

              The message.

            • StatusCoderequired — (String)

              The HTTP response code (2XX, 4XX, or 5XX).

            • ContentType — (String)

              The content type.

              Valid Values: text/plain | text/css | text/html | application/javascript | application/json

          • ForwardConfig — (map)

            Information for creating an action that distributes requests among one or more target groups. For Network Load Balancers, you can specify a single target group. Specify only when Type is forward. If you specify both ForwardConfig and TargetGroupArn, you can specify only one target group using ForwardConfig and it must be the same target group specified in TargetGroupArn.

            • TargetGroups — (Array<map>)

              One or more target groups. For Network Load Balancers, you can specify a single target group.

              • TargetGroupArn — (String)

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

              • Weight — (Integer)

                The weight. The range is 0 to 999.

            • TargetGroupStickinessConfig — (map)

              The target group stickiness for the rule.

              • Enabled — (Boolean)

                Indicates whether target group stickiness is enabled.

              • DurationSeconds — (Integer)

                The time period, in seconds, during which requests from a client should be routed to the same target group. The range is 1-604800 seconds (7 days).

        • IsDefault — (Boolean)

          Indicates whether this is the default rule.

      • NextMarker — (String)

        If there are additional results, this is the marker for the next set of results. Otherwise, this is null.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeSSLPolicies(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

To describe a policy used for SSL negotiation


/* This example describes the specified policy used for SSL negotiation. */

 var params = {
  Names: [
     "ELBSecurityPolicy-2015-05"
  ]
 };
 elbv2.describeSSLPolicies(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    SslPolicies: [
       {
      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", 
      SslProtocols: [
         "TLSv1", 
         "TLSv1.1", 
         "TLSv1.2"
      ]
     }
    ]
   }
   */
 });

Calling the describeSSLPolicies operation

var params = {
  LoadBalancerType: application | network | gateway,
  Marker: 'STRING_VALUE',
  Names: [
    'STRING_VALUE',
    /* more items */
  ],
  PageSize: 'NUMBER_VALUE'
};
elbv2.describeSSLPolicies(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • 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.)

    • PageSize — (Integer)

      The maximum number of results to return with this call.

    • LoadBalancerType — (String)

      The type of load balancer. The default lists the SSL policies for all load balancers.

      Possible values include:
      • "application"
      • "network"
      • "gateway"

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • SslPolicies — (Array<map>)

        Information about the security policies.

        • SslProtocols — (Array<String>)

          The protocols.

        • Ciphers — (Array<map>)

          The ciphers.

          • Name — (String)

            The name of the cipher.

          • Priority — (Integer)

            The priority of the cipher.

        • Name — (String)

          The name of the policy.

        • SupportedLoadBalancerTypes — (Array<String>)

          The supported load balancers.

      • NextMarker — (String)

        If there are additional results, this is the marker for the next set of results. Otherwise, this is null.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeTags(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

To describe the tags assigned to a load balancer


/* This example describes the tags assigned to the specified load balancer. */

 var params = {
  ResourceArns: [
     "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"
  ]
 };
 elbv2.describeTags(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    TagDescriptions: [
       {
      ResourceArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
      Tags: [
         {
        Key: "project", 
        Value: "lima"
       }, 
         {
        Key: "department", 
        Value: "digital-media"
       }
      ]
     }
    ]
   }
   */
 });

Calling the describeTags operation

var params = {
  ResourceArns: [ /* required */
    'STRING_VALUE',
    /* more items */
  ]
};
elbv2.describeTags(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ResourceArns — (Array<String>)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • TagDescriptions — (Array<map>)

        Information about the tags.

        • ResourceArn — (String)

          The Amazon Resource Name (ARN) of the resource.

        • Tags — (Array<map>)

          Information about the tags.

          • Keyrequired — (String)

            The key of the tag.

          • Value — (String)

            The value of the tag.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeTargetGroupAttributes(params = {}, callback) ⇒ AWS.Request

Describes the attributes for the specified target group.

For more information, see the following:

Service Reference:

Examples:

To describe target group attributes


/* This example describes the attributes of the specified target group. */

 var params = {
  TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067"
 };
 elbv2.describeTargetGroupAttributes(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    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"
     }
    ]
   }
   */
 });

Calling the describeTargetGroupAttributes operation

var params = {
  TargetGroupArn: 'STRING_VALUE' /* required */
};
elbv2.describeTargetGroupAttributes(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • TargetGroupArn — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Attributes — (Array<map>)

        Information about the target group attributes

        • Key — (String)

          The name of the attribute.

          The following attribute is supported by all load balancers:

          • deregistration_delay.timeout_seconds - The amount of time, in seconds, for Elastic Load Balancing to wait before changing the state of a deregistering target from draining to unused. The range is 0-3600 seconds. The default value is 300 seconds. If the target is a Lambda function, this attribute is not supported.

          The following attributes are supported by both Application Load Balancers and Network Load Balancers:

          • stickiness.enabled - Indicates whether sticky sessions are enabled. The value is true or false. The default is false.

          • stickiness.type - The type of sticky sessions. The possible values are lb_cookie and app_cookie for Application Load Balancers or source_ip for Network Load Balancers.

          The following attributes are supported only if the load balancer is an Application Load Balancer and the target is an instance or an IP address:

          • load_balancing.algorithm.type - The load balancing algorithm determines how the load balancer selects targets when routing requests. The value is round_robin or least_outstanding_requests. The default is round_robin.

          • slow_start.duration_seconds - The time period, in seconds, during which a newly registered target receives an increasing share of the traffic to the target group. After this time period ends, the target receives its full share of traffic. The range is 30-900 seconds (15 minutes). The default is 0 seconds (disabled).

          • stickiness.app_cookie.cookie_name - Indicates the name of the application-based cookie. Names that start with the following prefixes are not allowed: AWSALB, AWSALBAPP, and AWSALBTG; they're reserved for use by the load balancer.

          • stickiness.app_cookie.duration_seconds - The time period, in seconds, during which requests from a client should be routed to the same target. After this time period expires, the application-based cookie is considered stale. The range is 1 second to 1 week (604800 seconds). The default value is 1 day (86400 seconds).

          • stickiness.lb_cookie.duration_seconds - The time period, in seconds, during which requests from a client should be routed to the same target. After this time period expires, the load balancer-generated cookie is considered stale. The range is 1 second to 1 week (604800 seconds). The default value is 1 day (86400 seconds).

          The following attribute is supported only if the load balancer is an Application Load Balancer and the target is a Lambda function:

          • lambda.multi_value_headers.enabled - Indicates whether the request and response headers that are exchanged between the load balancer and the Lambda function include arrays of values or strings. The value is true or false. The default is false. If the value is false and the request contains a duplicate header field name or query parameter key, the load balancer uses the last value sent by the client.

          The following attributes are supported only by Network Load Balancers:

          • deregistration_delay.connection_termination.enabled - Indicates whether the load balancer terminates connections at the end of the deregistration timeout. The value is true or false. The default is false.

          • preserve_client_ip.enabled - Indicates whether client IP preservation is enabled. The value is true or false. The default is disabled if the target group type is IP address and the target group protocol is TCP or TLS. Otherwise, the default is enabled. Client IP preservation cannot be disabled for UDP and TCP_UDP target groups.

          • proxy_protocol_v2.enabled - Indicates whether Proxy Protocol version 2 is enabled. The value is true or false. The default is false.

        • Value — (String)

          The value of the attribute.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeTargetGroups(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

To describe a target group


/* This example describes the specified target group. */

 var params = {
  TargetGroupArns: [
     "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067"
  ]
 };
 elbv2.describeTargetGroups(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    TargetGroups: [
       {
      HealthCheckIntervalSeconds: 30, 
      HealthCheckPath: "/", 
      HealthCheckPort: "traffic-port", 
      HealthCheckProtocol: "HTTP", 
      HealthCheckTimeoutSeconds: 5, 
      HealthyThresholdCount: 5, 
      LoadBalancerArns: [
         "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"
      ], 
      Matcher: {
       HttpCode: "200"
      }, 
      Port: 80, 
      Protocol: "HTTP", 
      TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
      TargetGroupName: "my-targets", 
      UnhealthyThresholdCount: 2, 
      VpcId: "vpc-3ac0fb5f"
     }
    ]
   }
   */
 });

Calling the describeTargetGroups operation

var params = {
  LoadBalancerArn: 'STRING_VALUE',
  Marker: 'STRING_VALUE',
  Names: [
    'STRING_VALUE',
    /* more items */
  ],
  PageSize: 'NUMBER_VALUE',
  TargetGroupArns: [
    'STRING_VALUE',
    /* more items */
  ]
};
elbv2.describeTargetGroups(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • LoadBalancerArn — (String)

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

    • TargetGroupArns — (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.)

    • PageSize — (Integer)

      The maximum number of results to return with this call.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • TargetGroups — (Array<map>)

        Information about the target groups.

        • TargetGroupArn — (String)

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

        • TargetGroupName — (String)

          The name of the target group.

        • Protocol — (String)

          The protocol to use for routing traffic to the targets.

          Possible values include:
          • "HTTP"
          • "HTTPS"
          • "TCP"
          • "TLS"
          • "UDP"
          • "TCP_UDP"
          • "GENEVE"
        • Port — (Integer)

          The port on which the targets are listening. Not used if the target is a Lambda function.

        • VpcId — (String)

          The ID of the VPC for the targets.

        • HealthCheckProtocol — (String)

          The protocol to use to connect with the target. The GENEVE, TLS, UDP, and TCP_UDP protocols are not supported for health checks.

          Possible values include:
          • "HTTP"
          • "HTTPS"
          • "TCP"
          • "TLS"
          • "UDP"
          • "TCP_UDP"
          • "GENEVE"
        • HealthCheckPort — (String)

          The port to use to connect with the target.

        • HealthCheckEnabled — (Boolean)

          Indicates whether health checks are enabled.

        • HealthCheckIntervalSeconds — (Integer)

          The approximate amount of time, in seconds, between health checks of an individual target.

        • HealthCheckTimeoutSeconds — (Integer)

          The amount of time, in seconds, during which no response means a failed health check.

        • HealthyThresholdCount — (Integer)

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

        • UnhealthyThresholdCount — (Integer)

          The number of consecutive health check failures required before considering the target unhealthy.

        • HealthCheckPath — (String)

          The destination for health checks on the targets.

        • Matcher — (map)

          The HTTP or gRPC codes to use when checking for a successful response from a target.

          • HttpCode — (String)

            For Application Load Balancers, you can specify values between 200 and 499, and the default value is 200. You can specify multiple values (for example, "200,202") or a range of values (for example, "200-299").

            For Network Load Balancers and Gateway Load Balancers, this must be "200–399".

            Note that when using shorthand syntax, some values such as commas need to be escaped.

          • GrpcCode — (String)

            You can specify values between 0 and 99. You can specify multiple values (for example, "0,1") or a range of values (for example, "0-5"). The default value is 12.

        • LoadBalancerArns — (Array<String>)

          The Amazon Resource Names (ARN) of the load balancers that route traffic to this target group.

        • TargetType — (String)

          The type of target that you must specify when registering targets with this target group. The possible values are instance (register targets by instance ID), ip (register targets by IP address), lambda (register a single Lambda function as a target), or alb (register a single Application Load Balancer as a target).

          Possible values include:
          • "instance"
          • "ip"
          • "lambda"
          • "alb"
        • ProtocolVersion — (String)

          [HTTP/HTTPS protocol] The protocol version. The possible values are GRPC, HTTP1, and HTTP2.

        • IpAddressType — (String)

          The type of IP address used for this target group. The possible values are ipv4 and ipv6. This is an optional parameter. If not specified, the IP address type defaults to ipv4.

          Possible values include:
          • "ipv4"
          • "ipv6"
      • NextMarker — (String)

        If there are additional results, this is the marker for the next set of results. Otherwise, this is null.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeTargetHealth(params = {}, callback) ⇒ AWS.Request

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

Service Reference:

Examples:

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

 var params = {
  TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067"
 };
 elbv2.describeTargetHealth(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    TargetHealthDescriptions: [
       {
      Target: {
       Id: "i-0f76fade", 
       Port: 80
      }, 
      TargetHealth: {
       Description: "Given target group is not configured to receive traffic from ELB", 
       Reason: "Target.NotInUse", 
       State: "unused"
      }
     }, 
       {
      HealthCheckPort: "80", 
      Target: {
       Id: "i-0f76fade", 
       Port: 80
      }, 
      TargetHealth: {
       State: "healthy"
      }
     }
    ]
   }
   */
 });

To describe the health of a target


/* This example describes the health of the specified target. This target is healthy. */

 var params = {
  TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
  Targets: [
     {
    Id: "i-0f76fade", 
    Port: 80
   }
  ]
 };
 elbv2.describeTargetHealth(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    TargetHealthDescriptions: [
       {
      HealthCheckPort: "80", 
      Target: {
       Id: "i-0f76fade", 
       Port: 80
      }, 
      TargetHealth: {
       State: "healthy"
      }
     }
    ]
   }
   */
 });

Calling the describeTargetHealth operation

var params = {
  TargetGroupArn: 'STRING_VALUE', /* required */
  Targets: [
    {
      Id: 'STRING_VALUE', /* required */
      AvailabilityZone: 'STRING_VALUE',
      Port: 'NUMBER_VALUE'
    },
    /* more items */
  ]
};
elbv2.describeTargetHealth(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • TargetGroupArn — (String)

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

    • Targets — (Array<map>)

      The targets.

      • Idrequired — (String)

        The ID of the target. If the target type of the target group is instance, specify an instance ID. If the target type is ip, specify an IP address. If the target type is lambda, specify the ARN of the Lambda function. If the target type is alb, specify the ARN of the Application Load Balancer target.

      • Port — (Integer)

        The port on which the target is listening. If the target group protocol is GENEVE, the supported port is 6081. If the target type is alb, the targeted Application Load Balancer must have at least one listener whose port matches the target group port. Not used if the target is a Lambda function.

      • AvailabilityZone — (String)

        An Availability Zone or all. This determines whether the target receives traffic from the load balancer nodes in the specified Availability Zone or from all enabled Availability Zones for the load balancer.

        This parameter is not supported if the target type of the target group is instance or alb.

        If the target type is ip and the IP address is in a subnet of the VPC for the target group, the Availability Zone is automatically detected and this parameter is optional. If the IP address is outside the VPC, this parameter is required.

        With an Application Load Balancer, if the target type is ip and the IP address is outside the VPC for the target group, the only supported value is all.

        If the target type is lambda, this parameter is optional and the only supported value is all.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • TargetHealthDescriptions — (Array<map>)

        Information about the health of the targets.

        • Target — (map)

          The description of the target.

          • Idrequired — (String)

            The ID of the target. If the target type of the target group is instance, specify an instance ID. If the target type is ip, specify an IP address. If the target type is lambda, specify the ARN of the Lambda function. If the target type is alb, specify the ARN of the Application Load Balancer target.

          • Port — (Integer)

            The port on which the target is listening. If the target group protocol is GENEVE, the supported port is 6081. If the target type is alb, the targeted Application Load Balancer must have at least one listener whose port matches the target group port. Not used if the target is a Lambda function.

          • AvailabilityZone — (String)

            An Availability Zone or all. This determines whether the target receives traffic from the load balancer nodes in the specified Availability Zone or from all enabled Availability Zones for the load balancer.

            This parameter is not supported if the target type of the target group is instance or alb.

            If the target type is ip and the IP address is in a subnet of the VPC for the target group, the Availability Zone is automatically detected and this parameter is optional. If the IP address is outside the VPC, this parameter is required.

            With an Application Load Balancer, if the target type is ip and the IP address is outside the VPC for the target group, the only supported value is all.

            If the target type is lambda, this parameter is optional and the only supported value is all.

        • HealthCheckPort — (String)

          The port to use to connect with the target.

        • TargetHealth — (map)

          The health information for the target.

          • State — (String)

            The state of the target.

            Possible values include:
            • "initial"
            • "healthy"
            • "unhealthy"
            • "unused"
            • "draining"
            • "unavailable"
          • Reason — (String)

            The reason code.

            If the target state is healthy, a reason code is not provided.

            If the target state is initial, the reason code can be one of the following values:

            • Elb.RegistrationInProgress - The target is in the process of being registered with the load balancer.

            • Elb.InitialHealthChecking - The load balancer is still sending the target the minimum number of health checks required to determine its health status.

            If the target state is unhealthy, the reason code can be one of the following values:

            • Target.ResponseCodeMismatch - The health checks did not return an expected HTTP code. Applies only to Application Load Balancers and Gateway Load Balancers.

            • Target.Timeout - The health check requests timed out. Applies only to Application Load Balancers and Gateway Load Balancers.

            • Target.FailedHealthChecks - The load balancer received an error while establishing a connection to the target or the target response was malformed.

            • Elb.InternalError - The health checks failed due to an internal error. Applies only to Application Load Balancers.

            If the target state is unused, the reason code can be one of the following values:

            • Target.NotRegistered - The target is not registered with the target group.

            • Target.NotInUse - The target group is not used by any load balancer or the target is in an Availability Zone that is not enabled for its load balancer.

            • Target.InvalidState - The target is in the stopped or terminated state.

            • Target.IpUnusable - The target IP address is reserved for use by a load balancer.

            If the target state is draining, the reason code can be the following value:

            • Target.DeregistrationInProgress - The target is in the process of being deregistered and the deregistration delay period has not expired.

            If the target state is unavailable, the reason code can be the following value:

            • Target.HealthCheckDisabled - Health checks are disabled for the target group. Applies only to Application Load Balancers.

            • Elb.InternalError - Target health is unavailable due to an internal error. Applies only to Network Load Balancers.

            Possible values include:
            • "Elb.RegistrationInProgress"
            • "Elb.InitialHealthChecking"
            • "Target.ResponseCodeMismatch"
            • "Target.Timeout"
            • "Target.FailedHealthChecks"
            • "Target.NotRegistered"
            • "Target.NotInUse"
            • "Target.DeregistrationInProgress"
            • "Target.InvalidState"
            • "Target.IpUnusable"
            • "Target.HealthCheckDisabled"
            • "Elb.InternalError"
          • Description — (String)

            A description of the target health that provides additional details. If the state is healthy, a description is not provided.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

Waiter Resource States:

modifyListener(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

To change the default action for a listener


/* This example changes the default action for the specified listener. */

 var params = {
  DefaultActions: [
     {
    TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/2453ed029918f21f", 
    Type: "forward"
   }
  ], 
  ListenerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2"
 };
 elbv2.modifyListener(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    Listeners: [
       {
      DefaultActions: [
         {
        TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/2453ed029918f21f", 
        Type: "forward"
       }
      ], 
      ListenerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2", 
      LoadBalancerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
      Port: 80, 
      Protocol: "HTTP"
     }
    ]
   }
   */
 });

To change the server certificate


/* This example changes the server certificate for the specified HTTPS listener. */

 var params = {
  Certificates: [
     {
    CertificateArn: "arn:aws:iam::123456789012:server-certificate/my-new-server-cert"
   }
  ], 
  ListenerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/0467ef3c8400ae65"
 };
 elbv2.modifyListener(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    Listeners: [
       {
      Certificates: [
         {
        CertificateArn: "arn:aws:iam::123456789012:server-certificate/my-new-server-cert"
       }
      ], 
      DefaultActions: [
         {
        TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
        Type: "forward"
       }
      ], 
      ListenerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/0467ef3c8400ae65", 
      LoadBalancerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
      Port: 443, 
      Protocol: "HTTPS", 
      SslPolicy: "ELBSecurityPolicy-2015-05"
     }
    ]
   }
   */
 });

Calling the modifyListener operation

var params = {
  ListenerArn: 'STRING_VALUE', /* required */
  AlpnPolicy: [
    'STRING_VALUE',
    /* more items */
  ],
  Certificates: [
    {
      CertificateArn: 'STRING_VALUE',
      IsDefault: true || false
    },
    /* more items */
  ],
  DefaultActions: [
    {
      Type: forward | authenticate-oidc | authenticate-cognito | redirect | fixed-response, /* required */
      AuthenticateCognitoConfig: {
        UserPoolArn: 'STRING_VALUE', /* required */
        UserPoolClientId: 'STRING_VALUE', /* required */
        UserPoolDomain: 'STRING_VALUE', /* required */
        AuthenticationRequestExtraParams: {
          '<AuthenticateCognitoActionAuthenticationRequestParamName>': 'STRING_VALUE',
          /* '<AuthenticateCognitoActionAuthenticationRequestParamName>': ... */
        },
        OnUnauthenticatedRequest: deny | allow | authenticate,
        Scope: 'STRING_VALUE',
        SessionCookieName: 'STRING_VALUE',
        SessionTimeout: 'NUMBER_VALUE'
      },
      AuthenticateOidcConfig: {
        AuthorizationEndpoint: 'STRING_VALUE', /* required */
        ClientId: 'STRING_VALUE', /* required */
        Issuer: 'STRING_VALUE', /* required */
        TokenEndpoint: 'STRING_VALUE', /* required */
        UserInfoEndpoint: 'STRING_VALUE', /* required */
        AuthenticationRequestExtraParams: {
          '<AuthenticateOidcActionAuthenticationRequestParamName>': 'STRING_VALUE',
          /* '<AuthenticateOidcActionAuthenticationRequestParamName>': ... */
        },
        ClientSecret: 'STRING_VALUE',
        OnUnauthenticatedRequest: deny | allow | authenticate,
        Scope: 'STRING_VALUE',
        SessionCookieName: 'STRING_VALUE',
        SessionTimeout: 'NUMBER_VALUE',
        UseExistingClientSecret: true || false
      },
      FixedResponseConfig: {
        StatusCode: 'STRING_VALUE', /* required */
        ContentType: 'STRING_VALUE',
        MessageBody: 'STRING_VALUE'
      },
      ForwardConfig: {
        TargetGroupStickinessConfig: {
          DurationSeconds: 'NUMBER_VALUE',
          Enabled: true || false
        },
        TargetGroups: [
          {
            TargetGroupArn: 'STRING_VALUE',
            Weight: 'NUMBER_VALUE'
          },
          /* more items */
        ]
      },
      Order: 'NUMBER_VALUE',
      RedirectConfig: {
        StatusCode: HTTP_301 | HTTP_302, /* required */
        Host: 'STRING_VALUE',
        Path: 'STRING_VALUE',
        Port: 'STRING_VALUE',
        Protocol: 'STRING_VALUE',
        Query: 'STRING_VALUE'
      },
      TargetGroupArn: 'STRING_VALUE'
    },
    /* more items */
  ],
  Port: 'NUMBER_VALUE',
  Protocol: HTTP | HTTPS | TCP | TLS | UDP | TCP_UDP | GENEVE,
  SslPolicy: 'STRING_VALUE'
};
elbv2.modifyListener(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ListenerArn — (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.

      Possible values include:
      • "HTTP"
      • "HTTPS"
      • "TCP"
      • "TLS"
      • "UDP"
      • "TCP_UDP"
      • "GENEVE"
    • SslPolicy — (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<map>)

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

      • CertificateArn — (String)

        The Amazon Resource Name (ARN) of the certificate.

      • IsDefault — (Boolean)

        Indicates whether the certificate is the default certificate. Do not set this value when specifying a certificate as an input. This value is not included in the output when describing a listener, but is included when describing listener certificates.

    • DefaultActions — (Array<map>)

      The actions for the default rule.

      • Typerequired — (String)

        The type of action.

        Possible values include:
        • "forward"
        • "authenticate-oidc"
        • "authenticate-cognito"
        • "redirect"
        • "fixed-response"
      • TargetGroupArn — (String)

        The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward and you want to route to a single target group. To route to one or more target groups, use ForwardConfig instead.

      • AuthenticateOidcConfig — (map)

        [HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc.

        • Issuerrequired — (String)

          The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

        • AuthorizationEndpointrequired — (String)

          The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

        • TokenEndpointrequired — (String)

          The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

        • UserInfoEndpointrequired — (String)

          The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

        • ClientIdrequired — (String)

          The OAuth 2.0 client identifier.

        • ClientSecret — (String)

          The OAuth 2.0 client secret. This parameter is required if you are creating a rule. If you are modifying a rule, you can omit this parameter if you set UseExistingClientSecret to true.

        • SessionCookieName — (String)

          The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.

        • Scope — (String)

          The set of user claims to be requested from the IdP. The default is openid.

          To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.

        • SessionTimeout — (Integer)

          The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).

        • AuthenticationRequestExtraParams — (map<String>)

          The query parameters (up to 10) to include in the redirect request to the authorization endpoint.

        • OnUnauthenticatedRequest — (String)

          The behavior if the user is not authenticated. The following are possible values:

          • deny - Return an HTTP 401 Unauthorized error.

          • allow - Allow the request to be forwarded to the target.

          • authenticate - Redirect the request to the IdP authorization endpoint. This is the default value.

          Possible values include:
          • "deny"
          • "allow"
          • "authenticate"
        • UseExistingClientSecret — (Boolean)

          Indicates whether to use the existing client secret when modifying a rule. If you are creating a rule, you can omit this parameter or set it to false.

      • AuthenticateCognitoConfig — (map)

        [HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only when Type is authenticate-cognito.

        • UserPoolArnrequired — (String)

          The Amazon Resource Name (ARN) of the Amazon Cognito user pool.

        • UserPoolClientIdrequired — (String)

          The ID of the Amazon Cognito user pool client.

        • UserPoolDomainrequired — (String)

          The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.

        • SessionCookieName — (String)

          The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.

        • Scope — (String)

          The set of user claims to be requested from the IdP. The default is openid.

          To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.

        • SessionTimeout — (Integer)

          The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).

        • AuthenticationRequestExtraParams — (map<String>)

          The query parameters (up to 10) to include in the redirect request to the authorization endpoint.

        • OnUnauthenticatedRequest — (String)

          The behavior if the user is not authenticated. The following are possible values:

          • deny - Return an HTTP 401 Unauthorized error.

          • allow - Allow the request to be forwarded to the target.

          • authenticate - Redirect the request to the IdP authorization endpoint. This is the default value.

          Possible values include:
          • "deny"
          • "allow"
          • "authenticate"
      • Order — (Integer)

        The order for the action. This value is required for rules with multiple actions. The action with the lowest value for order is performed first.

      • RedirectConfig — (map)

        [Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect.

        • Protocol — (String)

          The protocol. You can specify HTTP, HTTPS, or #{protocol}. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You cannot redirect HTTPS to HTTP.

        • Port — (String)

          The port. You can specify a value from 1 to 65535 or #{port}.

        • Host — (String)

          The hostname. This component is not percent-encoded. The hostname can contain #{host}.

        • Path — (String)

          The absolute path, starting with the leading "/". This component is not percent-encoded. The path can contain #{host}, #{path}, and #{port}.

        • Query — (String)

          The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.

        • StatusCoderequired — (String)

          The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).

          Possible values include:
          • "HTTP_301"
          • "HTTP_302"
      • FixedResponseConfig — (map)

        [Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only when Type is fixed-response.

        • MessageBody — (String)

          The message.

        • StatusCoderequired — (String)

          The HTTP response code (2XX, 4XX, or 5XX).

        • ContentType — (String)

          The content type.

          Valid Values: text/plain | text/css | text/html | application/javascript | application/json

      • ForwardConfig — (map)

        Information for creating an action that distributes requests among one or more target groups. For Network Load Balancers, you can specify a single target group. Specify only when Type is forward. If you specify both ForwardConfig and TargetGroupArn, you can specify only one target group using ForwardConfig and it must be the same target group specified in TargetGroupArn.

        • TargetGroups — (Array<map>)

          One or more target groups. For Network Load Balancers, you can specify a single target group.

          • TargetGroupArn — (String)

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

          • Weight — (Integer)

            The weight. The range is 0 to 999.

        • TargetGroupStickinessConfig — (map)

          The target group stickiness for the rule.

          • Enabled — (Boolean)

            Indicates whether target group stickiness is enabled.

          • DurationSeconds — (Integer)

            The time period, in seconds, during which requests from a client should be routed to the same target group. The range is 1-604800 seconds (7 days).

    • AlpnPolicy — (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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Listeners — (Array<map>)

        Information about the modified listener.

        • ListenerArn — (String)

          The Amazon Resource Name (ARN) of the listener.

        • LoadBalancerArn — (String)

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

        • Port — (Integer)

          The port on which the load balancer is listening.

        • Protocol — (String)

          The protocol for connections from clients to the load balancer.

          Possible values include:
          • "HTTP"
          • "HTTPS"
          • "TCP"
          • "TLS"
          • "UDP"
          • "TCP_UDP"
          • "GENEVE"
        • Certificates — (Array<map>)

          [HTTPS or TLS listener] The default certificate for the listener.

          • CertificateArn — (String)

            The Amazon Resource Name (ARN) of the certificate.

          • IsDefault — (Boolean)

            Indicates whether the certificate is the default certificate. Do not set this value when specifying a certificate as an input. This value is not included in the output when describing a listener, but is included when describing listener certificates.

        • SslPolicy — (String)

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

        • DefaultActions — (Array<map>)

          The default actions for the listener.

          • Typerequired — (String)

            The type of action.

            Possible values include:
            • "forward"
            • "authenticate-oidc"
            • "authenticate-cognito"
            • "redirect"
            • "fixed-response"
          • TargetGroupArn — (String)

            The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward and you want to route to a single target group. To route to one or more target groups, use ForwardConfig instead.

          • AuthenticateOidcConfig — (map)

            [HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc.

            • Issuerrequired — (String)

              The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • AuthorizationEndpointrequired — (String)

              The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • TokenEndpointrequired — (String)

              The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • UserInfoEndpointrequired — (String)

              The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • ClientIdrequired — (String)

              The OAuth 2.0 client identifier.

            • ClientSecret — (String)

              The OAuth 2.0 client secret. This parameter is required if you are creating a rule. If you are modifying a rule, you can omit this parameter if you set UseExistingClientSecret to true.

            • SessionCookieName — (String)

              The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.

            • Scope — (String)

              The set of user claims to be requested from the IdP. The default is openid.

              To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.

            • SessionTimeout — (Integer)

              The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).

            • AuthenticationRequestExtraParams — (map<String>)

              The query parameters (up to 10) to include in the redirect request to the authorization endpoint.

            • OnUnauthenticatedRequest — (String)

              The behavior if the user is not authenticated. The following are possible values:

              • deny - Return an HTTP 401 Unauthorized error.

              • allow - Allow the request to be forwarded to the target.

              • authenticate - Redirect the request to the IdP authorization endpoint. This is the default value.

              Possible values include:
              • "deny"
              • "allow"
              • "authenticate"
            • UseExistingClientSecret — (Boolean)

              Indicates whether to use the existing client secret when modifying a rule. If you are creating a rule, you can omit this parameter or set it to false.

          • AuthenticateCognitoConfig — (map)

            [HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only when Type is authenticate-cognito.

            • UserPoolArnrequired — (String)

              The Amazon Resource Name (ARN) of the Amazon Cognito user pool.

            • UserPoolClientIdrequired — (String)

              The ID of the Amazon Cognito user pool client.

            • UserPoolDomainrequired — (String)

              The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.

            • SessionCookieName — (String)

              The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.

            • Scope — (String)

              The set of user claims to be requested from the IdP. The default is openid.

              To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.

            • SessionTimeout — (Integer)

              The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).

            • AuthenticationRequestExtraParams — (map<String>)

              The query parameters (up to 10) to include in the redirect request to the authorization endpoint.

            • OnUnauthenticatedRequest — (String)

              The behavior if the user is not authenticated. The following are possible values:

              • deny - Return an HTTP 401 Unauthorized error.

              • allow - Allow the request to be forwarded to the target.

              • authenticate - Redirect the request to the IdP authorization endpoint. This is the default value.

              Possible values include:
              • "deny"
              • "allow"
              • "authenticate"
          • Order — (Integer)

            The order for the action. This value is required for rules with multiple actions. The action with the lowest value for order is performed first.

          • RedirectConfig — (map)

            [Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect.

            • Protocol — (String)

              The protocol. You can specify HTTP, HTTPS, or #{protocol}. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You cannot redirect HTTPS to HTTP.

            • Port — (String)

              The port. You can specify a value from 1 to 65535 or #{port}.

            • Host — (String)

              The hostname. This component is not percent-encoded. The hostname can contain #{host}.

            • Path — (String)

              The absolute path, starting with the leading "/". This component is not percent-encoded. The path can contain #{host}, #{path}, and #{port}.

            • Query — (String)

              The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.

            • StatusCoderequired — (String)

              The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).

              Possible values include:
              • "HTTP_301"
              • "HTTP_302"
          • FixedResponseConfig — (map)

            [Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only when Type is fixed-response.

            • MessageBody — (String)

              The message.

            • StatusCoderequired — (String)

              The HTTP response code (2XX, 4XX, or 5XX).

            • ContentType — (String)

              The content type.

              Valid Values: text/plain | text/css | text/html | application/javascript | application/json

          • ForwardConfig — (map)

            Information for creating an action that distributes requests among one or more target groups. For Network Load Balancers, you can specify a single target group. Specify only when Type is forward. If you specify both ForwardConfig and TargetGroupArn, you can specify only one target group using ForwardConfig and it must be the same target group specified in TargetGroupArn.

            • TargetGroups — (Array<map>)

              One or more target groups. For Network Load Balancers, you can specify a single target group.

              • TargetGroupArn — (String)

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

              • Weight — (Integer)

                The weight. The range is 0 to 999.

            • TargetGroupStickinessConfig — (map)

              The target group stickiness for the rule.

              • Enabled — (Boolean)

                Indicates whether target group stickiness is enabled.

              • DurationSeconds — (Integer)

                The time period, in seconds, during which requests from a client should be routed to the same target group. The range is 1-604800 seconds (7 days).

        • AlpnPolicy — (Array<String>)

          [TLS listener] The name of the Application-Layer Protocol Negotiation (ALPN) policy.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

modifyLoadBalancerAttributes(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

To enable deletion protection


/* This example enables deletion protection for the specified load balancer. */

 var params = {
  Attributes: [
     {
    Key: "deletion_protection.enabled", 
    Value: "true"
   }
  ], 
  LoadBalancerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"
 };
 elbv2.modifyLoadBalancerAttributes(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    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: ""
     }
    ]
   }
   */
 });

To change the idle timeout


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

 var params = {
  Attributes: [
     {
    Key: "idle_timeout.timeout_seconds", 
    Value: "30"
   }
  ], 
  LoadBalancerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"
 };
 elbv2.modifyLoadBalancerAttributes(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    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: ""
     }
    ]
   }
   */
 });

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

 var params = {
  Attributes: [
     {
    Key: "access_logs.s3.enabled", 
    Value: "true"
   }, 
     {
    Key: "access_logs.s3.bucket", 
    Value: "my-loadbalancer-logs"
   }, 
     {
    Key: "access_logs.s3.prefix", 
    Value: "myapp"
   }
  ], 
  LoadBalancerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"
 };
 elbv2.modifyLoadBalancerAttributes(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    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"
     }
    ]
   }
   */
 });

Calling the modifyLoadBalancerAttributes operation

var params = {
  Attributes: [ /* required */
    {
      Key: 'STRING_VALUE',
      Value: 'STRING_VALUE'
    },
    /* more items */
  ],
  LoadBalancerArn: 'STRING_VALUE' /* required */
};
elbv2.modifyLoadBalancerAttributes(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • LoadBalancerArn — (String)

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

    • Attributes — (Array<map>)

      The load balancer attributes.

      • Key — (String)

        The name of the attribute.

        The following attribute is supported by all load balancers:

        • deletion_protection.enabled - Indicates whether deletion protection is enabled. The value is true or false. The default is false.

        The following attributes are supported by both Application Load Balancers and Network Load Balancers:

        • access_logs.s3.enabled - Indicates whether access logs are enabled. The value is true or false. The default is false.

        • access_logs.s3.bucket - The name of the S3 bucket for the access logs. This attribute is required if access logs are enabled. The bucket must exist in the same region as the load balancer and have a bucket policy that grants Elastic Load Balancing permissions to write to the bucket.

        • access_logs.s3.prefix - The prefix for the location in the S3 bucket for the access logs.

        The following attributes are supported by only Application Load Balancers:

        • idle_timeout.timeout_seconds - The idle timeout value, in seconds. The valid range is 1-4000 seconds. The default is 60 seconds.

        • routing.http.desync_mitigation_mode - Determines how the load balancer handles requests that might pose a security risk to your application. The possible values are monitor, defensive, and strictest. The default is defensive.

        • routing.http.drop_invalid_header_fields.enabled - Indicates whether HTTP headers with invalid header fields are removed by the load balancer (true) or routed to targets (false). The default is false.

        • routing.http.x_amzn_tls_version_and_cipher_suite.enabled - Indicates whether the two headers (x-amzn-tls-version and x-amzn-tls-cipher-suite), which contain information about the negotiated TLS version and cipher suite, are added to the client request before sending it to the target. The x-amzn-tls-version header has information about the TLS protocol version negotiated with the client, and the x-amzn-tls-cipher-suite header has information about the cipher suite negotiated with the client. Both headers are in OpenSSL format. The possible values for the attribute are true and false. The default is false.

        • routing.http.xff_client_port.enabled - Indicates whether the X-Forwarded-For header should preserve the source port that the client used to connect to the load balancer. The possible values are true and false. The default is false.

        • routing.http2.enabled - Indicates whether HTTP/2 is enabled. The possible values are true and false. The default is true. Elastic Load Balancing requires that message header names contain only alphanumeric characters and hyphens.

        • waf.fail_open.enabled - Indicates whether to allow a WAF-enabled load balancer to route requests to targets if it is unable to forward the request to Amazon Web Services WAF. The possible values are true and false. The default is false.

        The following attribute is supported by Network Load Balancers and Gateway Load Balancers:

        • load_balancing.cross_zone.enabled - Indicates whether cross-zone load balancing is enabled. The possible values are true and false. The default is false.

      • Value — (String)

        The value of the attribute.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Attributes — (Array<map>)

        Information about the load balancer attributes.

        • Key — (String)

          The name of the attribute.

          The following attribute is supported by all load balancers:

          • deletion_protection.enabled - Indicates whether deletion protection is enabled. The value is true or false. The default is false.

          The following attributes are supported by both Application Load Balancers and Network Load Balancers:

          • access_logs.s3.enabled - Indicates whether access logs are enabled. The value is true or false. The default is false.

          • access_logs.s3.bucket - The name of the S3 bucket for the access logs. This attribute is required if access logs are enabled. The bucket must exist in the same region as the load balancer and have a bucket policy that grants Elastic Load Balancing permissions to write to the bucket.

          • access_logs.s3.prefix - The prefix for the location in the S3 bucket for the access logs.

          The following attributes are supported by only Application Load Balancers:

          • idle_timeout.timeout_seconds - The idle timeout value, in seconds. The valid range is 1-4000 seconds. The default is 60 seconds.

          • routing.http.desync_mitigation_mode - Determines how the load balancer handles requests that might pose a security risk to your application. The possible values are monitor, defensive, and strictest. The default is defensive.

          • routing.http.drop_invalid_header_fields.enabled - Indicates whether HTTP headers with invalid header fields are removed by the load balancer (true) or routed to targets (false). The default is false.

          • routing.http.x_amzn_tls_version_and_cipher_suite.enabled - Indicates whether the two headers (x-amzn-tls-version and x-amzn-tls-cipher-suite), which contain information about the negotiated TLS version and cipher suite, are added to the client request before sending it to the target. The x-amzn-tls-version header has information about the TLS protocol version negotiated with the client, and the x-amzn-tls-cipher-suite header has information about the cipher suite negotiated with the client. Both headers are in OpenSSL format. The possible values for the attribute are true and false. The default is false.

          • routing.http.xff_client_port.enabled - Indicates whether the X-Forwarded-For header should preserve the source port that the client used to connect to the load balancer. The possible values are true and false. The default is false.

          • routing.http2.enabled - Indicates whether HTTP/2 is enabled. The possible values are true and false. The default is true. Elastic Load Balancing requires that message header names contain only alphanumeric characters and hyphens.

          • waf.fail_open.enabled - Indicates whether to allow a WAF-enabled load balancer to route requests to targets if it is unable to forward the request to Amazon Web Services WAF. The possible values are true and false. The default is false.

          The following attribute is supported by Network Load Balancers and Gateway Load Balancers:

          • load_balancing.cross_zone.enabled - Indicates whether cross-zone load balancing is enabled. The possible values are true and false. The default is false.

        • Value — (String)

          The value of the attribute.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

modifyRule(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

To modify a rule


/* This example modifies the condition for the specified rule. */

 var params = {
  Conditions: [
     {
    Field: "path-pattern", 
    Values: [
       "/images/*"
    ]
   }
  ], 
  RuleArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/9683b2d02a6cabee"
 };
 elbv2.modifyRule(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    Rules: [
       {
      Actions: [
         {
        TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
        Type: "forward"
       }
      ], 
      Conditions: [
         {
        Field: "path-pattern", 
        Values: [
           "/images/*"
        ]
       }
      ], 
      IsDefault: false, 
      Priority: "10", 
      RuleArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/9683b2d02a6cabee"
     }
    ]
   }
   */
 });

Calling the modifyRule operation

var params = {
  RuleArn: 'STRING_VALUE', /* required */
  Actions: [
    {
      Type: forward | authenticate-oidc | authenticate-cognito | redirect | fixed-response, /* required */
      AuthenticateCognitoConfig: {
        UserPoolArn: 'STRING_VALUE', /* required */
        UserPoolClientId: 'STRING_VALUE', /* required */
        UserPoolDomain: 'STRING_VALUE', /* required */
        AuthenticationRequestExtraParams: {
          '<AuthenticateCognitoActionAuthenticationRequestParamName>': 'STRING_VALUE',
          /* '<AuthenticateCognitoActionAuthenticationRequestParamName>': ... */
        },
        OnUnauthenticatedRequest: deny | allow | authenticate,
        Scope: 'STRING_VALUE',
        SessionCookieName: 'STRING_VALUE',
        SessionTimeout: 'NUMBER_VALUE'
      },
      AuthenticateOidcConfig: {
        AuthorizationEndpoint: 'STRING_VALUE', /* required */
        ClientId: 'STRING_VALUE', /* required */
        Issuer: 'STRING_VALUE', /* required */
        TokenEndpoint: 'STRING_VALUE', /* required */
        UserInfoEndpoint: 'STRING_VALUE', /* required */
        AuthenticationRequestExtraParams: {
          '<AuthenticateOidcActionAuthenticationRequestParamName>': 'STRING_VALUE',
          /* '<AuthenticateOidcActionAuthenticationRequestParamName>': ... */
        },
        ClientSecret: 'STRING_VALUE',
        OnUnauthenticatedRequest: deny | allow | authenticate,
        Scope: 'STRING_VALUE',
        SessionCookieName: 'STRING_VALUE',
        SessionTimeout: 'NUMBER_VALUE',
        UseExistingClientSecret: true || false
      },
      FixedResponseConfig: {
        StatusCode: 'STRING_VALUE', /* required */
        ContentType: 'STRING_VALUE',
        MessageBody: 'STRING_VALUE'
      },
      ForwardConfig: {
        TargetGroupStickinessConfig: {
          DurationSeconds: 'NUMBER_VALUE',
          Enabled: true || false
        },
        TargetGroups: [
          {
            TargetGroupArn: 'STRING_VALUE',
            Weight: 'NUMBER_VALUE'
          },
          /* more items */
        ]
      },
      Order: 'NUMBER_VALUE',
      RedirectConfig: {
        StatusCode: HTTP_301 | HTTP_302, /* required */
        Host: 'STRING_VALUE',
        Path: 'STRING_VALUE',
        Port: 'STRING_VALUE',
        Protocol: 'STRING_VALUE',
        Query: 'STRING_VALUE'
      },
      TargetGroupArn: 'STRING_VALUE'
    },
    /* more items */
  ],
  Conditions: [
    {
      Field: 'STRING_VALUE',
      HostHeaderConfig: {
        Values: [
          'STRING_VALUE',
          /* more items */
        ]
      },
      HttpHeaderConfig: {
        HttpHeaderName: 'STRING_VALUE',
        Values: [
          'STRING_VALUE',
          /* more items */
        ]
      },
      HttpRequestMethodConfig: {
        Values: [
          'STRING_VALUE',
          /* more items */
        ]
      },
      PathPatternConfig: {
        Values: [
          'STRING_VALUE',
          /* more items */
        ]
      },
      QueryStringConfig: {
        Values: [
          {
            Key: 'STRING_VALUE',
            Value: 'STRING_VALUE'
          },
          /* more items */
        ]
      },
      SourceIpConfig: {
        Values: [
          'STRING_VALUE',
          /* more items */
        ]
      },
      Values: [
        'STRING_VALUE',
        /* more items */
      ]
    },
    /* more items */
  ]
};
elbv2.modifyRule(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • RuleArn — (String)

      The Amazon Resource Name (ARN) of the rule.

    • Conditions — (Array<map>)

      The conditions.

      • Field — (String)

        The field in the HTTP request. The following are the possible values:

        • http-header

        • http-request-method

        • host-header

        • path-pattern

        • query-string

        • source-ip

      • Values — (Array<String>)

        The condition value. Specify only when Field is host-header or path-pattern. Alternatively, to specify multiple host names or multiple path patterns, use HostHeaderConfig or PathPatternConfig.

        If Field is host-header and you are not using HostHeaderConfig, you can specify a single host name (for example, my.example.com) in Values. A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters.

        • A-Z, a-z, 0-9

        • - .

        • (matches 0 or more characters)

        • ? (matches exactly 1 character)

        If Field is path-pattern and you are not using PathPatternConfig, you can specify a single path pattern (for example, /img/) in Values. A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters.

        • A-Z, a-z, 0-9

        • _ - . $ / ~ " ' @ : +

        • & (using &amp;)

        • * (matches 0 or more characters)

        • ? (matches exactly 1 character)

      • HostHeaderConfig — (map)

        Information for a host header condition. Specify only when Field is host-header.

        • Values — (Array<String>)

          One or more host names. The maximum size of each name is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).

          If you specify multiple strings, the condition is satisfied if one of the strings matches the host name.

      • PathPatternConfig — (map)

        Information for a path pattern condition. Specify only when Field is path-pattern.

        • Values — (Array<String>)

          One or more path patterns to compare against the request URL. The maximum size of each string is 128 characters. The comparison is case sensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).

          If you specify multiple strings, the condition is satisfied if one of them matches the request URL. The path pattern is compared only to the path of the URL, not to its query string. To compare against the query string, use QueryStringConditionConfig.

      • HttpHeaderConfig — (map)

        Information for an HTTP header condition. Specify only when Field is http-header.

        • HttpHeaderName — (String)

          The name of the HTTP header field. The maximum size is 40 characters. The header name is case insensitive. The allowed characters are specified by RFC 7230. Wildcards are not supported.

          You can't use an HTTP header condition to specify the host header. Use HostHeaderConditionConfig to specify a host header condition.

        • Values — (Array<String>)

          One or more strings to compare against the value of the HTTP header. The maximum size of each string is 128 characters. The comparison strings are case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).

          If the same header appears multiple times in the request, we search them in order until a match is found.

          If you specify multiple strings, the condition is satisfied if one of the strings matches the value of the HTTP header. To require that all of the strings are a match, create one condition per string.

      • QueryStringConfig — (map)

        Information for a query string condition. Specify only when Field is query-string.

        • Values — (Array<map>)

          One or more key/value pairs or values to find in the query string. The maximum size of each string is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character). To search for a literal '*' or '?' character in a query string, you must escape these characters in Values using a '\' character.

          If you specify multiple key/value pairs or values, the condition is satisfied if one of them is found in the query string.

          • Key — (String)

            The key. You can omit the key.

          • Value — (String)

            The value.

      • HttpRequestMethodConfig — (map)

        Information for an HTTP method condition. Specify only when Field is http-request-method.

        • Values — (Array<String>)

          The name of the request method. The maximum size is 40 characters. The allowed characters are A-Z, hyphen (-), and underscore (_). The comparison is case sensitive. Wildcards are not supported; therefore, the method name must be an exact match.

          If you specify multiple strings, the condition is satisfied if one of the strings matches the HTTP request method. We recommend that you route GET and HEAD requests in the same way, because the response to a HEAD request may be cached.

      • SourceIpConfig — (map)

        Information for a source IP condition. Specify only when Field is source-ip.

        • Values — (Array<String>)

          One or more source IP addresses, in CIDR format. You can use both IPv4 and IPv6 addresses. Wildcards are not supported.

          If you specify multiple addresses, the condition is satisfied if the source IP address of the request matches one of the CIDR blocks. This condition is not satisfied by the addresses in the X-Forwarded-For header. To search for addresses in the X-Forwarded-For header, use HttpHeaderConditionConfig.

    • Actions — (Array<map>)

      The actions.

      • Typerequired — (String)

        The type of action.

        Possible values include:
        • "forward"
        • "authenticate-oidc"
        • "authenticate-cognito"
        • "redirect"
        • "fixed-response"
      • TargetGroupArn — (String)

        The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward and you want to route to a single target group. To route to one or more target groups, use ForwardConfig instead.

      • AuthenticateOidcConfig — (map)

        [HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc.

        • Issuerrequired — (String)

          The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

        • AuthorizationEndpointrequired — (String)

          The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

        • TokenEndpointrequired — (String)

          The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

        • UserInfoEndpointrequired — (String)

          The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

        • ClientIdrequired — (String)

          The OAuth 2.0 client identifier.

        • ClientSecret — (String)

          The OAuth 2.0 client secret. This parameter is required if you are creating a rule. If you are modifying a rule, you can omit this parameter if you set UseExistingClientSecret to true.

        • SessionCookieName — (String)

          The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.

        • Scope — (String)

          The set of user claims to be requested from the IdP. The default is openid.

          To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.

        • SessionTimeout — (Integer)

          The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).

        • AuthenticationRequestExtraParams — (map<String>)

          The query parameters (up to 10) to include in the redirect request to the authorization endpoint.

        • OnUnauthenticatedRequest — (String)

          The behavior if the user is not authenticated. The following are possible values:

          • deny - Return an HTTP 401 Unauthorized error.

          • allow - Allow the request to be forwarded to the target.

          • authenticate - Redirect the request to the IdP authorization endpoint. This is the default value.

          Possible values include:
          • "deny"
          • "allow"
          • "authenticate"
        • UseExistingClientSecret — (Boolean)

          Indicates whether to use the existing client secret when modifying a rule. If you are creating a rule, you can omit this parameter or set it to false.

      • AuthenticateCognitoConfig — (map)

        [HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only when Type is authenticate-cognito.

        • UserPoolArnrequired — (String)

          The Amazon Resource Name (ARN) of the Amazon Cognito user pool.

        • UserPoolClientIdrequired — (String)

          The ID of the Amazon Cognito user pool client.

        • UserPoolDomainrequired — (String)

          The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.

        • SessionCookieName — (String)

          The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.

        • Scope — (String)

          The set of user claims to be requested from the IdP. The default is openid.

          To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.

        • SessionTimeout — (Integer)

          The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).

        • AuthenticationRequestExtraParams — (map<String>)

          The query parameters (up to 10) to include in the redirect request to the authorization endpoint.

        • OnUnauthenticatedRequest — (String)

          The behavior if the user is not authenticated. The following are possible values:

          • deny - Return an HTTP 401 Unauthorized error.

          • allow - Allow the request to be forwarded to the target.

          • authenticate - Redirect the request to the IdP authorization endpoint. This is the default value.

          Possible values include:
          • "deny"
          • "allow"
          • "authenticate"
      • Order — (Integer)

        The order for the action. This value is required for rules with multiple actions. The action with the lowest value for order is performed first.

      • RedirectConfig — (map)

        [Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect.

        • Protocol — (String)

          The protocol. You can specify HTTP, HTTPS, or #{protocol}. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You cannot redirect HTTPS to HTTP.

        • Port — (String)

          The port. You can specify a value from 1 to 65535 or #{port}.

        • Host — (String)

          The hostname. This component is not percent-encoded. The hostname can contain #{host}.

        • Path — (String)

          The absolute path, starting with the leading "/". This component is not percent-encoded. The path can contain #{host}, #{path}, and #{port}.

        • Query — (String)

          The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.

        • StatusCoderequired — (String)

          The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).

          Possible values include:
          • "HTTP_301"
          • "HTTP_302"
      • FixedResponseConfig — (map)

        [Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only when Type is fixed-response.

        • MessageBody — (String)

          The message.

        • StatusCoderequired — (String)

          The HTTP response code (2XX, 4XX, or 5XX).

        • ContentType — (String)

          The content type.

          Valid Values: text/plain | text/css | text/html | application/javascript | application/json

      • ForwardConfig — (map)

        Information for creating an action that distributes requests among one or more target groups. For Network Load Balancers, you can specify a single target group. Specify only when Type is forward. If you specify both ForwardConfig and TargetGroupArn, you can specify only one target group using ForwardConfig and it must be the same target group specified in TargetGroupArn.

        • TargetGroups — (Array<map>)

          One or more target groups. For Network Load Balancers, you can specify a single target group.

          • TargetGroupArn — (String)

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

          • Weight — (Integer)

            The weight. The range is 0 to 999.

        • TargetGroupStickinessConfig — (map)

          The target group stickiness for the rule.

          • Enabled — (Boolean)

            Indicates whether target group stickiness is enabled.

          • DurationSeconds — (Integer)

            The time period, in seconds, during which requests from a client should be routed to the same target group. The range is 1-604800 seconds (7 days).

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Rules — (Array<map>)

        Information about the modified rule.

        • RuleArn — (String)

          The Amazon Resource Name (ARN) of the rule.

        • Priority — (String)

          The priority.

        • Conditions — (Array<map>)

          The conditions. Each rule can include zero or one of the following conditions: http-request-method, host-header, path-pattern, and source-ip, and zero or more of the following conditions: http-header and query-string.

          • Field — (String)

            The field in the HTTP request. The following are the possible values:

            • http-header

            • http-request-method

            • host-header

            • path-pattern

            • query-string

            • source-ip

          • Values — (Array<String>)

            The condition value. Specify only when Field is host-header or path-pattern. Alternatively, to specify multiple host names or multiple path patterns, use HostHeaderConfig or PathPatternConfig.

            If Field is host-header and you are not using HostHeaderConfig, you can specify a single host name (for example, my.example.com) in Values. A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters.

            • A-Z, a-z, 0-9

            • - .

            • (matches 0 or more characters)

            • ? (matches exactly 1 character)

            If Field is path-pattern and you are not using PathPatternConfig, you can specify a single path pattern (for example, /img/) in Values. A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters.

            • A-Z, a-z, 0-9

            • _ - . $ / ~ " ' @ : +

            • & (using &amp;)

            • * (matches 0 or more characters)

            • ? (matches exactly 1 character)

          • HostHeaderConfig — (map)

            Information for a host header condition. Specify only when Field is host-header.

            • Values — (Array<String>)

              One or more host names. The maximum size of each name is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).

              If you specify multiple strings, the condition is satisfied if one of the strings matches the host name.

          • PathPatternConfig — (map)

            Information for a path pattern condition. Specify only when Field is path-pattern.

            • Values — (Array<String>)

              One or more path patterns to compare against the request URL. The maximum size of each string is 128 characters. The comparison is case sensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).

              If you specify multiple strings, the condition is satisfied if one of them matches the request URL. The path pattern is compared only to the path of the URL, not to its query string. To compare against the query string, use QueryStringConditionConfig.

          • HttpHeaderConfig — (map)

            Information for an HTTP header condition. Specify only when Field is http-header.

            • HttpHeaderName — (String)

              The name of the HTTP header field. The maximum size is 40 characters. The header name is case insensitive. The allowed characters are specified by RFC 7230. Wildcards are not supported.

              You can't use an HTTP header condition to specify the host header. Use HostHeaderConditionConfig to specify a host header condition.

            • Values — (Array<String>)

              One or more strings to compare against the value of the HTTP header. The maximum size of each string is 128 characters. The comparison strings are case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).

              If the same header appears multiple times in the request, we search them in order until a match is found.

              If you specify multiple strings, the condition is satisfied if one of the strings matches the value of the HTTP header. To require that all of the strings are a match, create one condition per string.

          • QueryStringConfig — (map)

            Information for a query string condition. Specify only when Field is query-string.

            • Values — (Array<map>)

              One or more key/value pairs or values to find in the query string. The maximum size of each string is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character). To search for a literal '*' or '?' character in a query string, you must escape these characters in Values using a '\' character.

              If you specify multiple key/value pairs or values, the condition is satisfied if one of them is found in the query string.

              • Key — (String)

                The key. You can omit the key.

              • Value — (String)

                The value.

          • HttpRequestMethodConfig — (map)

            Information for an HTTP method condition. Specify only when Field is http-request-method.

            • Values — (Array<String>)

              The name of the request method. The maximum size is 40 characters. The allowed characters are A-Z, hyphen (-), and underscore (_). The comparison is case sensitive. Wildcards are not supported; therefore, the method name must be an exact match.

              If you specify multiple strings, the condition is satisfied if one of the strings matches the HTTP request method. We recommend that you route GET and HEAD requests in the same way, because the response to a HEAD request may be cached.

          • SourceIpConfig — (map)

            Information for a source IP condition. Specify only when Field is source-ip.

            • Values — (Array<String>)

              One or more source IP addresses, in CIDR format. You can use both IPv4 and IPv6 addresses. Wildcards are not supported.

              If you specify multiple addresses, the condition is satisfied if the source IP address of the request matches one of the CIDR blocks. This condition is not satisfied by the addresses in the X-Forwarded-For header. To search for addresses in the X-Forwarded-For header, use HttpHeaderConditionConfig.

        • Actions — (Array<map>)

          The actions. Each rule must include exactly one of the following types of actions: forward, redirect, or fixed-response, and it must be the last action to be performed.

          • Typerequired — (String)

            The type of action.

            Possible values include:
            • "forward"
            • "authenticate-oidc"
            • "authenticate-cognito"
            • "redirect"
            • "fixed-response"
          • TargetGroupArn — (String)

            The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward and you want to route to a single target group. To route to one or more target groups, use ForwardConfig instead.

          • AuthenticateOidcConfig — (map)

            [HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc.

            • Issuerrequired — (String)

              The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • AuthorizationEndpointrequired — (String)

              The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • TokenEndpointrequired — (String)

              The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • UserInfoEndpointrequired — (String)

              The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • ClientIdrequired — (String)

              The OAuth 2.0 client identifier.

            • ClientSecret — (String)

              The OAuth 2.0 client secret. This parameter is required if you are creating a rule. If you are modifying a rule, you can omit this parameter if you set UseExistingClientSecret to true.

            • SessionCookieName — (String)

              The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.

            • Scope — (String)

              The set of user claims to be requested from the IdP. The default is openid.

              To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.

            • SessionTimeout — (Integer)

              The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).

            • AuthenticationRequestExtraParams — (map<String>)

              The query parameters (up to 10) to include in the redirect request to the authorization endpoint.

            • OnUnauthenticatedRequest — (String)

              The behavior if the user is not authenticated. The following are possible values:

              • deny - Return an HTTP 401 Unauthorized error.

              • allow - Allow the request to be forwarded to the target.

              • authenticate - Redirect the request to the IdP authorization endpoint. This is the default value.

              Possible values include:
              • "deny"
              • "allow"
              • "authenticate"
            • UseExistingClientSecret — (Boolean)

              Indicates whether to use the existing client secret when modifying a rule. If you are creating a rule, you can omit this parameter or set it to false.

          • AuthenticateCognitoConfig — (map)

            [HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only when Type is authenticate-cognito.

            • UserPoolArnrequired — (String)

              The Amazon Resource Name (ARN) of the Amazon Cognito user pool.

            • UserPoolClientIdrequired — (String)

              The ID of the Amazon Cognito user pool client.

            • UserPoolDomainrequired — (String)

              The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.

            • SessionCookieName — (String)

              The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.

            • Scope — (String)

              The set of user claims to be requested from the IdP. The default is openid.

              To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.

            • SessionTimeout — (Integer)

              The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).

            • AuthenticationRequestExtraParams — (map<String>)

              The query parameters (up to 10) to include in the redirect request to the authorization endpoint.

            • OnUnauthenticatedRequest — (String)

              The behavior if the user is not authenticated. The following are possible values:

              • deny - Return an HTTP 401 Unauthorized error.

              • allow - Allow the request to be forwarded to the target.

              • authenticate - Redirect the request to the IdP authorization endpoint. This is the default value.

              Possible values include:
              • "deny"
              • "allow"
              • "authenticate"
          • Order — (Integer)

            The order for the action. This value is required for rules with multiple actions. The action with the lowest value for order is performed first.

          • RedirectConfig — (map)

            [Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect.

            • Protocol — (String)

              The protocol. You can specify HTTP, HTTPS, or #{protocol}. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You cannot redirect HTTPS to HTTP.

            • Port — (String)

              The port. You can specify a value from 1 to 65535 or #{port}.

            • Host — (String)

              The hostname. This component is not percent-encoded. The hostname can contain #{host}.

            • Path — (String)

              The absolute path, starting with the leading "/". This component is not percent-encoded. The path can contain #{host}, #{path}, and #{port}.

            • Query — (String)

              The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.

            • StatusCoderequired — (String)

              The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).

              Possible values include:
              • "HTTP_301"
              • "HTTP_302"
          • FixedResponseConfig — (map)

            [Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only when Type is fixed-response.

            • MessageBody — (String)

              The message.

            • StatusCoderequired — (String)

              The HTTP response code (2XX, 4XX, or 5XX).

            • ContentType — (String)

              The content type.

              Valid Values: text/plain | text/css | text/html | application/javascript | application/json

          • ForwardConfig — (map)

            Information for creating an action that distributes requests among one or more target groups. For Network Load Balancers, you can specify a single target group. Specify only when Type is forward. If you specify both ForwardConfig and TargetGroupArn, you can specify only one target group using ForwardConfig and it must be the same target group specified in TargetGroupArn.

            • TargetGroups — (Array<map>)

              One or more target groups. For Network Load Balancers, you can specify a single target group.

              • TargetGroupArn — (String)

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

              • Weight — (Integer)

                The weight. The range is 0 to 999.

            • TargetGroupStickinessConfig — (map)

              The target group stickiness for the rule.

              • Enabled — (Boolean)

                Indicates whether target group stickiness is enabled.

              • DurationSeconds — (Integer)

                The time period, in seconds, during which requests from a client should be routed to the same target group. The range is 1-604800 seconds (7 days).

        • IsDefault — (Boolean)

          Indicates whether this is the default rule.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

modifyTargetGroup(params = {}, callback) ⇒ AWS.Request

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

Service Reference:

Examples:

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

 var params = {
  HealthCheckPort: "443", 
  HealthCheckProtocol: "HTTPS", 
  TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-https-targets/2453ed029918f21f"
 };
 elbv2.modifyTargetGroup(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    TargetGroups: [
       {
      HealthCheckIntervalSeconds: 30, 
      HealthCheckPort: "443", 
      HealthCheckProtocol: "HTTPS", 
      HealthCheckTimeoutSeconds: 5, 
      HealthyThresholdCount: 5, 
      LoadBalancerArns: [
         "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"
      ], 
      Matcher: {
       HttpCode: "200"
      }, 
      Port: 443, 
      Protocol: "HTTPS", 
      TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-https-targets/2453ed029918f21f", 
      TargetGroupName: "my-https-targets", 
      UnhealthyThresholdCount: 2, 
      VpcId: "vpc-3ac0fb5f"
     }
    ]
   }
   */
 });

Calling the modifyTargetGroup operation

var params = {
  TargetGroupArn: 'STRING_VALUE', /* required */
  HealthCheckEnabled: true || false,
  HealthCheckIntervalSeconds: 'NUMBER_VALUE',
  HealthCheckPath: 'STRING_VALUE',
  HealthCheckPort: 'STRING_VALUE',
  HealthCheckProtocol: HTTP | HTTPS | TCP | TLS | UDP | TCP_UDP | GENEVE,
  HealthCheckTimeoutSeconds: 'NUMBER_VALUE',
  HealthyThresholdCount: 'NUMBER_VALUE',
  Matcher: {
    GrpcCode: 'STRING_VALUE',
    HttpCode: 'STRING_VALUE'
  },
  UnhealthyThresholdCount: 'NUMBER_VALUE'
};
elbv2.modifyTargetGroup(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • TargetGroupArn — (String)

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

    • HealthCheckProtocol — (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. It 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.

      Possible values include:
      • "HTTP"
      • "HTTPS"
      • "TCP"
      • "TLS"
      • "UDP"
      • "TCP_UDP"
      • "GENEVE"
    • HealthCheckPort — (String)

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

    • HealthCheckPath — (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 /Amazon Web Services.ALB/healthcheck.

    • HealthCheckEnabled — (Boolean)

      Indicates whether health checks are enabled.

    • HealthCheckIntervalSeconds — (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.

    • HealthCheckTimeoutSeconds — (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.

    • HealthyThresholdCount — (Integer)

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

    • UnhealthyThresholdCount — (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 — (map)

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

      • HttpCode — (String)

        For Application Load Balancers, you can specify values between 200 and 499, and the default value is 200. You can specify multiple values (for example, "200,202") or a range of values (for example, "200-299").

        For Network Load Balancers and Gateway Load Balancers, this must be "200–399".

        Note that when using shorthand syntax, some values such as commas need to be escaped.

      • GrpcCode — (String)

        You can specify values between 0 and 99. You can specify multiple values (for example, "0,1") or a range of values (for example, "0-5"). The default value is 12.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • TargetGroups — (Array<map>)

        Information about the modified target group.

        • TargetGroupArn — (String)

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

        • TargetGroupName — (String)

          The name of the target group.

        • Protocol — (String)

          The protocol to use for routing traffic to the targets.

          Possible values include:
          • "HTTP"
          • "HTTPS"
          • "TCP"
          • "TLS"
          • "UDP"
          • "TCP_UDP"
          • "GENEVE"
        • Port — (Integer)

          The port on which the targets are listening. Not used if the target is a Lambda function.

        • VpcId — (String)

          The ID of the VPC for the targets.

        • HealthCheckProtocol — (String)

          The protocol to use to connect with the target. The GENEVE, TLS, UDP, and TCP_UDP protocols are not supported for health checks.

          Possible values include:
          • "HTTP"
          • "HTTPS"
          • "TCP"
          • "TLS"
          • "UDP"
          • "TCP_UDP"
          • "GENEVE"
        • HealthCheckPort — (String)

          The port to use to connect with the target.

        • HealthCheckEnabled — (Boolean)

          Indicates whether health checks are enabled.

        • HealthCheckIntervalSeconds — (Integer)

          The approximate amount of time, in seconds, between health checks of an individual target.

        • HealthCheckTimeoutSeconds — (Integer)

          The amount of time, in seconds, during which no response means a failed health check.

        • HealthyThresholdCount — (Integer)

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

        • UnhealthyThresholdCount — (Integer)

          The number of consecutive health check failures required before considering the target unhealthy.

        • HealthCheckPath — (String)

          The destination for health checks on the targets.

        • Matcher — (map)

          The HTTP or gRPC codes to use when checking for a successful response from a target.

          • HttpCode — (String)

            For Application Load Balancers, you can specify values between 200 and 499, and the default value is 200. You can specify multiple values (for example, "200,202") or a range of values (for example, "200-299").

            For Network Load Balancers and Gateway Load Balancers, this must be "200–399".

            Note that when using shorthand syntax, some values such as commas need to be escaped.

          • GrpcCode — (String)

            You can specify values between 0 and 99. You can specify multiple values (for example, "0,1") or a range of values (for example, "0-5"). The default value is 12.

        • LoadBalancerArns — (Array<String>)

          The Amazon Resource Names (ARN) of the load balancers that route traffic to this target group.

        • TargetType — (String)

          The type of target that you must specify when registering targets with this target group. The possible values are instance (register targets by instance ID), ip (register targets by IP address), lambda (register a single Lambda function as a target), or alb (register a single Application Load Balancer as a target).

          Possible values include:
          • "instance"
          • "ip"
          • "lambda"
          • "alb"
        • ProtocolVersion — (String)

          [HTTP/HTTPS protocol] The protocol version. The possible values are GRPC, HTTP1, and HTTP2.

        • IpAddressType — (String)

          The type of IP address used for this target group. The possible values are ipv4 and ipv6. This is an optional parameter. If not specified, the IP address type defaults to ipv4.

          Possible values include:
          • "ipv4"
          • "ipv6"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

modifyTargetGroupAttributes(params = {}, callback) ⇒ AWS.Request

Modifies the specified attributes of the specified target group.

Service Reference:

Examples:

To modify the deregistration delay timeout


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

 var params = {
  Attributes: [
     {
    Key: "deregistration_delay.timeout_seconds", 
    Value: "600"
   }
  ], 
  TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067"
 };
 elbv2.modifyTargetGroupAttributes(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    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"
     }
    ]
   }
   */
 });

Calling the modifyTargetGroupAttributes operation

var params = {
  Attributes: [ /* required */
    {
      Key: 'STRING_VALUE',
      Value: 'STRING_VALUE'
    },
    /* more items */
  ],
  TargetGroupArn: 'STRING_VALUE' /* required */
};
elbv2.modifyTargetGroupAttributes(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • TargetGroupArn — (String)

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

    • Attributes — (Array<map>)

      The attributes.

      • Key — (String)

        The name of the attribute.

        The following attribute is supported by all load balancers:

        • deregistration_delay.timeout_seconds - The amount of time, in seconds, for Elastic Load Balancing to wait before changing the state of a deregistering target from draining to unused. The range is 0-3600 seconds. The default value is 300 seconds. If the target is a Lambda function, this attribute is not supported.

        The following attributes are supported by both Application Load Balancers and Network Load Balancers:

        • stickiness.enabled - Indicates whether sticky sessions are enabled. The value is true or false. The default is false.

        • stickiness.type - The type of sticky sessions. The possible values are lb_cookie and app_cookie for Application Load Balancers or source_ip for Network Load Balancers.

        The following attributes are supported only if the load balancer is an Application Load Balancer and the target is an instance or an IP address:

        • load_balancing.algorithm.type - The load balancing algorithm determines how the load balancer selects targets when routing requests. The value is round_robin or least_outstanding_requests. The default is round_robin.

        • slow_start.duration_seconds - The time period, in seconds, during which a newly registered target receives an increasing share of the traffic to the target group. After this time period ends, the target receives its full share of traffic. The range is 30-900 seconds (15 minutes). The default is 0 seconds (disabled).

        • stickiness.app_cookie.cookie_name - Indicates the name of the application-based cookie. Names that start with the following prefixes are not allowed: AWSALB, AWSALBAPP, and AWSALBTG; they're reserved for use by the load balancer.

        • stickiness.app_cookie.duration_seconds - The time period, in seconds, during which requests from a client should be routed to the same target. After this time period expires, the application-based cookie is considered stale. The range is 1 second to 1 week (604800 seconds). The default value is 1 day (86400 seconds).

        • stickiness.lb_cookie.duration_seconds - The time period, in seconds, during which requests from a client should be routed to the same target. After this time period expires, the load balancer-generated cookie is considered stale. The range is 1 second to 1 week (604800 seconds). The default value is 1 day (86400 seconds).

        The following attribute is supported only if the load balancer is an Application Load Balancer and the target is a Lambda function:

        • lambda.multi_value_headers.enabled - Indicates whether the request and response headers that are exchanged between the load balancer and the Lambda function include arrays of values or strings. The value is true or false. The default is false. If the value is false and the request contains a duplicate header field name or query parameter key, the load balancer uses the last value sent by the client.

        The following attributes are supported only by Network Load Balancers:

        • deregistration_delay.connection_termination.enabled - Indicates whether the load balancer terminates connections at the end of the deregistration timeout. The value is true or false. The default is false.

        • preserve_client_ip.enabled - Indicates whether client IP preservation is enabled. The value is true or false. The default is disabled if the target group type is IP address and the target group protocol is TCP or TLS. Otherwise, the default is enabled. Client IP preservation cannot be disabled for UDP and TCP_UDP target groups.

        • proxy_protocol_v2.enabled - Indicates whether Proxy Protocol version 2 is enabled. The value is true or false. The default is false.

      • Value — (String)

        The value of the attribute.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Attributes — (Array<map>)

        Information about the attributes.

        • Key — (String)

          The name of the attribute.

          The following attribute is supported by all load balancers:

          • deregistration_delay.timeout_seconds - The amount of time, in seconds, for Elastic Load Balancing to wait before changing the state of a deregistering target from draining to unused. The range is 0-3600 seconds. The default value is 300 seconds. If the target is a Lambda function, this attribute is not supported.

          The following attributes are supported by both Application Load Balancers and Network Load Balancers:

          • stickiness.enabled - Indicates whether sticky sessions are enabled. The value is true or false. The default is false.

          • stickiness.type - The type of sticky sessions. The possible values are lb_cookie and app_cookie for Application Load Balancers or source_ip for Network Load Balancers.

          The following attributes are supported only if the load balancer is an Application Load Balancer and the target is an instance or an IP address:

          • load_balancing.algorithm.type - The load balancing algorithm determines how the load balancer selects targets when routing requests. The value is round_robin or least_outstanding_requests. The default is round_robin.

          • slow_start.duration_seconds - The time period, in seconds, during which a newly registered target receives an increasing share of the traffic to the target group. After this time period ends, the target receives its full share of traffic. The range is 30-900 seconds (15 minutes). The default is 0 seconds (disabled).

          • stickiness.app_cookie.cookie_name - Indicates the name of the application-based cookie. Names that start with the following prefixes are not allowed: AWSALB, AWSALBAPP, and AWSALBTG; they're reserved for use by the load balancer.

          • stickiness.app_cookie.duration_seconds - The time period, in seconds, during which requests from a client should be routed to the same target. After this time period expires, the application-based cookie is considered stale. The range is 1 second to 1 week (604800 seconds). The default value is 1 day (86400 seconds).

          • stickiness.lb_cookie.duration_seconds - The time period, in seconds, during which requests from a client should be routed to the same target. After this time period expires, the load balancer-generated cookie is considered stale. The range is 1 second to 1 week (604800 seconds). The default value is 1 day (86400 seconds).

          The following attribute is supported only if the load balancer is an Application Load Balancer and the target is a Lambda function:

          • lambda.multi_value_headers.enabled - Indicates whether the request and response headers that are exchanged between the load balancer and the Lambda function include arrays of values or strings. The value is true or false. The default is false. If the value is false and the request contains a duplicate header field name or query parameter key, the load balancer uses the last value sent by the client.

          The following attributes are supported only by Network Load Balancers:

          • deregistration_delay.connection_termination.enabled - Indicates whether the load balancer terminates connections at the end of the deregistration timeout. The value is true or false. The default is false.

          • preserve_client_ip.enabled - Indicates whether client IP preservation is enabled. The value is true or false. The default is disabled if the target group type is IP address and the target group protocol is TCP or TLS. Otherwise, the default is enabled. Client IP preservation cannot be disabled for UDP and TCP_UDP target groups.

          • proxy_protocol_v2.enabled - Indicates whether Proxy Protocol version 2 is enabled. The value is true or false. The default is false.

        • Value — (String)

          The value of the attribute.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

registerTargets(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

To register targets with a target group


/* This example registers the specified instances with the specified target group. */

 var params = {
  TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
  Targets: [
     {
    Id: "i-80c8dd94"
   }, 
     {
    Id: "i-ceddcd4d"
   }
  ]
 };
 elbv2.registerTargets(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
   }
   */
 });

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

 var params = {
  TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/3bb63f11dfb0faf9", 
  Targets: [
     {
    Id: "i-80c8dd94", 
    Port: 80
   }, 
     {
    Id: "i-80c8dd94", 
    Port: 766
   }
  ]
 };
 elbv2.registerTargets(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
   }
   */
 });

Calling the registerTargets operation

var params = {
  TargetGroupArn: 'STRING_VALUE', /* required */
  Targets: [ /* required */
    {
      Id: 'STRING_VALUE', /* required */
      AvailabilityZone: 'STRING_VALUE',
      Port: 'NUMBER_VALUE'
    },
    /* more items */
  ]
};
elbv2.registerTargets(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • TargetGroupArn — (String)

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

    • Targets — (Array<map>)

      The targets.

      • Idrequired — (String)

        The ID of the target. If the target type of the target group is instance, specify an instance ID. If the target type is ip, specify an IP address. If the target type is lambda, specify the ARN of the Lambda function. If the target type is alb, specify the ARN of the Application Load Balancer target.

      • Port — (Integer)

        The port on which the target is listening. If the target group protocol is GENEVE, the supported port is 6081. If the target type is alb, the targeted Application Load Balancer must have at least one listener whose port matches the target group port. Not used if the target is a Lambda function.

      • AvailabilityZone — (String)

        An Availability Zone or all. This determines whether the target receives traffic from the load balancer nodes in the specified Availability Zone or from all enabled Availability Zones for the load balancer.

        This parameter is not supported if the target type of the target group is instance or alb.

        If the target type is ip and the IP address is in a subnet of the VPC for the target group, the Availability Zone is automatically detected and this parameter is optional. If the IP address is outside the VPC, this parameter is required.

        With an Application Load Balancer, if the target type is ip and the IP address is outside the VPC for the target group, the only supported value is all.

        If the target type is lambda, this parameter is optional and the only supported value is all.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

removeListenerCertificates(params = {}, callback) ⇒ AWS.Request

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

Service Reference:

Examples:

Calling the removeListenerCertificates operation

var params = {
  Certificates: [ /* required */
    {
      CertificateArn: 'STRING_VALUE',
      IsDefault: true || false
    },
    /* more items */
  ],
  ListenerArn: 'STRING_VALUE' /* required */
};
elbv2.removeListenerCertificates(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ListenerArn — (String)

      The Amazon Resource Name (ARN) of the listener.

    • Certificates — (Array<map>)

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

      • CertificateArn — (String)

        The Amazon Resource Name (ARN) of the certificate.

      • IsDefault — (Boolean)

        Indicates whether the certificate is the default certificate. Do not set this value when specifying a certificate as an input. This value is not included in the output when describing a listener, but is included when describing listener certificates.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

removeTags(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

To remove tags from a load balancer


/* This example removes the specified tags from the specified load balancer. */

 var params = {
  ResourceArns: [
     "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"
  ], 
  TagKeys: [
     "project", 
     "department"
  ]
 };
 elbv2.removeTags(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
   }
   */
 });

Calling the removeTags operation

var params = {
  ResourceArns: [ /* required */
    'STRING_VALUE',
    /* more items */
  ],
  TagKeys: [ /* required */
    'STRING_VALUE',
    /* more items */
  ]
};
elbv2.removeTags(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ResourceArns — (Array<String>)

      The Amazon Resource Name (ARN) of the resource.

    • TagKeys — (Array<String>)

      The tag keys for the tags to remove.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

setIpAddressType(params = {}, callback) ⇒ AWS.Request

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

Service Reference:

Examples:

Calling the setIpAddressType operation

var params = {
  IpAddressType: ipv4 | dualstack, /* required */
  LoadBalancerArn: 'STRING_VALUE' /* required */
};
elbv2.setIpAddressType(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • LoadBalancerArn — (String)

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

    • IpAddressType — (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.

      Possible values include:
      • "ipv4"
      • "dualstack"

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • IpAddressType — (String)

        The IP address type.

        Possible values include:
        • "ipv4"
        • "dualstack"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

setRulePriorities(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

To set the rule priority


/* This example sets the priority of the specified rule. */

 var params = {
  RulePriorities: [
     {
    Priority: 5, 
    RuleArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/1291d13826f405c3"
   }
  ]
 };
 elbv2.setRulePriorities(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    Rules: [
       {
      Actions: [
         {
        TargetGroupArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", 
        Type: "forward"
       }
      ], 
      Conditions: [
         {
        Field: "path-pattern", 
        Values: [
           "/img/*"
        ]
       }
      ], 
      IsDefault: false, 
      Priority: "5", 
      RuleArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/1291d13826f405c3"
     }
    ]
   }
   */
 });

Calling the setRulePriorities operation

var params = {
  RulePriorities: [ /* required */
    {
      Priority: 'NUMBER_VALUE',
      RuleArn: 'STRING_VALUE'
    },
    /* more items */
  ]
};
elbv2.setRulePriorities(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • RulePriorities — (Array<map>)

      The rule priorities.

      • RuleArn — (String)

        The Amazon Resource Name (ARN) of the rule.

      • Priority — (Integer)

        The rule priority.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Rules — (Array<map>)

        Information about the rules.

        • RuleArn — (String)

          The Amazon Resource Name (ARN) of the rule.

        • Priority — (String)

          The priority.

        • Conditions — (Array<map>)

          The conditions. Each rule can include zero or one of the following conditions: http-request-method, host-header, path-pattern, and source-ip, and zero or more of the following conditions: http-header and query-string.

          • Field — (String)

            The field in the HTTP request. The following are the possible values:

            • http-header

            • http-request-method

            • host-header

            • path-pattern

            • query-string

            • source-ip

          • Values — (Array<String>)

            The condition value. Specify only when Field is host-header or path-pattern. Alternatively, to specify multiple host names or multiple path patterns, use HostHeaderConfig or PathPatternConfig.

            If Field is host-header and you are not using HostHeaderConfig, you can specify a single host name (for example, my.example.com) in Values. A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters.

            • A-Z, a-z, 0-9

            • - .

            • (matches 0 or more characters)

            • ? (matches exactly 1 character)

            If Field is path-pattern and you are not using PathPatternConfig, you can specify a single path pattern (for example, /img/) in Values. A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters.

            • A-Z, a-z, 0-9

            • _ - . $ / ~ " ' @ : +

            • & (using &amp;)

            • * (matches 0 or more characters)

            • ? (matches exactly 1 character)

          • HostHeaderConfig — (map)

            Information for a host header condition. Specify only when Field is host-header.

            • Values — (Array<String>)

              One or more host names. The maximum size of each name is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).

              If you specify multiple strings, the condition is satisfied if one of the strings matches the host name.

          • PathPatternConfig — (map)

            Information for a path pattern condition. Specify only when Field is path-pattern.

            • Values — (Array<String>)

              One or more path patterns to compare against the request URL. The maximum size of each string is 128 characters. The comparison is case sensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).

              If you specify multiple strings, the condition is satisfied if one of them matches the request URL. The path pattern is compared only to the path of the URL, not to its query string. To compare against the query string, use QueryStringConditionConfig.

          • HttpHeaderConfig — (map)

            Information for an HTTP header condition. Specify only when Field is http-header.

            • HttpHeaderName — (String)

              The name of the HTTP header field. The maximum size is 40 characters. The header name is case insensitive. The allowed characters are specified by RFC 7230. Wildcards are not supported.

              You can't use an HTTP header condition to specify the host header. Use HostHeaderConditionConfig to specify a host header condition.

            • Values — (Array<String>)

              One or more strings to compare against the value of the HTTP header. The maximum size of each string is 128 characters. The comparison strings are case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).

              If the same header appears multiple times in the request, we search them in order until a match is found.

              If you specify multiple strings, the condition is satisfied if one of the strings matches the value of the HTTP header. To require that all of the strings are a match, create one condition per string.

          • QueryStringConfig — (map)

            Information for a query string condition. Specify only when Field is query-string.

            • Values — (Array<map>)

              One or more key/value pairs or values to find in the query string. The maximum size of each string is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character). To search for a literal '*' or '?' character in a query string, you must escape these characters in Values using a '\' character.

              If you specify multiple key/value pairs or values, the condition is satisfied if one of them is found in the query string.

              • Key — (String)

                The key. You can omit the key.

              • Value — (String)

                The value.

          • HttpRequestMethodConfig — (map)

            Information for an HTTP method condition. Specify only when Field is http-request-method.

            • Values — (Array<String>)

              The name of the request method. The maximum size is 40 characters. The allowed characters are A-Z, hyphen (-), and underscore (_). The comparison is case sensitive. Wildcards are not supported; therefore, the method name must be an exact match.

              If you specify multiple strings, the condition is satisfied if one of the strings matches the HTTP request method. We recommend that you route GET and HEAD requests in the same way, because the response to a HEAD request may be cached.

          • SourceIpConfig — (map)

            Information for a source IP condition. Specify only when Field is source-ip.

            • Values — (Array<String>)

              One or more source IP addresses, in CIDR format. You can use both IPv4 and IPv6 addresses. Wildcards are not supported.

              If you specify multiple addresses, the condition is satisfied if the source IP address of the request matches one of the CIDR blocks. This condition is not satisfied by the addresses in the X-Forwarded-For header. To search for addresses in the X-Forwarded-For header, use HttpHeaderConditionConfig.

        • Actions — (Array<map>)

          The actions. Each rule must include exactly one of the following types of actions: forward, redirect, or fixed-response, and it must be the last action to be performed.

          • Typerequired — (String)

            The type of action.

            Possible values include:
            • "forward"
            • "authenticate-oidc"
            • "authenticate-cognito"
            • "redirect"
            • "fixed-response"
          • TargetGroupArn — (String)

            The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward and you want to route to a single target group. To route to one or more target groups, use ForwardConfig instead.

          • AuthenticateOidcConfig — (map)

            [HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc.

            • Issuerrequired — (String)

              The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • AuthorizationEndpointrequired — (String)

              The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • TokenEndpointrequired — (String)

              The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • UserInfoEndpointrequired — (String)

              The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.

            • ClientIdrequired — (String)

              The OAuth 2.0 client identifier.

            • ClientSecret — (String)

              The OAuth 2.0 client secret. This parameter is required if you are creating a rule. If you are modifying a rule, you can omit this parameter if you set UseExistingClientSecret to true.

            • SessionCookieName — (String)

              The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.

            • Scope — (String)

              The set of user claims to be requested from the IdP. The default is openid.

              To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.

            • SessionTimeout — (Integer)

              The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).

            • AuthenticationRequestExtraParams — (map<String>)

              The query parameters (up to 10) to include in the redirect request to the authorization endpoint.

            • OnUnauthenticatedRequest — (String)

              The behavior if the user is not authenticated. The following are possible values:

              • deny - Return an HTTP 401 Unauthorized error.

              • allow - Allow the request to be forwarded to the target.

              • authenticate - Redirect the request to the IdP authorization endpoint. This is the default value.

              Possible values include:
              • "deny"
              • "allow"
              • "authenticate"
            • UseExistingClientSecret — (Boolean)

              Indicates whether to use the existing client secret when modifying a rule. If you are creating a rule, you can omit this parameter or set it to false.

          • AuthenticateCognitoConfig — (map)

            [HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only when Type is authenticate-cognito.

            • UserPoolArnrequired — (String)

              The Amazon Resource Name (ARN) of the Amazon Cognito user pool.

            • UserPoolClientIdrequired — (String)

              The ID of the Amazon Cognito user pool client.

            • UserPoolDomainrequired — (String)

              The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.

            • SessionCookieName — (String)

              The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.

            • Scope — (String)

              The set of user claims to be requested from the IdP. The default is openid.

              To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.

            • SessionTimeout — (Integer)

              The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).

            • AuthenticationRequestExtraParams — (map<String>)

              The query parameters (up to 10) to include in the redirect request to the authorization endpoint.

            • OnUnauthenticatedRequest — (String)

              The behavior if the user is not authenticated. The following are possible values:

              • deny - Return an HTTP 401 Unauthorized error.

              • allow - Allow the request to be forwarded to the target.

              • authenticate - Redirect the request to the IdP authorization endpoint. This is the default value.

              Possible values include:
              • "deny"
              • "allow"
              • "authenticate"
          • Order — (Integer)

            The order for the action. This value is required for rules with multiple actions. The action with the lowest value for order is performed first.

          • RedirectConfig — (map)

            [Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect.

            • Protocol — (String)

              The protocol. You can specify HTTP, HTTPS, or #{protocol}. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You cannot redirect HTTPS to HTTP.

            • Port — (String)

              The port. You can specify a value from 1 to 65535 or #{port}.

            • Host — (String)

              The hostname. This component is not percent-encoded. The hostname can contain #{host}.

            • Path — (String)

              The absolute path, starting with the leading "/". This component is not percent-encoded. The path can contain #{host}, #{path}, and #{port}.

            • Query — (String)

              The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.

            • StatusCoderequired — (String)

              The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).

              Possible values include:
              • "HTTP_301"
              • "HTTP_302"
          • FixedResponseConfig — (map)

            [Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only when Type is fixed-response.

            • MessageBody — (String)

              The message.

            • StatusCoderequired — (String)

              The HTTP response code (2XX, 4XX, or 5XX).

            • ContentType — (String)

              The content type.

              Valid Values: text/plain | text/css | text/html | application/javascript | application/json

          • ForwardConfig — (map)

            Information for creating an action that distributes requests among one or more target groups. For Network Load Balancers, you can specify a single target group. Specify only when Type is forward. If you specify both ForwardConfig and TargetGroupArn, you can specify only one target group using ForwardConfig and it must be the same target group specified in TargetGroupArn.

            • TargetGroups — (Array<map>)

              One or more target groups. For Network Load Balancers, you can specify a single target group.

              • TargetGroupArn — (String)

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

              • Weight — (Integer)

                The weight. The range is 0 to 999.

            • TargetGroupStickinessConfig — (map)

              The target group stickiness for the rule.

              • Enabled — (Boolean)

                Indicates whether target group stickiness is enabled.

              • DurationSeconds — (Integer)

                The time period, in seconds, during which requests from a client should be routed to the same target group. The range is 1-604800 seconds (7 days).

        • IsDefault — (Boolean)

          Indicates whether this is the default rule.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

setSecurityGroups(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

To associate a security group with a load balancer


/* This example associates the specified security group with the specified load balancer. */

 var params = {
  LoadBalancerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
  SecurityGroups: [
     "sg-5943793c"
  ]
 };
 elbv2.setSecurityGroups(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    SecurityGroupIds: [
       "sg-5943793c"
    ]
   }
   */
 });

Calling the setSecurityGroups operation

var params = {
  LoadBalancerArn: 'STRING_VALUE', /* required */
  SecurityGroups: [ /* required */
    'STRING_VALUE',
    /* more items */
  ]
};
elbv2.setSecurityGroups(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • LoadBalancerArn — (String)

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

    • SecurityGroups — (Array<String>)

      The IDs of the security groups.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • SecurityGroupIds — (Array<String>)

        The IDs of the security groups associated with the load balancer.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

setSubnets(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

To enable Availability Zones for a load balancer


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

 var params = {
  LoadBalancerArn: "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", 
  Subnets: [
     "subnet-8360a9e7", 
     "subnet-b7d581c0"
  ]
 };
 elbv2.setSubnets(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    AvailabilityZones: [
       {
      SubnetId: "subnet-8360a9e7", 
      ZoneName: "us-west-2a"
     }, 
       {
      SubnetId: "subnet-b7d581c0", 
      ZoneName: "us-west-2b"
     }
    ]
   }
   */
 });

Calling the setSubnets operation

var params = {
  LoadBalancerArn: 'STRING_VALUE', /* required */
  IpAddressType: ipv4 | dualstack,
  SubnetMappings: [
    {
      AllocationId: 'STRING_VALUE',
      IPv6Address: 'STRING_VALUE',
      PrivateIPv4Address: 'STRING_VALUE',
      SubnetId: 'STRING_VALUE'
    },
    /* more items */
  ],
  Subnets: [
    'STRING_VALUE',
    /* more items */
  ]
};
elbv2.setSubnets(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • LoadBalancerArn — (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.

    • SubnetMappings — (Array<map>)

      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.

      • SubnetId — (String)

        The ID of the subnet.

      • AllocationId — (String)

        [Network Load Balancers] The allocation ID of the Elastic IP address for an internet-facing load balancer.

      • PrivateIPv4Address — (String)

        [Network Load Balancers] The private IPv4 address for an internal load balancer.

      • IPv6Address — (String)

        [Network Load Balancers] The IPv6 address.

    • IpAddressType — (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.

      Possible values include:
      • "ipv4"
      • "dualstack"

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • AvailabilityZones — (Array<map>)

        Information about the subnets.

        • ZoneName — (String)

          The name of the Availability Zone.

        • SubnetId — (String)

          The ID of the subnet. You can specify one subnet per Availability Zone.

        • OutpostId — (String)

          [Application Load Balancers on Outposts] The ID of the Outpost.

        • LoadBalancerAddresses — (Array<map>)

          [Network Load Balancers] If you need static IP addresses for your load balancer, you can specify one Elastic IP address per Availability Zone when you create an internal-facing load balancer. For internal load balancers, you can specify a private IP address from the IPv4 range of the subnet.

          • IpAddress — (String)

            The static IP address.

          • AllocationId — (String)

            [Network Load Balancers] The allocation ID of the Elastic IP address for an internal-facing load balancer.

          • PrivateIPv4Address — (String)

            [Network Load Balancers] The private IPv4 address for an internal load balancer.

          • IPv6Address — (String)

            [Network Load Balancers] The IPv6 address.

      • IpAddressType — (String)

        [Network Load Balancers] The IP address type.

        Possible values include:
        • "ipv4"
        • "dualstack"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

waitFor(state, params = {}, callback) ⇒ AWS.Request

Waits for a given ELBv2 resource. The final callback or 'complete' event will be fired only when the resource is either in its final state or the waiter has timed out and stopped polling for the final state.

Examples:

Waiting for the loadBalancerExists state

var params = {
  // ... input parameters ...
};
elbv2.waitFor('loadBalancerExists', params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • state (String)

    the resource state to wait for. Available states for this service are listed in "Waiter Resource States" below.

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

    a list of parameters for the given state. See each waiter resource state for required parameters.

Callback (callback):

  • function(err, data) { ... }

    Callback containing error and data information. See the respective resource state for the expected error or data information.

    If the waiter times out its requests, it will return a ResourceNotReady error.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

Waiter Resource States:

Waiter Resource Details

elbv2.waitFor('loadBalancerExists', params = {}, [callback]) ⇒ AWS.Request

Waits for the loadBalancerExists state by periodically calling the underlying ELBv2.describeLoadBalancers() operation every 15 seconds (at most 40 times).

Examples:

Waiting for the loadBalancerExists state

var params = {
  // ... input parameters ...
};
elbv2.waitFor('loadBalancerExists', params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object)
    • LoadBalancerArns — (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.)

    • PageSize — (Integer)

      The maximum number of results to return with this call.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • LoadBalancers — (Array<map>)

        Information about the load balancers.

        • LoadBalancerArn — (String)

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

        • DNSName — (String)

          The public DNS name of the load balancer.

        • CanonicalHostedZoneId — (String)

          The ID of the Amazon Route 53 hosted zone associated with the load balancer.

        • CreatedTime — (Date)

          The date and time the load balancer was created.

        • LoadBalancerName — (String)

          The name of 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.

          Possible values include:
          • "internet-facing"
          • "internal"
        • VpcId — (String)

          The ID of the VPC for the load balancer.

        • State — (map)

          The state of the load balancer.

          • Code — (String)

            The state code. The initial state of the load balancer is provisioning. After the load balancer is fully set up and ready to route traffic, its state is active. If load balancer is routing traffic but does not have the resources it needs to scale, its state isactive_impaired. If the load balancer could not be set up, its state is failed.

            Possible values include:
            • "active"
            • "provisioning"
            • "active_impaired"
            • "failed"
          • Reason — (String)

            A description of the state.

        • Type — (String)

          The type of load balancer.

          Possible values include:
          • "application"
          • "network"
          • "gateway"
        • AvailabilityZones — (Array<map>)

          The subnets for the load balancer.

          • ZoneName — (String)

            The name of the Availability Zone.

          • SubnetId — (String)

            The ID of the subnet. You can specify one subnet per Availability Zone.

          • OutpostId — (String)

            [Application Load Balancers on Outposts] The ID of the Outpost.

          • LoadBalancerAddresses — (Array<map>)

            [Network Load Balancers] If you need static IP addresses for your load balancer, you can specify one Elastic IP address per Availability Zone when you create an internal-facing load balancer. For internal load balancers, you can specify a private IP address from the IPv4 range of the subnet.

            • IpAddress — (String)

              The static IP address.

            • AllocationId — (String)

              [Network Load Balancers] The allocation ID of the Elastic IP address for an internal-facing load balancer.

            • PrivateIPv4Address — (String)

              [Network Load Balancers] The private IPv4 address for an internal load balancer.

            • IPv6Address — (String)

              [Network Load Balancers] The IPv6 address.

        • SecurityGroups — (Array<String>)

          The IDs of the security groups for the load balancer.

        • IpAddressType — (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).

          Possible values include:
          • "ipv4"
          • "dualstack"
        • CustomerOwnedIpv4Pool — (String)

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

      • NextMarker — (String)

        If there are additional results, this is the marker for the next set of results. Otherwise, this is null.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

elbv2.waitFor('loadBalancerAvailable', params = {}, [callback]) ⇒ AWS.Request

Waits for the loadBalancerAvailable state by periodically calling the underlying ELBv2.describeLoadBalancers() operation every 15 seconds (at most 40 times).

Examples:

Waiting for the loadBalancerAvailable state

var params = {
  // ... input parameters ...
};
elbv2.waitFor('loadBalancerAvailable', params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object)
    • LoadBalancerArns — (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.)

    • PageSize — (Integer)

      The maximum number of results to return with this call.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • LoadBalancers — (Array<map>)

        Information about the load balancers.

        • LoadBalancerArn — (String)

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

        • DNSName — (String)

          The public DNS name of the load balancer.

        • CanonicalHostedZoneId — (String)

          The ID of the Amazon Route 53 hosted zone associated with the load balancer.

        • CreatedTime — (Date)

          The date and time the load balancer was created.

        • LoadBalancerName — (String)

          The name of 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.

          Possible values include:
          • "internet-facing"
          • "internal"
        • VpcId — (String)

          The ID of the VPC for the load balancer.

        • State — (map)

          The state of the load balancer.

          • Code — (String)

            The state code. The initial state of the load balancer is provisioning. After the load balancer is fully set up and ready to route traffic, its state is active. If load balancer is routing traffic but does not have the resources it needs to scale, its state isactive_impaired. If the load balancer could not be set up, its state is failed.

            Possible values include:
            • "active"
            • "provisioning"
            • "active_impaired"
            • "failed"
          • Reason — (String)

            A description of the state.

        • Type — (String)

          The type of load balancer.

          Possible values include:
          • "application"
          • "network"
          • "gateway"
        • AvailabilityZones — (Array<map>)

          The subnets for the load balancer.

          • ZoneName — (String)

            The name of the Availability Zone.

          • SubnetId — (String)

            The ID of the subnet. You can specify one subnet per Availability Zone.

          • OutpostId — (String)

            [Application Load Balancers on Outposts] The ID of the Outpost.

          • LoadBalancerAddresses — (Array<map>)

            [Network Load Balancers] If you need static IP addresses for your load balancer, you can specify one Elastic IP address per Availability Zone when you create an internal-facing load balancer. For internal load balancers, you can specify a private IP address from the IPv4 range of the subnet.

            • IpAddress — (String)

              The static IP address.

            • AllocationId — (String)

              [Network Load Balancers] The allocation ID of the Elastic IP address for an internal-facing load balancer.

            • PrivateIPv4Address — (String)

              [Network Load Balancers] The private IPv4 address for an internal load balancer.

            • IPv6Address — (String)

              [Network Load Balancers] The IPv6 address.

        • SecurityGroups — (Array<String>)

          The IDs of the security groups for the load balancer.

        • IpAddressType — (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).

          Possible values include:
          • "ipv4"
          • "dualstack"
        • CustomerOwnedIpv4Pool — (String)

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

      • NextMarker — (String)

        If there are additional results, this is the marker for the next set of results. Otherwise, this is null.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

elbv2.waitFor('loadBalancersDeleted', params = {}, [callback]) ⇒ AWS.Request

Waits for the loadBalancersDeleted state by periodically calling the underlying ELBv2.describeLoadBalancers() operation every 15 seconds (at most 40 times).

Examples:

Waiting for the loadBalancersDeleted state

var params = {
  // ... input parameters ...
};
elbv2.waitFor('loadBalancersDeleted', params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object)
    • LoadBalancerArns — (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.)

    • PageSize — (Integer)

      The maximum number of results to return with this call.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • LoadBalancers — (Array<map>)

        Information about the load balancers.

        • LoadBalancerArn — (String)

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

        • DNSName — (String)

          The public DNS name of the load balancer.

        • CanonicalHostedZoneId — (String)

          The ID of the Amazon Route 53 hosted zone associated with the load balancer.

        • CreatedTime — (Date)

          The date and time the load balancer was created.

        • LoadBalancerName — (String)

          The name of 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.

          Possible values include:
          • "internet-facing"
          • "internal"
        • VpcId — (String)

          The ID of the VPC for the load balancer.

        • State — (map)

          The state of the load balancer.

          • Code — (String)

            The state code. The initial state of the load balancer is provisioning. After the load balancer is fully set up and ready to route traffic, its state is active. If load balancer is routing traffic but does not have the resources it needs to scale, its state isactive_impaired. If the load balancer could not be set up, its state is failed.

            Possible values include:
            • "active"
            • "provisioning"
            • "active_impaired"
            • "failed"
          • Reason — (String)

            A description of the state.

        • Type — (String)

          The type of load balancer.

          Possible values include:
          • "application"
          • "network"
          • "gateway"
        • AvailabilityZones — (Array<map>)

          The subnets for the load balancer.

          • ZoneName — (String)

            The name of the Availability Zone.

          • SubnetId — (String)

            The ID of the subnet. You can specify one subnet per Availability Zone.

          • OutpostId — (String)

            [Application Load Balancers on Outposts] The ID of the Outpost.

          • LoadBalancerAddresses — (Array<map>)

            [Network Load Balancers] If you need static IP addresses for your load balancer, you can specify one Elastic IP address per Availability Zone when you create an internal-facing load balancer. For internal load balancers, you can specify a private IP address from the IPv4 range of the subnet.

            • IpAddress — (String)

              The static IP address.

            • AllocationId — (String)

              [Network Load Balancers] The allocation ID of the Elastic IP address for an internal-facing load balancer.

            • PrivateIPv4Address — (String)

              [Network Load Balancers] The private IPv4 address for an internal load balancer.

            • IPv6Address — (String)

              [Network Load Balancers] The IPv6 address.

        • SecurityGroups — (Array<String>)

          The IDs of the security groups for the load balancer.

        • IpAddressType — (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).

          Possible values include:
          • "ipv4"
          • "dualstack"
        • CustomerOwnedIpv4Pool — (String)

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

      • NextMarker — (String)

        If there are additional results, this is the marker for the next set of results. Otherwise, this is null.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

elbv2.waitFor('targetInService', params = {}, [callback]) ⇒ AWS.Request

Waits for the targetInService state by periodically calling the underlying ELBv2.describeTargetHealth() operation every 15 seconds (at most 40 times).

Examples:

Waiting for the targetInService state

var params = {
  TargetGroupArn: 'STRING_VALUE', /* required */
};
elbv2.waitFor('targetInService', params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object)
    • TargetGroupArn — (String)

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

    • Targets — (Array<map>)

      The targets.

      • Idrequired — (String)

        The ID of the target. If the target type of the target group is instance, specify an instance ID. If the target type is ip, specify an IP address. If the target type is lambda, specify the ARN of the Lambda function. If the target type is alb, specify the ARN of the Application Load Balancer target.

      • Port — (Integer)

        The port on which the target is listening. If the target group protocol is GENEVE, the supported port is 6081. If the target type is alb, the targeted Application Load Balancer must have at least one listener whose port matches the target group port. Not used if the target is a Lambda function.

      • AvailabilityZone — (String)

        An Availability Zone or all. This determines whether the target receives traffic from the load balancer nodes in the specified Availability Zone or from all enabled Availability Zones for the load balancer.

        This parameter is not supported if the target type of the target group is instance or alb.

        If the target type is ip and the IP address is in a subnet of the VPC for the target group, the Availability Zone is automatically detected and this parameter is optional. If the IP address is outside the VPC, this parameter is required.

        With an Application Load Balancer, if the target type is ip and the IP address is outside the VPC for the target group, the only supported value is all.

        If the target type is lambda, this parameter is optional and the only supported value is all.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • TargetHealthDescriptions — (Array<map>)

        Information about the health of the targets.

        • Target — (map)

          The description of the target.

          • Idrequired — (String)

            The ID of the target. If the target type of the target group is instance, specify an instance ID. If the target type is ip, specify an IP address. If the target type is lambda, specify the ARN of the Lambda function. If the target type is alb, specify the ARN of the Application Load Balancer target.

          • Port — (Integer)

            The port on which the target is listening. If the target group protocol is GENEVE, the supported port is 6081. If the target type is alb, the targeted Application Load Balancer must have at least one listener whose port matches the target group port. Not used if the target is a Lambda function.

          • AvailabilityZone — (String)

            An Availability Zone or all. This determines whether the target receives traffic from the load balancer nodes in the specified Availability Zone or from all enabled Availability Zones for the load balancer.

            This parameter is not supported if the target type of the target group is instance or alb.

            If the target type is ip and the IP address is in a subnet of the VPC for the target group, the Availability Zone is automatically detected and this parameter is optional. If the IP address is outside the VPC, this parameter is required.

            With an Application Load Balancer, if the target type is ip and the IP address is outside the VPC for the target group, the only supported value is all.

            If the target type is lambda, this parameter is optional and the only supported value is all.

        • HealthCheckPort — (String)

          The port to use to connect with the target.

        • TargetHealth — (map)

          The health information for the target.

          • State — (String)

            The state of the target.

            Possible values include:
            • "initial"
            • "healthy"
            • "unhealthy"
            • "unused"
            • "draining"
            • "unavailable"
          • Reason — (String)

            The reason code.

            If the target state is healthy, a reason code is not provided.

            If the target state is initial, the reason code can be one of the following values:

            • Elb.RegistrationInProgress - The target is in the process of being registered with the load balancer.

            • Elb.InitialHealthChecking - The load balancer is still sending the target the minimum number of health checks required to determine its health status.

            If the target state is unhealthy, the reason code can be one of the following values:

            • Target.ResponseCodeMismatch - The health checks did not return an expected HTTP code. Applies only to Application Load Balancers and Gateway Load Balancers.

            • Target.Timeout - The health check requests timed out. Applies only to Application Load Balancers and Gateway Load Balancers.

            • Target.FailedHealthChecks - The load balancer received an error while establishing a connection to the target or the target response was malformed.

            • Elb.InternalError - The health checks failed due to an internal error. Applies only to Application Load Balancers.

            If the target state is unused, the reason code can be one of the following values:

            • Target.NotRegistered - The target is not registered with the target group.

            • Target.NotInUse - The target group is not used by any load balancer or the target is in an Availability Zone that is not enabled for its load balancer.

            • Target.InvalidState - The target is in the stopped or terminated state.

            • Target.IpUnusable - The target IP address is reserved for use by a load balancer.

            If the target state is draining, the reason code can be the following value:

            • Target.DeregistrationInProgress - The target is in the process of being deregistered and the deregistration delay period has not expired.

            If the target state is unavailable, the reason code can be the following value:

            • Target.HealthCheckDisabled - Health checks are disabled for the target group. Applies only to Application Load Balancers.

            • Elb.InternalError - Target health is unavailable due to an internal error. Applies only to Network Load Balancers.

            Possible values include:
            • "Elb.RegistrationInProgress"
            • "Elb.InitialHealthChecking"
            • "Target.ResponseCodeMismatch"
            • "Target.Timeout"
            • "Target.FailedHealthChecks"
            • "Target.NotRegistered"
            • "Target.NotInUse"
            • "Target.DeregistrationInProgress"
            • "Target.InvalidState"
            • "Target.IpUnusable"
            • "Target.HealthCheckDisabled"
            • "Elb.InternalError"
          • Description — (String)

            A description of the target health that provides additional details. If the state is healthy, a description is not provided.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

elbv2.waitFor('targetDeregistered', params = {}, [callback]) ⇒ AWS.Request

Waits for the targetDeregistered state by periodically calling the underlying ELBv2.describeTargetHealth() operation every 15 seconds (at most 40 times).

Examples:

Waiting for the targetDeregistered state

var params = {
  TargetGroupArn: 'STRING_VALUE', /* required */
};
elbv2.waitFor('targetDeregistered', params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object)
    • TargetGroupArn — (String)

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

    • Targets — (Array<map>)

      The targets.

      • Idrequired — (String)

        The ID of the target. If the target type of the target group is instance, specify an instance ID. If the target type is ip, specify an IP address. If the target type is lambda, specify the ARN of the Lambda function. If the target type is alb, specify the ARN of the Application Load Balancer target.

      • Port — (Integer)

        The port on which the target is listening. If the target group protocol is GENEVE, the supported port is 6081. If the target type is alb, the targeted Application Load Balancer must have at least one listener whose port matches the target group port. Not used if the target is a Lambda function.

      • AvailabilityZone — (String)

        An Availability Zone or all. This determines whether the target receives traffic from the load balancer nodes in the specified Availability Zone or from all enabled Availability Zones for the load balancer.

        This parameter is not supported if the target type of the target group is instance or alb.

        If the target type is ip and the IP address is in a subnet of the VPC for the target group, the Availability Zone is automatically detected and this parameter is optional. If the IP address is outside the VPC, this parameter is required.

        With an Application Load Balancer, if the target type is ip and the IP address is outside the VPC for the target group, the only supported value is all.

        If the target type is lambda, this parameter is optional and the only supported value is all.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • TargetHealthDescriptions — (Array<map>)

        Information about the health of the targets.

        • Target — (map)

          The description of the target.

          • Idrequired — (String)

            The ID of the target. If the target type of the target group is instance, specify an instance ID. If the target type is ip, specify an IP address. If the target type is lambda, specify the ARN of the Lambda function. If the target type is alb, specify the ARN of the Application Load Balancer target.

          • Port — (Integer)

            The port on which the target is listening. If the target group protocol is GENEVE, the supported port is 6081. If the target type is alb, the targeted Application Load Balancer must have at least one listener whose port matches the target group port. Not used if the target is a Lambda function.

          • AvailabilityZone — (String)

            An Availability Zone or all. This determines whether the target receives traffic from the load balancer nodes in the specified Availability Zone or from all enabled Availability Zones for the load balancer.

            This parameter is not supported if the target type of the target group is instance or alb.

            If the target type is ip and the IP address is in a subnet of the VPC for the target group, the Availability Zone is automatically detected and this parameter is optional. If the IP address is outside the VPC, this parameter is required.

            With an Application Load Balancer, if the target type is ip and the IP address is outside the VPC for the target group, the only supported value is all.

            If the target type is lambda, this parameter is optional and the only supported value is all.

        • HealthCheckPort — (String)

          The port to use to connect with the target.

        • TargetHealth — (map)

          The health information for the target.

          • State — (String)

            The state of the target.

            Possible values include:
            • "initial"
            • "healthy"
            • "unhealthy"
            • "unused"
            • "draining"
            • "unavailable"
          • Reason — (String)

            The reason code.

            If the target state is healthy, a reason code is not provided.

            If the target state is initial, the reason code can be one of the following values:

            • Elb.RegistrationInProgress - The target is in the process of being registered with the load balancer.

            • Elb.InitialHealthChecking - The load balancer is still sending the target the minimum number of health checks required to determine its health status.

            If the target state is unhealthy, the reason code can be one of the following values:

            • Target.ResponseCodeMismatch - The health checks did not return an expected HTTP code. Applies only to Application Load Balancers and Gateway Load Balancers.

            • Target.Timeout - The health check requests timed out. Applies only to Application Load Balancers and Gateway Load Balancers.

            • Target.FailedHealthChecks - The load balancer received an error while establishing a connection to the target or the target response was malformed.

            • Elb.InternalError - The health checks failed due to an internal error. Applies only to Application Load Balancers.

            If the target state is unused, the reason code can be one of the following values:

            • Target.NotRegistered - The target is not registered with the target group.

            • Target.NotInUse - The target group is not used by any load balancer or the target is in an Availability Zone that is not enabled for its load balancer.

            • Target.InvalidState - The target is in the stopped or terminated state.

            • Target.IpUnusable - The target IP address is reserved for use by a load balancer.

            If the target state is draining, the reason code can be the following value:

            • Target.DeregistrationInProgress - The target is in the process of being deregistered and the deregistration delay period has not expired.

            If the target state is unavailable, the reason code can be the following value:

            • Target.HealthCheckDisabled - Health checks are disabled for the target group. Applies only to Application Load Balancers.

            • Elb.InternalError - Target health is unavailable due to an internal error. Applies only to Network Load Balancers.

            Possible values include:
            • "Elb.RegistrationInProgress"
            • "Elb.InitialHealthChecking"
            • "Target.ResponseCodeMismatch"
            • "Target.Timeout"
            • "Target.FailedHealthChecks"
            • "Target.NotRegistered"
            • "Target.NotInUse"
            • "Target.DeregistrationInProgress"
            • "Target.InvalidState"
            • "Target.IpUnusable"
            • "Target.HealthCheckDisabled"
            • "Elb.InternalError"
          • Description — (String)

            A description of the target health that provides additional details. If the state is healthy, a description is not provided.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also: