Class: AWS.ELBv2
- Inherits:
-
AWS.Service
- Object
- AWS.Service
- AWS.ELBv2
- 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, and Classic Load Balancers.
An Application Load Balancer makes routing and load balancing decisions at the application layer (HTTP/HTTPS). A Network Load Balancer makes routing and load balancing decisions at the transport layer (TCP/TLS). Both Application Load Balancers and Network Load Balancers can route requests to one or more ports on each EC2 instance or container instance in your virtual private cloud (VPC).
A Classic Load Balancer makes routing and load balancing decisions either at the transport layer (TCP/SSL) or the application layer (HTTP/HTTPS), and supports either EC2-Classic or a VPC. For more information, see the Elastic Load Balancing User Guide.
This reference covers the 2015-12-01 API, which supports Application Load Balancers and Network Load Balancers. The 2012-06-01 API supports Classic Load Balancers.
To get started, complete the following tasks:
-
Create a load balancer using CreateLoadBalancer.
-
Create a target group using CreateTargetGroup.
-
Register targets for the target group using RegisterTargets.
-
Create one or more listeners for your load balancer using CreateListener.
To delete a load balancer and its related resources, complete the following tasks:
-
Delete the load balancer using DeleteLoadBalancer.
-
Delete the target group using DeleteTargetGroup.
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
-
new AWS.ELBv2(options = {}) ⇒ Object
constructor
Constructs a service object.
Property Summary
-
endpoint ⇒ AWS.Endpoint
readwrite
An Endpoint object representing the endpoint URL for service requests.
Properties inherited from AWS.Service
Method Summary
-
addListenerCertificates(params = {}, callback) ⇒ AWS.Request
Adds the specified certificate to the specified HTTPS listener.
-
addTags(params = {}, callback) ⇒ AWS.Request
Adds the specified tags to the specified Elastic Load Balancing resource.
-
createListener(params = {}, callback) ⇒ AWS.Request
Creates a listener for the specified Application Load Balancer or Network Load Balancer.
-
createLoadBalancer(params = {}, callback) ⇒ AWS.Request
Creates an Application Load Balancer or a Network Load Balancer.
-
createRule(params = {}, callback) ⇒ AWS.Request
Creates a rule for the specified listener.
-
createTargetGroup(params = {}, callback) ⇒ AWS.Request
Creates a target group.
-
deleteListener(params = {}, callback) ⇒ AWS.Request
Deletes the specified listener.
-
deleteLoadBalancer(params = {}, callback) ⇒ AWS.Request
Deletes the specified Application Load Balancer or Network Load Balancer and its attached listeners.
-
deleteRule(params = {}, callback) ⇒ AWS.Request
Deletes the specified rule.
-
deleteTargetGroup(params = {}, callback) ⇒ AWS.Request
Deletes the specified target group.
-
deregisterTargets(params = {}, callback) ⇒ AWS.Request
Deregisters the specified targets from the specified target group.
-
describeAccountLimits(params = {}, callback) ⇒ AWS.Request
Describes the current Elastic Load Balancing resource limits for your AWS account.
-
describeListenerCertificates(params = {}, callback) ⇒ AWS.Request
Describes the certificates for the specified HTTPS listener.
-
describeListeners(params = {}, callback) ⇒ AWS.Request
Describes the specified listeners or the listeners for the specified Application Load Balancer or Network Load Balancer.
-
describeLoadBalancerAttributes(params = {}, callback) ⇒ AWS.Request
Describes the attributes for the specified Application Load Balancer or Network Load Balancer.
-
describeLoadBalancers(params = {}, callback) ⇒ AWS.Request
Describes the specified load balancers or all of your load balancers.
-
describeRules(params = {}, callback) ⇒ AWS.Request
Describes the specified rules or the rules for the specified listener.
-
describeSSLPolicies(params = {}, callback) ⇒ AWS.Request
Describes the specified policies or all policies used for SSL negotiation.
-
describeTags(params = {}, callback) ⇒ AWS.Request
Describes the tags for the specified resources.
-
describeTargetGroupAttributes(params = {}, callback) ⇒ AWS.Request
Describes the attributes for the specified target group.
-
describeTargetGroups(params = {}, callback) ⇒ AWS.Request
Describes the specified target groups or all of your target groups.
-
describeTargetHealth(params = {}, callback) ⇒ AWS.Request
Describes the health of the specified targets or all of your targets.
-
modifyListener(params = {}, callback) ⇒ AWS.Request
Modifies the specified properties of the specified listener.
-
modifyLoadBalancerAttributes(params = {}, callback) ⇒ AWS.Request
Modifies the specified attributes of the specified Application Load Balancer or Network Load Balancer.
-
modifyRule(params = {}, callback) ⇒ AWS.Request
Modifies the specified rule.
-
modifyTargetGroup(params = {}, callback) ⇒ AWS.Request
Modifies the health checks used when evaluating the health state of the targets in the specified target group.
-
modifyTargetGroupAttributes(params = {}, callback) ⇒ AWS.Request
Modifies the specified attributes of the specified target group.
-
registerTargets(params = {}, callback) ⇒ AWS.Request
Registers the specified targets with the specified target group.
-
removeListenerCertificates(params = {}, callback) ⇒ AWS.Request
Removes the specified certificate from the specified HTTPS listener.
-
removeTags(params = {}, callback) ⇒ AWS.Request
Removes the specified tags from the specified Elastic Load Balancing resource.
-
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.
-
setRulePriorities(params = {}, callback) ⇒ AWS.Request
Sets the priorities of the specified rules.
-
setSecurityGroups(params = {}, callback) ⇒ AWS.Request
Associates the specified security groups with the specified Application Load Balancer.
-
setSubnets(params = {}, callback) ⇒ AWS.Request
Enables the Availability Zone for the specified public subnets for the specified Application Load Balancer.
-
waitFor(state, params = {}, callback) ⇒ AWS.Request
Waits for a given ELBv2 resource.
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)
—
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'
. -
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.
- min [Boolean] — Validates that a value meets the min
constraint. This is enabled by default when paramValidation is set
to
-
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 totrue
. -
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 returns the amount of time to delay in milliseconds. The
base
option will be ignored if this option is supplied.
-
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)
—
whether to enable endpoint discovery for operations that allow optionally using an endpoint returned by the service. Defaults to 'false'
-
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
.
Property Details
Method Details
addListenerCertificates(params = {}, callback) ⇒ AWS.Request
Adds the specified certificate to the specified HTTPS listener.
If the certificate was already added, the call is successful but the certificate is not added again.
To list the certificates for your listener, use DescribeListenerCertificates. To remove certificates from your listener, use RemoveListenerCertificates. To specify the default SSL server certificate, use ModifyListener.
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 setIsDefault
.CertificateArn
— (String
)The Amazon Resource Name (ARN) of the certificate.
IsDefault
— (Boolean
)Indicates whether the certificate is the default certificate. Do not set
IsDefault
when specifying a certificate as an input parameter.
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. Thedata
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
IsDefault
when specifying a certificate as an input parameter.
-
(AWS.Response)
—
Returns:
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, and your target groups.
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.
To list the current tags for your resources, use DescribeTags. To remove tags from your resources, use RemoveTags.
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. Each resource can have a maximum of 10 tags.
Key
— required — (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.
-
(AWS.Response)
—
Returns:
createListener(params = {}, callback) ⇒ AWS.Request
Creates a listener for the specified Application Load Balancer or Network Load Balancer.
To update a listener, use ModifyListener. When you are finished with a listener, you can delete it using DeleteListener. If you are finished with both the listener and the load balancer, you can delete them both using DeleteLoadBalancer.
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.
For more information, see Listeners for Your Application Load Balancers in the Application Load Balancers Guide and Listeners for Your Network Load Balancers in the Network Load Balancers Guide.
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'
},
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 */
Port: 'NUMBER_VALUE', /* required */
Protocol: HTTP | HTTPS | TCP | TLS, /* required */
Certificates: [
{
CertificateArn: 'STRING_VALUE',
IsDefault: true || false
},
/* more items */
],
SslPolicy: 'STRING_VALUE'
};
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 and TLS.
Possible values include:"HTTP"
"HTTPS"
"TCP"
"TLS"
Port
— (Integer
)The port on which the load balancer is listening.
SslPolicy
— (String
)[HTTPS and TLS listeners] The security policy that defines which ciphers and protocols are supported. The default is the current predefined security policy.
Certificates
— (Array<map>
)[HTTPS and TLS listeners] The default SSL server certificate. You must provide exactly one certificate. Set
CertificateArn
to the certificate ARN but do not setIsDefault
.To create a certificate list, use AddListenerCertificates.
CertificateArn
— (String
)The Amazon Resource Name (ARN) of the certificate.
IsDefault
— (Boolean
)Indicates whether the certificate is the default certificate. Do not set
IsDefault
when specifying a certificate as an input parameter.
DefaultActions
— (Array<map>
)The actions for the default rule. The rule must include one forward action or one or more fixed-response actions.
If the action type is
forward
, you specify a target group. The protocol of the target group must be HTTP or HTTPS for an Application Load Balancer. The protocol of the target group must be TCP or TLS for a Network Load Balancer.[HTTPS listeners] If the action type is
authenticate-oidc
, you authenticate users through an identity provider that is OpenID Connect (OIDC) compliant.[HTTPS listeners] If the action type is
authenticate-cognito
, you authenticate users through the user pools supported by Amazon Cognito.[Application Load Balancer] If the action type is
redirect
, you redirect specified client requests from one URL to another.[Application Load Balancer] If the action type is
fixed-response
, you drop specified client requests and return a custom HTTP response.Type
— required — (String
)The type of action. Each rule must include exactly one of the following types of actions:
Possible values include:forward
,fixed-response
, orredirect
."forward"
"authenticate-oidc"
"authenticate-cognito"
"redirect"
"fixed-response"
TargetGroupArn
— (String
)The Amazon Resource Name (ARN) of the target group. Specify only when
Type
isforward
.AuthenticateOidcConfig
— (map
)[HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when
Type
isauthenticate-oidc
.Issuer
— required — (String
)The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
AuthorizationEndpoint
— required — (String
)The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
TokenEndpoint
— required — (String
)The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
UserInfoEndpoint
— required — (String
)The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
ClientId
— required — (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
isauthenticate-cognito
.UserPoolArn
— required — (String
)The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
UserPoolClientId
— required — (String
)The ID of the Amazon Cognito user pool client.
UserPoolDomain
— required — (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. The final action to be performed must be a
forward
or afixed-response
action.RedirectConfig
— (map
)[Application Load Balancer] Information for creating a redirect action. Specify only when
Type
isredirect
.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.
StatusCode
— required — (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
isfixed-response
.MessageBody
— (String
)The message.
StatusCode
— required — (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
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"
Certificates
— (Array<map>
) The SSL server certificate. You must provide a certificate if the protocol is HTTPS or TLS.
CertificateArn
— (String
) The Amazon Resource Name (ARN) of the certificate.
IsDefault
— (Boolean
) Indicates whether the certificate is the default certificate. Do not set IsDefault
when specifying a certificate as an input parameter.
SslPolicy
— (String
) The security policy that defines which ciphers and protocols are supported. The default is the current predefined security policy.
DefaultActions
— (Array<map>
) The default actions for the listener.
Type
— required — (String
) The type of action. Each rule must include exactly one of the following types of actions: forward
, fixed-response
, or redirect
.
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
.
AuthenticateOidcConfig
— (map
) [HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type
is authenticate-oidc
.
Issuer
— required — (String
) The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
AuthorizationEndpoint
— required — (String
) The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
TokenEndpoint
— required — (String
) The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
UserInfoEndpoint
— required — (String
) The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
ClientId
— required — (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
.
UserPoolArn
— required — (String
) The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
UserPoolClientId
— required — (String
) The ID of the Amazon Cognito user pool client.
UserPoolDomain
— required — (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. The final action to be performed must be a forward
or a fixed-response
action.
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.
StatusCode
— required — (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.
StatusCode
— required — (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
Returns:
createLoadBalancer(params = {}, callback) ⇒ AWS.Request
Creates an Application Load Balancer or a Network Load Balancer.
When you create a load balancer, you can specify security groups, public subnets, IP address type, and tags. Otherwise, you could do so later using SetSecurityGroups, SetSubnets, SetIpAddressType, and AddTags.
To create listeners for your load balancer, use CreateListener. To describe your current load balancers, see DescribeLoadBalancers. When you are finished with a load balancer, you can delete it using DeleteLoadBalancer.
For limit information, see Limits for Your Application Load Balancer in the Application Load Balancers Guide and Limits for Your Network Load Balancer in the Network Load Balancers Guide.
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.
For more information, see Application Load Balancers in the Application Load Balancers Guide and Network Load Balancers in the Network Load Balancers Guide.
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 */
IpAddressType: ipv4 | dualstack,
Scheme: internet-facing | internal,
SecurityGroups: [
'STRING_VALUE',
/* more items */
],
SubnetMappings: [
{
AllocationId: '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
};
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.
[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.
[Network Load Balancers] You can specify subnets from one or more Availability Zones. You can specify one Elastic IP address per subnet.
SubnetId
— (String
) The ID of the subnet.
AllocationId
— (String
) [Network Load Balancers] The allocation ID of the Elastic IP 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 only route requests from clients with access to the VPC for the load balancer.
The default is an Internet-facing load balancer.
Possible values include:
"internet-facing"
"internal"
Tags
— (Array<map>
) One or more tags to assign to the load balancer.
Key
— required — (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"
IpAddressType
— (String
) [Application 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). 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:
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 only route requests 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 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"
AvailabilityZones
— (Array<map>
) The Availability Zones for the load balancer.
ZoneName
— (String
) The name of the Availability Zone.
SubnetId
— (String
) The ID of the subnet.
LoadBalancerAddresses
— (Array<map>
) [Network Load Balancers] The static IP address.
IpAddress
— (String
) The static IP address.
AllocationId
— (String
) [Network Load Balancers] The allocation ID of the Elastic IP 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"
Returns:
createRule(params = {}, callback) ⇒ AWS.Request
Creates a rule for the specified listener. The listener must be associated with an Application Load Balancer.
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.
To view your current rules, use DescribeRules. To update a rule, use ModifyRule. To set the priorities of your rules, use SetRulePriorities. To delete a rule, use DeleteRule.
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'
},
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 */
};
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. Each condition specifies a field name and a single value.
If the field name is host-header
, you can specify a single host name (for example, my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.
-
A-Z, a-z, 0-9
-
- .
-
(matches 0 or more characters)
-
? (matches exactly 1 character)
If the field name is path-pattern
, you can specify a single path pattern. A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.
-
A-Z, a-z, 0-9
-
_ - . $ / ~ " ' @ : +
-
& (using &)
-
(matches 0 or more characters)
-
? (matches exactly 1 character)
Field
— (String
) The name of the field. The possible values are host-header
and path-pattern
.
Values
— (Array<String>
) The condition value.
If the field name is host-header
, you can specify a single host name (for example, my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.
-
A-Z, a-z, 0-9
-
- .
-
(matches 0 or more characters)
-
? (matches exactly 1 character)
If the field name is path-pattern
, you can specify a single path pattern (for example, /img/). A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.
-
A-Z, a-z, 0-9
-
_ - . $ / ~ " ' @ : +
-
& (using &)
-
* (matches 0 or more characters)
-
? (matches exactly 1 character)
HostHeaderConfig
— (map
)
Values
— (Array<String>
)
PathPatternConfig
— (map
)
Values
— (Array<String>
)
HttpHeaderConfig
— (map
)
HttpHeaderName
— (String
)
Values
— (Array<String>
)
QueryStringConfig
— (map
)
Values
— (Array<map>
)
Key
— (String
)
Value
— (String
)
HttpRequestMethodConfig
— (map
)
Values
— (Array<String>
)
SourceIpConfig
— (map
)
Values
— (Array<String>
)
Priority
— (Integer
) The rule priority. A listener can't have multiple rules with the same priority.
Actions
— (Array<map>
) The actions. Each rule must include exactly one of the following types of actions: forward
, fixed-response
, or redirect
.
If the action type is forward
, you specify a target group. The protocol of the target group must be HTTP or HTTPS for an Application Load Balancer. The protocol of the target group must be TCP or TLS for a Network Load Balancer.
[HTTPS listeners] If the action type is authenticate-oidc
, you authenticate users through an identity provider that is OpenID Connect (OIDC) compliant.
[HTTPS listeners] If the action type is authenticate-cognito
, you authenticate users through the user pools supported by Amazon Cognito.
[Application Load Balancer] If the action type is redirect
, you redirect specified client requests from one URL to another.
[Application Load Balancer] If the action type is fixed-response
, you drop specified client requests and return a custom HTTP response.
Type
— required — (String
) The type of action. Each rule must include exactly one of the following types of actions: forward
, fixed-response
, or redirect
.
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
.
AuthenticateOidcConfig
— (map
) [HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type
is authenticate-oidc
.
Issuer
— required — (String
) The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
AuthorizationEndpoint
— required — (String
) The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
TokenEndpoint
— required — (String
) The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
UserInfoEndpoint
— required — (String
) The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
ClientId
— required — (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
.
UserPoolArn
— required — (String
) The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
UserPoolClientId
— required — (String
) The ID of the Amazon Cognito user pool client.
UserPoolDomain
— required — (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. The final action to be performed must be a forward
or a fixed-response
action.
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.
StatusCode
— required — (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.
StatusCode
— required — (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
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.
Field
— (String
) The name of the field. The possible values are host-header
and path-pattern
.
Values
— (Array<String>
) The condition value.
If the field name is host-header
, you can specify a single host name (for example, my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.
-
A-Z, a-z, 0-9
-
- .
-
(matches 0 or more characters)
-
? (matches exactly 1 character)
If the field name is path-pattern
, you can specify a single path pattern (for example, /img/). A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.
-
A-Z, a-z, 0-9
-
_ - . $ / ~ " ' @ : +
-
& (using &)
-
* (matches 0 or more characters)
-
? (matches exactly 1 character)
HostHeaderConfig
— (map
)
Values
— (Array<String>
)
PathPatternConfig
— (map
)
Values
— (Array<String>
)
HttpHeaderConfig
— (map
)
HttpHeaderName
— (String
)
Values
— (Array<String>
)
QueryStringConfig
— (map
)
Values
— (Array<map>
)
Key
— (String
)
Value
— (String
)
HttpRequestMethodConfig
— (map
)
Values
— (Array<String>
)
SourceIpConfig
— (map
)
Values
— (Array<String>
)
Actions
— (Array<map>
) The actions.
Type
— required — (String
) The type of action. Each rule must include exactly one of the following types of actions: forward
, fixed-response
, or redirect
.
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
.
AuthenticateOidcConfig
— (map
) [HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type
is authenticate-oidc
.
Issuer
— required — (String
) The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
AuthorizationEndpoint
— required — (String
) The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
TokenEndpoint
— required — (String
) The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
UserInfoEndpoint
— required — (String
) The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
ClientId
— required — (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
.
UserPoolArn
— required — (String
) The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
UserPoolClientId
— required — (String
) The ID of the Amazon Cognito user pool client.
UserPoolDomain
— required — (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. The final action to be performed must be a forward
or a fixed-response
action.
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.
StatusCode
— required — (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.
StatusCode
— required — (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
IsDefault
— (Boolean
) Indicates whether this is the default rule.
Returns:
createTargetGroup(params = {}, callback) ⇒ AWS.Request
Creates a target group.
To register targets with the target group, use RegisterTargets. To update the health check settings for the target group, use ModifyTargetGroup. To monitor the health of targets in the target group, use DescribeTargetHealth.
To route traffic to the targets in a target group, specify the target group in an action using CreateListener or CreateRule.
To delete a target group, use DeleteTargetGroup.
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.
For more information, see Target Groups for Your Application Load Balancers in the Application Load Balancers Guide or Target Groups for Your Network Load Balancers in the Network Load Balancers Guide.
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,
HealthCheckTimeoutSeconds: 'NUMBER_VALUE',
HealthyThresholdCount: 'NUMBER_VALUE',
Matcher: {
HttpCode: 'STRING_VALUE' /* required */
},
Port: 'NUMBER_VALUE',
Protocol: HTTP | HTTPS | TCP | TLS,
TargetType: instance | ip | lambda,
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 and TLS. If the target is a Lambda function, this parameter does not apply.
Possible values include:
"HTTP"
"HTTPS"
"TCP"
"TLS"
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.
VpcId
— (String
) The identifier of the virtual private cloud (VPC). If the target is a Lambda function, this parameter does not apply.
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, the default is TCP. The TCP protocol is supported for health checks only if the protocol of the target group is TCP or TLS. The TLS protocol is not supported for health checks.
Possible values include:
"HTTP"
"HTTPS"
"TCP"
"TLS"
HealthCheckPort
— (String
) The port the load balancer uses when performing health checks on targets. The default is traffic-port
, which is the port on which each target receives traffic from the load balancer.
HealthCheckEnabled
— (Boolean
) Indicates whether health checks are enabled. If the target type is instance
or ip
, the default is true
. If the target type is lambda
, the default is false
.
HealthCheckPath
— (String
) [HTTP/HTTPS health checks] The ping path that is the destination on the targets for health checks. The default is /.
HealthCheckIntervalSeconds
— (Integer
) The approximate amount of time, in seconds, between health checks of an individual target. For Application Load Balancers, the range is 5–300 seconds. For Network Load Balancers, the supported values are 10 or 30 seconds. If the target type is instance
or ip
, the default is 30 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 Application Load Balancers, the range is 2–120 seconds and the default is 5 seconds if the target type is instance
or ip
and 30 seconds if the target type is lambda
. For Network Load Balancers, this is 10 seconds for TCP and HTTPS health checks and 6 seconds for HTTP health checks.
HealthyThresholdCount
— (Integer
) The number of consecutive health checks successes required before considering an unhealthy target healthy. For Application Load Balancers, the default is 5. For Network Load Balancers, the default is 3.
UnhealthyThresholdCount
— (Integer
) The number of consecutive health check failures required before considering a target unhealthy. For Application Load Balancers, the default is 2. For Network Load Balancers, this value must be the same as the healthy threshold count.
Matcher
— (map
) [HTTP/HTTPS health checks] The HTTP codes to use when checking for a successful response from a target.
HttpCode
— required — (String
) The HTTP codes.
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, this is 200–399.
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
- Targets are specified by instance ID. This is the default value.
-
ip
- Targets are specified 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
- The target groups contains a single Lambda function.
Possible values include:
"instance"
"ip"
"lambda"
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"
Port
— (Integer
) The port on which the targets are listening.
VpcId
— (String
) The ID of the VPC for the targets.
HealthCheckProtocol
— (String
) The protocol to use to connect with the target.
Possible values include:
"HTTP"
"HTTPS"
"TCP"
"TLS"
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 the health check request.
Matcher
— (map
) The HTTP codes to use when checking for a successful response from a target.
HttpCode
— required — (String
) The HTTP codes.
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, this is 200–399.
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
(targets are specified by instance ID) or ip
(targets are specified by IP address).
Possible values include:
"instance"
"ip"
"lambda"
Returns:
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, using DeleteLoadBalancer.
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:
deleteLoadBalancer(params = {}, callback) ⇒ AWS.Request
Deletes the specified Application Load Balancer or Network Load Balancer and its attached 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:
deleteRule(params = {}, callback) ⇒ AWS.Request
Deletes the specified 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:
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.
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:
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.
Id
— required — (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.
Port
— (Integer
) The port on which the target is listening.
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
.
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:
describeAccountLimits(params = {}, callback) ⇒ AWS.Request
Describes the current Elastic Load Balancing resource limits for your AWS account.
For more information, see Limits for Your Application Load Balancers in the Application Load Balancer Guide or Limits for Your Network Load Balancers in the Network Load Balancers Guide.
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
-
listeners-per-application-load-balancer
-
listeners-per-network-load-balancer
-
network-load-balancers
-
rules-per-application-load-balancer
-
target-groups
-
targets-per-application-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
) The marker to use when requesting the next set of results. If there are no additional results, the string is empty.
Returns:
describeListenerCertificates(params = {}, callback) ⇒ AWS.Request
Describes the certificates for the specified HTTPS listener.
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 IsDefault
when specifying a certificate as an input parameter.
NextMarker
— (String
) The marker to use when requesting the next set of results. If there are no additional results, the string is empty.
Returns:
describeListeners(params = {}, callback) ⇒ AWS.Request
Describes the specified listeners or the listeners for the specified Application Load Balancer or Network 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"
Certificates
— (Array<map>
) The SSL server certificate. You must provide a certificate if the protocol is HTTPS or TLS.
CertificateArn
— (String
) The Amazon Resource Name (ARN) of the certificate.
IsDefault
— (Boolean
) Indicates whether the certificate is the default certificate. Do not set IsDefault
when specifying a certificate as an input parameter.
SslPolicy
— (String
) The security policy that defines which ciphers and protocols are supported. The default is the current predefined security policy.
DefaultActions
— (Array<map>
) The default actions for the listener.
Type
— required — (String
) The type of action. Each rule must include exactly one of the following types of actions: forward
, fixed-response
, or redirect
.
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
.
AuthenticateOidcConfig
— (map
) [HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type
is authenticate-oidc
.
Issuer
— required — (String
) The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
AuthorizationEndpoint
— required — (String
) The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
TokenEndpoint
— required — (String
) The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
UserInfoEndpoint
— required — (String
) The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
ClientId
— required — (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
.
UserPoolArn
— required — (String
) The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
UserPoolClientId
— required — (String
) The ID of the Amazon Cognito user pool client.
UserPoolDomain
— required — (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. The final action to be performed must be a forward
or a fixed-response
action.
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.
StatusCode
— required — (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.
StatusCode
— required — (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
NextMarker
— (String
) The marker to use when requesting the next set of results. If there are no additional results, the string is empty.
Returns:
describeLoadBalancerAttributes(params = {}, callback) ⇒ AWS.Request
Describes the attributes for the specified Application Load Balancer or Network Load Balancer.
For more information, see Load Balancer Attributes in the Application Load Balancers Guide or Load Balancer Attributes in the Network Load Balancers Guide.
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 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.
-
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 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.http2.enabled
- Indicates whether HTTP/2 is enabled. The value is true
or false
. The default is true
.
The following attributes are supported by only Network Load Balancers:
-
load_balancing.cross_zone.enabled
- Indicates whether cross-zone load balancing is enabled. The value is true
or false
. The default is false
.
Value
— (String
) The value of the attribute.
Returns:
describeLoadBalancers(params = {}, callback) ⇒ AWS.Request
Describes the specified load balancers or all of your load balancers.
To describe the listeners for a load balancer, use DescribeListeners. To describe the attributes for a load balancer, use DescribeLoadBalancerAttributes.
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 only route requests 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 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"
AvailabilityZones
— (Array<map>
) The Availability Zones for the load balancer.
ZoneName
— (String
) The name of the Availability Zone.
SubnetId
— (String
) The ID of the subnet.
LoadBalancerAddresses
— (Array<map>
) [Network Load Balancers] The static IP address.
IpAddress
— (String
) The static IP address.
AllocationId
— (String
) [Network Load Balancers] The allocation ID of the Elastic IP 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"
NextMarker
— (String
) The marker to use when requesting the next set of results. If there are no additional results, the string is empty.
Returns:
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.
Field
— (String
) The name of the field. The possible values are host-header
and path-pattern
.
Values
— (Array<String>
) The condition value.
If the field name is host-header
, you can specify a single host name (for example, my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.
-
A-Z, a-z, 0-9
-
- .
-
(matches 0 or more characters)
-
? (matches exactly 1 character)
If the field name is path-pattern
, you can specify a single path pattern (for example, /img/). A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.
-
A-Z, a-z, 0-9
-
_ - . $ / ~ " ' @ : +
-
& (using &)
-
* (matches 0 or more characters)
-
? (matches exactly 1 character)
HostHeaderConfig
— (map
)
Values
— (Array<String>
)
PathPatternConfig
— (map
)
Values
— (Array<String>
)
HttpHeaderConfig
— (map
)
HttpHeaderName
— (String
)
Values
— (Array<String>
)
QueryStringConfig
— (map
)
Values
— (Array<map>
)
Key
— (String
)
Value
— (String
)
HttpRequestMethodConfig
— (map
)
Values
— (Array<String>
)
SourceIpConfig
— (map
)
Values
— (Array<String>
)
Actions
— (Array<map>
) The actions.
Type
— required — (String
) The type of action. Each rule must include exactly one of the following types of actions: forward
, fixed-response
, or redirect
.
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
.
AuthenticateOidcConfig
— (map
) [HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type
is authenticate-oidc
.
Issuer
— required — (String
) The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
AuthorizationEndpoint
— required — (String
) The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
TokenEndpoint
— required — (String
) The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
UserInfoEndpoint
— required — (String
) The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
ClientId
— required — (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
.
UserPoolArn
— required — (String
) The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
UserPoolClientId
— required — (String
) The ID of the Amazon Cognito user pool client.
UserPoolDomain
— required — (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. The final action to be performed must be a forward
or a fixed-response
action.
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.
StatusCode
— required — (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.
StatusCode
— required — (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
IsDefault
— (Boolean
) Indicates whether this is the default rule.
NextMarker
— (String
) The marker to use when requesting the next set of results. If there are no additional results, the string is empty.
Returns:
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.
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 = {
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.
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 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.
NextMarker
— (String
) The marker to use when requesting the next set of results. If there are no additional results, the string is empty.
Returns:
describeTags(params = {}, callback) ⇒ AWS.Request
Describes the tags for the specified resources. You can describe the tags for one or more Application Load Balancers, Network Load Balancers, and target groups.
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.
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.
Key
— required — (String
) The key of the tag.
Value
— (String
) The value of the tag.
Returns:
describeTargetGroupAttributes(params = {}, callback) ⇒ AWS.Request
Describes the attributes for the specified target group.
For more information, see Target Group Attributes in the Application Load Balancers Guide or Target Group Attributes in the Network Load Balancers Guide.
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 both Application Load Balancers and Network 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 Application Load Balancers if the target is not a Lambda function:
-
slow_start.duration_seconds
- The time period, in seconds, during which a newly registered target receives a linearly 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). Slow start mode is disabled by default.
-
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 value is lb_cookie
.
-
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 target is a Lambda function.
-
lambda.multi_value_headers.enabled
- Indicates whether the request and response headers 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 attribute is supported only by Network Load Balancers:
-
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:
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.
To describe the targets for a target group, use DescribeTargetHealth. To describe the attributes of a target group, use DescribeTargetGroupAttributes.
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"
Port
— (Integer
) The port on which the targets are listening.
VpcId
— (String
) The ID of the VPC for the targets.
HealthCheckProtocol
— (String
) The protocol to use to connect with the target.
Possible values include:
"HTTP"
"HTTPS"
"TCP"
"TLS"
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 the health check request.
Matcher
— (map
) The HTTP codes to use when checking for a successful response from a target.
HttpCode
— required — (String
) The HTTP codes.
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, this is 200–399.
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
(targets are specified by instance ID) or ip
(targets are specified by IP address).
Possible values include:
"instance"
"ip"
"lambda"
NextMarker
— (String
) The marker to use when requesting the next set of results. If there are no additional results, the string is empty.
Returns:
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.
Id
— required — (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.
Port
— (Integer
) The port on which the target is listening.
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
.
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.
Id
— required — (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.
Port
— (Integer
) The port on which the target is listening.
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
.
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.
-
Target.Timeout
- The health check requests timed out.
-
Target.FailedHealthChecks
- The health checks failed because the connection to the target timed out, the target response was malformed, or the target failed the health check for an unknown reason.
-
Elb.InternalError
- The health checks failed due to an internal error.
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.IpUnusable
- The target IP address is reserved for use by a load balancer.
-
Target.InvalidState
- The target is in the stopped or terminated state.
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.
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:
Waiter Resource States:
-
-
modifyListener(params = {}, callback) ⇒ AWS.Request
Modifies the specified properties of the specified listener.
Any properties that you do not specify retain their current values. However, changing the protocol from HTTPS to HTTP, or from TLS to TCP, removes the security policy and server certificate properties. If you change the protocol from HTTP to HTTPS, or from TCP to TLS, you must add the security policy and server certificate properties.
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 */
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'
},
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,
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.
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 and TLS protocols.
Possible values include:
"HTTP"
"HTTPS"
"TCP"
"TLS"
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.
Certificates
— (Array<map>
) [HTTPS and TLS listeners] The default SSL server certificate. You must provide exactly one certificate. Set CertificateArn
to the certificate ARN but do not set IsDefault
.
To create a certificate list, use AddListenerCertificates.
CertificateArn
— (String
) The Amazon Resource Name (ARN) of the certificate.
IsDefault
— (Boolean
) Indicates whether the certificate is the default certificate. Do not set IsDefault
when specifying a certificate as an input parameter.
DefaultActions
— (Array<map>
) The actions for the default rule. The rule must include one forward action or one or more fixed-response actions.
If the action type is forward
, you specify a target group. The protocol of the target group must be HTTP or HTTPS for an Application Load Balancer. The protocol of the target group must be TCP or TLS for a Network Load Balancer.
[HTTPS listeners] If the action type is authenticate-oidc
, you authenticate users through an identity provider that is OpenID Connect (OIDC) compliant.
[HTTPS listeners] If the action type is authenticate-cognito
, you authenticate users through the user pools supported by Amazon Cognito.
[Application Load Balancer] If the action type is redirect
, you redirect specified client requests from one URL to another.
[Application Load Balancer] If the action type is fixed-response
, you drop specified client requests and return a custom HTTP response.
Type
— required — (String
) The type of action. Each rule must include exactly one of the following types of actions: forward
, fixed-response
, or redirect
.
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
.
AuthenticateOidcConfig
— (map
) [HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type
is authenticate-oidc
.
Issuer
— required — (String
) The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
AuthorizationEndpoint
— required — (String
) The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
TokenEndpoint
— required — (String
) The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
UserInfoEndpoint
— required — (String
) The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
ClientId
— required — (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
.
UserPoolArn
— required — (String
) The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
UserPoolClientId
— required — (String
) The ID of the Amazon Cognito user pool client.
UserPoolDomain
— required — (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. The final action to be performed must be a forward
or a fixed-response
action.
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.
StatusCode
— required — (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.
StatusCode
— required — (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
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"
Certificates
— (Array<map>
) The SSL server certificate. You must provide a certificate if the protocol is HTTPS or TLS.
CertificateArn
— (String
) The Amazon Resource Name (ARN) of the certificate.
IsDefault
— (Boolean
) Indicates whether the certificate is the default certificate. Do not set IsDefault
when specifying a certificate as an input parameter.
SslPolicy
— (String
) The security policy that defines which ciphers and protocols are supported. The default is the current predefined security policy.
DefaultActions
— (Array<map>
) The default actions for the listener.
Type
— required — (String
) The type of action. Each rule must include exactly one of the following types of actions: forward
, fixed-response
, or redirect
.
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
.
AuthenticateOidcConfig
— (map
) [HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type
is authenticate-oidc
.
Issuer
— required — (String
) The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
AuthorizationEndpoint
— required — (String
) The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
TokenEndpoint
— required — (String
) The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
UserInfoEndpoint
— required — (String
) The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
ClientId
— required — (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
.
UserPoolArn
— required — (String
) The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
UserPoolClientId
— required — (String
) The ID of the Amazon Cognito user pool client.
UserPoolDomain
— required — (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. The final action to be performed must be a forward
or a fixed-response
action.
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.
StatusCode
— required — (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.
StatusCode
— required — (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
Returns:
modifyLoadBalancerAttributes(params = {}, callback) ⇒ AWS.Request
Modifies the specified attributes of the specified Application Load Balancer or Network 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 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.
-
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 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.http2.enabled
- Indicates whether HTTP/2 is enabled. The value is true
or false
. The default is true
.
The following attributes are supported by only Network Load Balancers:
-
load_balancing.cross_zone.enabled
- Indicates whether cross-zone load balancing 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 load balancer attributes.
Key
— (String
) The name of the attribute.
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.
-
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 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.http2.enabled
- Indicates whether HTTP/2 is enabled. The value is true
or false
. The default is true
.
The following attributes are supported by only Network Load Balancers:
-
load_balancing.cross_zone.enabled
- Indicates whether cross-zone load balancing is enabled. The value is true
or false
. The default is false
.
Value
— (String
) The value of the attribute.
Returns:
modifyRule(params = {}, callback) ⇒ AWS.Request
Modifies the specified rule.
Any existing properties that you do not modify retain their current values.
To modify the actions for the default rule, use ModifyListener.
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'
},
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. Each condition specifies a field name and a single value.
If the field name is host-header
, you can specify a single host name (for example, my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.
-
A-Z, a-z, 0-9
-
- .
-
(matches 0 or more characters)
-
? (matches exactly 1 character)
If the field name is path-pattern
, you can specify a single path pattern. A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.
-
A-Z, a-z, 0-9
-
_ - . $ / ~ " ' @ : +
-
& (using &)
-
(matches 0 or more characters)
-
? (matches exactly 1 character)
Field
— (String
) The name of the field. The possible values are host-header
and path-pattern
.
Values
— (Array<String>
) The condition value.
If the field name is host-header
, you can specify a single host name (for example, my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.
-
A-Z, a-z, 0-9
-
- .
-
(matches 0 or more characters)
-
? (matches exactly 1 character)
If the field name is path-pattern
, you can specify a single path pattern (for example, /img/). A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.
-
A-Z, a-z, 0-9
-
_ - . $ / ~ " ' @ : +
-
& (using &)
-
* (matches 0 or more characters)
-
? (matches exactly 1 character)
HostHeaderConfig
— (map
)
Values
— (Array<String>
)
PathPatternConfig
— (map
)
Values
— (Array<String>
)
HttpHeaderConfig
— (map
)
HttpHeaderName
— (String
)
Values
— (Array<String>
)
QueryStringConfig
— (map
)
Values
— (Array<map>
)
Key
— (String
)
Value
— (String
)
HttpRequestMethodConfig
— (map
)
Values
— (Array<String>
)
SourceIpConfig
— (map
)
Values
— (Array<String>
)
Actions
— (Array<map>
) The actions.
If the action type is forward
, you specify a target group. The protocol of the target group must be HTTP or HTTPS for an Application Load Balancer. The protocol of the target group must be TCP or TLS for a Network Load Balancer.
[HTTPS listeners] If the action type is authenticate-oidc
, you authenticate users through an identity provider that is OpenID Connect (OIDC) compliant.
[HTTPS listeners] If the action type is authenticate-cognito
, you authenticate users through the user pools supported by Amazon Cognito.
[Application Load Balancer] If the action type is redirect
, you redirect specified client requests from one URL to another.
[Application Load Balancer] If the action type is fixed-response
, you drop specified client requests and return a custom HTTP response.
Type
— required — (String
) The type of action. Each rule must include exactly one of the following types of actions: forward
, fixed-response
, or redirect
.
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
.
AuthenticateOidcConfig
— (map
) [HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type
is authenticate-oidc
.
Issuer
— required — (String
) The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
AuthorizationEndpoint
— required — (String
) The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
TokenEndpoint
— required — (String
) The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
UserInfoEndpoint
— required — (String
) The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
ClientId
— required — (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
.
UserPoolArn
— required — (String
) The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
UserPoolClientId
— required — (String
) The ID of the Amazon Cognito user pool client.
UserPoolDomain
— required — (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. The final action to be performed must be a forward
or a fixed-response
action.
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.
StatusCode
— required — (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.
StatusCode
— required — (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
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.
Field
— (String
) The name of the field. The possible values are host-header
and path-pattern
.
Values
— (Array<String>
) The condition value.
If the field name is host-header
, you can specify a single host name (for example, my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.
-
A-Z, a-z, 0-9
-
- .
-
(matches 0 or more characters)
-
? (matches exactly 1 character)
If the field name is path-pattern
, you can specify a single path pattern (for example, /img/). A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.
-
A-Z, a-z, 0-9
-
_ - . $ / ~ " ' @ : +
-
& (using &)
-
* (matches 0 or more characters)
-
? (matches exactly 1 character)
HostHeaderConfig
— (map
)
Values
— (Array<String>
)
PathPatternConfig
— (map
)
Values
— (Array<String>
)
HttpHeaderConfig
— (map
)
HttpHeaderName
— (String
)
Values
— (Array<String>
)
QueryStringConfig
— (map
)
Values
— (Array<map>
)
Key
— (String
)
Value
— (String
)
HttpRequestMethodConfig
— (map
)
Values
— (Array<String>
)
SourceIpConfig
— (map
)
Values
— (Array<String>
)
Actions
— (Array<map>
) The actions.
Type
— required — (String
) The type of action. Each rule must include exactly one of the following types of actions: forward
, fixed-response
, or redirect
.
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
.
AuthenticateOidcConfig
— (map
) [HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type
is authenticate-oidc
.
Issuer
— required — (String
) The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
AuthorizationEndpoint
— required — (String
) The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
TokenEndpoint
— required — (String
) The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
UserInfoEndpoint
— required — (String
) The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
ClientId
— required — (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
.
UserPoolArn
— required — (String
) The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
UserPoolClientId
— required — (String
) The ID of the Amazon Cognito user pool client.
UserPoolDomain
— required — (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. The final action to be performed must be a forward
or a fixed-response
action.
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.
StatusCode
— required — (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.
StatusCode
— required — (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
IsDefault
— (Boolean
) Indicates whether this is the default rule.
Returns:
modifyTargetGroup(params = {}, callback) ⇒ AWS.Request
Modifies the health checks used when evaluating the health state of the targets in the specified target group.
To monitor the health of the targets, use DescribeTargetHealth.
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,
HealthCheckTimeoutSeconds: 'NUMBER_VALUE',
HealthyThresholdCount: 'NUMBER_VALUE',
Matcher: {
HttpCode: 'STRING_VALUE' /* required */
},
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. The TCP protocol is supported for health checks only if the protocol of the target group is TCP or TLS. The TLS protocol is not supported for health checks.
If the protocol of the target group is TCP, you can't modify this setting.
Possible values include:
"HTTP"
"HTTPS"
"TCP"
"TLS"
HealthCheckPort
— (String
) The port the load balancer uses when performing health checks on targets.
HealthCheckPath
— (String
) [HTTP/HTTPS health checks] The ping path that is the destination for the health check request.
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 Application Load Balancers, the range is 5–300 seconds. For Network Load Balancers, the supported values are 10 or 30 seconds.
If the protocol of the target group is TCP, 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.
If the protocol of the target group is TCP, 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 Network Load Balancers, this value must be the same as the healthy threshold count.
Matcher
— (map
) [HTTP/HTTPS health checks] The HTTP codes to use when checking for a successful response from a target.
If the protocol of the target group is TCP, you can't modify this setting.
HttpCode
— required — (String
) The HTTP codes.
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, this is 200–399.
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"
Port
— (Integer
) The port on which the targets are listening.
VpcId
— (String
) The ID of the VPC for the targets.
HealthCheckProtocol
— (String
) The protocol to use to connect with the target.
Possible values include:
"HTTP"
"HTTPS"
"TCP"
"TLS"
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 the health check request.
Matcher
— (map
) The HTTP codes to use when checking for a successful response from a target.
HttpCode
— required — (String
) The HTTP codes.
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, this is 200–399.
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
(targets are specified by instance ID) or ip
(targets are specified by IP address).
Possible values include:
"instance"
"ip"
"lambda"
Returns:
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 both Application Load Balancers and Network 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 Application Load Balancers if the target is not a Lambda function:
-
slow_start.duration_seconds
- The time period, in seconds, during which a newly registered target receives a linearly 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). Slow start mode is disabled by default.
-
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 value is lb_cookie
.
-
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 target is a Lambda function.
-
lambda.multi_value_headers.enabled
- Indicates whether the request and response headers 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 attribute is supported only by Network Load Balancers:
-
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 both Application Load Balancers and Network 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 Application Load Balancers if the target is not a Lambda function:
-
slow_start.duration_seconds
- The time period, in seconds, during which a newly registered target receives a linearly 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). Slow start mode is disabled by default.
-
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 value is lb_cookie
.
-
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 target is a Lambda function.
-
lambda.multi_value_headers.enabled
- Indicates whether the request and response headers 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 attribute is supported only by Network Load Balancers:
-
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:
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.
To remove a target from a target group, use DeregisterTargets.
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.
To register a target by instance ID, specify the instance ID. To register a target by IP address, specify the IP address. To register a Lambda function, specify the ARN of the Lambda function.
Id
— required — (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.
Port
— (Integer
) The port on which the target is listening.
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
.
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:
removeListenerCertificates(params = {}, callback) ⇒ AWS.Request
Removes the specified certificate from the specified HTTPS listener.
You can't remove the default certificate for a listener. To replace the default certificate, call ModifyListener.
To list the certificates for your listener, use DescribeListenerCertificates.
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 IsDefault
when specifying a certificate as an input parameter.
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:
removeTags(params = {}, callback) ⇒ AWS.Request
Removes the specified tags from the specified Elastic Load Balancing resource.
To list the current tags for your resources, use DescribeTags.
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:
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.
Network Load Balancers must use ipv4
.
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
.
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:
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.
Field
— (String
) The name of the field. The possible values are host-header
and path-pattern
.
Values
— (Array<String>
) The condition value.
If the field name is host-header
, you can specify a single host name (for example, my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.
-
A-Z, a-z, 0-9
-
- .
-
(matches 0 or more characters)
-
? (matches exactly 1 character)
If the field name is path-pattern
, you can specify a single path pattern (for example, /img/). A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.
-
A-Z, a-z, 0-9
-
_ - . $ / ~ " ' @ : +
-
& (using &)
-
* (matches 0 or more characters)
-
? (matches exactly 1 character)
HostHeaderConfig
— (map
)
Values
— (Array<String>
)
PathPatternConfig
— (map
)
Values
— (Array<String>
)
HttpHeaderConfig
— (map
)
HttpHeaderName
— (String
)
Values
— (Array<String>
)
QueryStringConfig
— (map
)
Values
— (Array<map>
)
Key
— (String
)
Value
— (String
)
HttpRequestMethodConfig
— (map
)
Values
— (Array<String>
)
SourceIpConfig
— (map
)
Values
— (Array<String>
)
Actions
— (Array<map>
) The actions.
Type
— required — (String
) The type of action. Each rule must include exactly one of the following types of actions: forward
, fixed-response
, or redirect
.
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
.
AuthenticateOidcConfig
— (map
) [HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type
is authenticate-oidc
.
Issuer
— required — (String
) The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
AuthorizationEndpoint
— required — (String
) The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
TokenEndpoint
— required — (String
) The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
UserInfoEndpoint
— required — (String
) The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
ClientId
— required — (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
.
UserPoolArn
— required — (String
) The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
UserPoolClientId
— required — (String
) The ID of the Amazon Cognito user pool client.
UserPoolDomain
— required — (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. The final action to be performed must be a forward
or a fixed-response
action.
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.
StatusCode
— required — (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.
StatusCode
— required — (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
IsDefault
— (Boolean
) Indicates whether this is the default rule.
Returns:
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.
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:
setSubnets(params = {}, callback) ⇒ AWS.Request
Enables the Availability Zone for the specified public subnets for the specified Application Load Balancer. The specified subnets replace the previously enabled subnets.
You can't change the subnets for a Network Load Balancer.
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 */
SubnetMappings: [
{
AllocationId: '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 must specify subnets from at least two Availability Zones. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings.
SubnetMappings
— (Array<map>
) The IDs of the public subnets. You must specify subnets from at least two Availability Zones. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings.
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.
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 subnet and Availability Zone.
ZoneName
— (String
) The name of the Availability Zone.
SubnetId
— (String
) The ID of the subnet.
LoadBalancerAddresses
— (Array<map>
) [Network Load Balancers] The static IP address.
IpAddress
— (String
) The static IP address.
AllocationId
— (String
) [Network Load Balancers] The allocation ID of the Elastic IP address.
Returns:
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:
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 only route requests 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 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"
AvailabilityZones
— (Array<map>
) The Availability Zones for the load balancer.
ZoneName
— (String
) The name of the Availability Zone.
SubnetId
— (String
) The ID of the subnet.
LoadBalancerAddresses
— (Array<map>
) [Network Load Balancers] The static IP address.
IpAddress
— (String
) The static IP address.
AllocationId
— (String
) [Network Load Balancers] The allocation ID of the Elastic IP 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"
NextMarker
— (String
) The marker to use when requesting the next set of results. If there are no additional results, the string is empty.
Returns:
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 only route requests 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 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"
AvailabilityZones
— (Array<map>
) The Availability Zones for the load balancer.
ZoneName
— (String
) The name of the Availability Zone.
SubnetId
— (String
) The ID of the subnet.
LoadBalancerAddresses
— (Array<map>
) [Network Load Balancers] The static IP address.
IpAddress
— (String
) The static IP address.
AllocationId
— (String
) [Network Load Balancers] The allocation ID of the Elastic IP 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"
NextMarker
— (String
) The marker to use when requesting the next set of results. If there are no additional results, the string is empty.
Returns:
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 only route requests 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 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"
AvailabilityZones
— (Array<map>
) The Availability Zones for the load balancer.
ZoneName
— (String
) The name of the Availability Zone.
SubnetId
— (String
) The ID of the subnet.
LoadBalancerAddresses
— (Array<map>
) [Network Load Balancers] The static IP address.
IpAddress
— (String
) The static IP address.
AllocationId
— (String
) [Network Load Balancers] The allocation ID of the Elastic IP 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"
NextMarker
— (String
) The marker to use when requesting the next set of results. If there are no additional results, the string is empty.
Returns:
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.
Id
— required — (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.
Port
— (Integer
) The port on which the target is listening.
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
.
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.
Id
— required — (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.
Port
— (Integer
) The port on which the target is listening.
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
.
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.
-
Target.Timeout
- The health check requests timed out.
-
Target.FailedHealthChecks
- The health checks failed because the connection to the target timed out, the target response was malformed, or the target failed the health check for an unknown reason.
-
Elb.InternalError
- The health checks failed due to an internal error.
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.IpUnusable
- The target IP address is reserved for use by a load balancer.
-
Target.InvalidState
- The target is in the stopped or terminated state.
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.
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:
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.
Id
— required — (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.
Port
— (Integer
) The port on which the target is listening.
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
.
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.
Id
— required — (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.
Port
— (Integer
) The port on which the target is listening.
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
.
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.
-
Target.Timeout
- The health check requests timed out.
-
Target.FailedHealthChecks
- The health checks failed because the connection to the target timed out, the target response was malformed, or the target failed the health check for an unknown reason.
-
Elb.InternalError
- The health checks failed due to an internal error.
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.IpUnusable
- The target IP address is reserved for use by a load balancer.
-
Target.InvalidState
- The target is in the stopped or terminated state.
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.
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:
See Also: