Class: AWS.AutoScaling
- Inherits:
-
AWS.Service
- Object
- AWS.Service
- AWS.AutoScaling
- Identifier:
- autoscaling
- API Version:
- 2011-01-01
- Defined in:
- (unknown)
Overview
Constructs a service interface object. Each API operation is exposed as a function on service.
Service Description
Amazon EC2 Auto Scaling is designed to automatically launch and terminate EC2 instances based on user-defined scaling policies, scheduled actions, and health checks.
For more information, see the Amazon EC2 Auto Scaling User Guide and the Amazon EC2 Auto Scaling API Reference.
Sending a Request Using AutoScaling
var autoscaling = new AWS.AutoScaling();
autoscaling.attachLoadBalancerTargetGroups(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 AutoScaling object uses this specific API, you can
construct the object by passing the apiVersion
option to the constructor:
var autoscaling = new AWS.AutoScaling({apiVersion: '2011-01-01'});
You can also set the API version globally in AWS.config.apiVersions
using
the autoscaling service identifier:
AWS.config.apiVersions = {
autoscaling: '2011-01-01',
// other service API versions
};
var autoscaling = new AWS.AutoScaling();
Version:
-
2011-01-01
Constructor Summary collapse
-
new AWS.AutoScaling(options = {}) ⇒ Object
constructor
Constructs a service object.
Property Summary collapse
-
endpoint ⇒ AWS.Endpoint
readwrite
An Endpoint object representing the endpoint URL for service requests.
Properties inherited from AWS.Service
Method Summary collapse
-
attachInstances(params = {}, callback) ⇒ AWS.Request
Attaches one or more EC2 instances to the specified Auto Scaling group.
When you attach instances, Amazon EC2 Auto Scaling increases the desired capacity of the group by the number of instances being attached.
-
attachLoadBalancers(params = {}, callback) ⇒ AWS.Request
Note: This API operation is superseded by AttachTrafficSources, which can attach multiple traffic sources types.
- attachLoadBalancerTargetGroups(params = {}, callback) ⇒ AWS.Request
Note: This API operation is superseded by AttachTrafficSources, which can attach multiple traffic sources types.- attachTrafficSources(params = {}, callback) ⇒ AWS.Request
Attaches one or more traffic sources to the specified Auto Scaling group.
You can use any of the following as traffic sources for an Auto Scaling group:
-
Application Load Balancer
-
Classic Load Balancer
-
Gateway Load Balancer
-
Network Load Balancer
-
VPC Lattice
This operation is additive and does not detach existing traffic sources from the Auto Scaling group.
- batchDeleteScheduledAction(params = {}, callback) ⇒ AWS.Request
Deletes one or more scheduled actions for the specified Auto Scaling group.
.
- batchPutScheduledUpdateGroupAction(params = {}, callback) ⇒ AWS.Request
Creates or updates one or more scheduled scaling actions for an Auto Scaling group.
.
- cancelInstanceRefresh(params = {}, callback) ⇒ AWS.Request
Cancels an instance refresh or rollback that is in progress.
- completeLifecycleAction(params = {}, callback) ⇒ AWS.Request
Completes the lifecycle action for the specified token or instance with the specified result.
This step is a part of the procedure for adding a lifecycle hook to an Auto Scaling group:
-
(Optional) Create a launch template or launch configuration with a user data script that runs while an instance is in a wait state due to a lifecycle hook.
-
(Optional) Create a Lambda function and a rule that allows Amazon EventBridge to invoke your Lambda function when an instance is put into a wait state due to a lifecycle hook.
-
(Optional) Create a notification target and an IAM role.
- createAutoScalingGroup(params = {}, callback) ⇒ AWS.Request
We strongly recommend using a launch template when calling this operation to ensure full functionality for Amazon EC2 Auto Scaling and Amazon EC2.
Creates an Auto Scaling group with the specified name and attributes.
- createLaunchConfiguration(params = {}, callback) ⇒ AWS.Request
Creates a launch configuration.
If you exceed your maximum limit of launch configurations, the call fails.
- createOrUpdateTags(params = {}, callback) ⇒ AWS.Request
Creates or updates tags for the specified Auto Scaling group.
When you specify a tag with a key that already exists, the operation overwrites the previous tag definition, and you do not get an error message.
For more information, see Tag Auto Scaling groups and instances in the Amazon EC2 Auto Scaling User Guide.
.- deleteAutoScalingGroup(params = {}, callback) ⇒ AWS.Request
Deletes the specified Auto Scaling group.
If the group has instances or scaling activities in progress, you must specify the option to force the deletion in order for it to succeed.
- deleteLaunchConfiguration(params = {}, callback) ⇒ AWS.Request
Deletes the specified launch configuration.
The launch configuration must not be attached to an Auto Scaling group.
- deleteLifecycleHook(params = {}, callback) ⇒ AWS.Request
Deletes the specified lifecycle hook.
If there are any outstanding lifecycle actions, they are completed first (
.ABANDON
for launching instances,CONTINUE
for terminating instances).- deleteNotificationConfiguration(params = {}, callback) ⇒ AWS.Request
Deletes the specified notification.
.
- deletePolicy(params = {}, callback) ⇒ AWS.Request
Deletes the specified scaling policy.
Deleting either a step scaling policy or a simple scaling policy deletes the underlying alarm action, but does not delete the alarm, even if it no longer has an associated action.
For more information, see Delete a scaling policy in the Amazon EC2 Auto Scaling User Guide.
.- deleteScheduledAction(params = {}, callback) ⇒ AWS.Request
Deletes the specified scheduled action.
.
- deleteTags(params = {}, callback) ⇒ AWS.Request
Deletes the specified tags.
.
- deleteWarmPool(params = {}, callback) ⇒ AWS.Request
Deletes the warm pool for the specified Auto Scaling group.
For more information, see Warm pools for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
.- describeAccountLimits(params = {}, callback) ⇒ AWS.Request
Describes the current Amazon EC2 Auto Scaling resource quotas for your account.
When you establish an Amazon Web Services account, the account has initial quotas on the maximum number of Auto Scaling groups and launch configurations that you can create in a given Region.
- describeAdjustmentTypes(params = {}, callback) ⇒ AWS.Request
Describes the available adjustment types for step scaling and simple scaling policies.
The following adjustment types are supported:
-
ChangeInCapacity
-
ExactCapacity
-
PercentChangeInCapacity
- describeAutoScalingGroups(params = {}, callback) ⇒ AWS.Request
Gets information about the Auto Scaling groups in the account and Region.
If you specify Auto Scaling group names, the output includes information for only the specified Auto Scaling groups.
- describeAutoScalingInstances(params = {}, callback) ⇒ AWS.Request
Gets information about the Auto Scaling instances in the account and Region.
.
- describeAutoScalingNotificationTypes(params = {}, callback) ⇒ AWS.Request
Describes the notification types that are supported by Amazon EC2 Auto Scaling.
.
- describeInstanceRefreshes(params = {}, callback) ⇒ AWS.Request
Gets information about the instance refreshes for the specified Auto Scaling group from the previous six weeks.
This operation is part of the instance refresh feature in Amazon EC2 Auto Scaling, which helps you update instances in your Auto Scaling group after you make configuration changes.
To help you determine the status of an instance refresh, Amazon EC2 Auto Scaling returns information about the instance refreshes you previously initiated, including their status, start time, end time, the percentage of the instance refresh that is complete, and the number of instances remaining to update before the instance refresh is complete.
- describeLaunchConfigurations(params = {}, callback) ⇒ AWS.Request
Gets information about the launch configurations in the account and Region.
.
- describeLifecycleHooks(params = {}, callback) ⇒ AWS.Request
Gets information about the lifecycle hooks for the specified Auto Scaling group.
.
- describeLifecycleHookTypes(params = {}, callback) ⇒ AWS.Request
Describes the available types of lifecycle hooks.
The following hook types are supported:
-
autoscaling:EC2_INSTANCE_LAUNCHING
-
autoscaling:EC2_INSTANCE_TERMINATING
- describeLoadBalancers(params = {}, callback) ⇒ AWS.Request
Note: This API operation is superseded by DescribeTrafficSources, which can describe multiple traffic sources types.- describeLoadBalancerTargetGroups(params = {}, callback) ⇒ AWS.Request
Note: This API operation is superseded by DescribeTrafficSources, which can describe multiple traffic sources types.- describeMetricCollectionTypes(params = {}, callback) ⇒ AWS.Request
Describes the available CloudWatch metrics for Amazon EC2 Auto Scaling.
.
- describeNotificationConfigurations(params = {}, callback) ⇒ AWS.Request
Gets information about the Amazon SNS notifications that are configured for one or more Auto Scaling groups.
.
- describePolicies(params = {}, callback) ⇒ AWS.Request
Gets information about the scaling policies in the account and Region.
.
- describeScalingActivities(params = {}, callback) ⇒ AWS.Request
Gets information about the scaling activities in the account and Region.
When scaling events occur, you see a record of the scaling activity in the scaling activities.
- describeScalingProcessTypes(params = {}, callback) ⇒ AWS.Request
Describes the scaling process types for use with the ResumeProcesses and SuspendProcesses APIs.
.
- describeScheduledActions(params = {}, callback) ⇒ AWS.Request
Gets information about the scheduled actions that haven't run or that have not reached their end time.
To describe the scaling activities for scheduled actions that have already run, call the DescribeScalingActivities API.
.- describeTags(params = {}, callback) ⇒ AWS.Request
Describes the specified tags.
You can use filters to limit the results.
- describeTerminationPolicyTypes(params = {}, callback) ⇒ AWS.Request
Describes the termination policies supported by Amazon EC2 Auto Scaling.
For more information, see Configure termination policies for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
.- describeTrafficSources(params = {}, callback) ⇒ AWS.Request
Gets information about the traffic sources for the specified Auto Scaling group.
You can optionally provide a traffic source type.
- describeWarmPool(params = {}, callback) ⇒ AWS.Request
Gets information about a warm pool and its instances.
For more information, see Warm pools for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
.- detachInstances(params = {}, callback) ⇒ AWS.Request
Removes one or more instances from the specified Auto Scaling group.
After the instances are detached, you can manage them independent of the Auto Scaling group.
If you do not specify the option to decrement the desired capacity, Amazon EC2 Auto Scaling launches instances to replace the ones that are detached.
If there is a Classic Load Balancer attached to the Auto Scaling group, the instances are deregistered from the load balancer.
- detachLoadBalancers(params = {}, callback) ⇒ AWS.Request
Note: This API operation is superseded by DetachTrafficSources, which can detach multiple traffic sources types.- detachLoadBalancerTargetGroups(params = {}, callback) ⇒ AWS.Request
Note: This API operation is superseded by DetachTrafficSources, which can detach multiple traffic sources types.- detachTrafficSources(params = {}, callback) ⇒ AWS.Request
Detaches one or more traffic sources from the specified Auto Scaling group.
When you detach a traffic source, it enters the
Removing
state while deregistering the instances in the group.- disableMetricsCollection(params = {}, callback) ⇒ AWS.Request
Disables group metrics collection for the specified Auto Scaling group.
.
- enableMetricsCollection(params = {}, callback) ⇒ AWS.Request
Enables group metrics collection for the specified Auto Scaling group.
You can use these metrics to track changes in an Auto Scaling group and to set alarms on threshold values.
- enterStandby(params = {}, callback) ⇒ AWS.Request
Moves the specified instances into the standby state.
If you choose to decrement the desired capacity of the Auto Scaling group, the instances can enter standby as long as the desired capacity of the Auto Scaling group after the instances are placed into standby is equal to or greater than the minimum capacity of the group.
If you choose not to decrement the desired capacity of the Auto Scaling group, the Auto Scaling group launches new instances to replace the instances on standby.
For more information, see Temporarily removing instances from your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.
.- executePolicy(params = {}, callback) ⇒ AWS.Request
Executes the specified policy.
- exitStandby(params = {}, callback) ⇒ AWS.Request
Moves the specified instances out of the standby state.
After you put the instances back in service, the desired capacity is incremented.
For more information, see Temporarily removing instances from your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.
.- getPredictiveScalingForecast(params = {}, callback) ⇒ AWS.Request
Retrieves the forecast data for a predictive scaling policy.
Load forecasts are predictions of the hourly load values using historical load data from CloudWatch and an analysis of historical trends.
- putLifecycleHook(params = {}, callback) ⇒ AWS.Request
Creates or updates a lifecycle hook for the specified Auto Scaling group.
Lifecycle hooks let you create solutions that are aware of events in the Auto Scaling instance lifecycle, and then perform a custom action on instances when the corresponding lifecycle event occurs.
This step is a part of the procedure for adding a lifecycle hook to an Auto Scaling group:
-
(Optional) Create a launch template or launch configuration with a user data script that runs while an instance is in a wait state due to a lifecycle hook.
-
(Optional) Create a Lambda function and a rule that allows Amazon EventBridge to invoke your Lambda function when an instance is put into a wait state due to a lifecycle hook.
-
(Optional) Create a notification target and an IAM role.
- putNotificationConfiguration(params = {}, callback) ⇒ AWS.Request
Configures an Auto Scaling group to send notifications when specified events take place.
- putScalingPolicy(params = {}, callback) ⇒ AWS.Request
Creates or updates a scaling policy for an Auto Scaling group.
- putScheduledUpdateGroupAction(params = {}, callback) ⇒ AWS.Request
Creates or updates a scheduled scaling action for an Auto Scaling group.
For more information, see Scheduled scaling in the Amazon EC2 Auto Scaling User Guide.
You can view the scheduled actions for an Auto Scaling group using the DescribeScheduledActions API call.
- putWarmPool(params = {}, callback) ⇒ AWS.Request
Creates or updates a warm pool for the specified Auto Scaling group.
- recordLifecycleActionHeartbeat(params = {}, callback) ⇒ AWS.Request
Records a heartbeat for the lifecycle action associated with the specified token or instance.
- resumeProcesses(params = {}, callback) ⇒ AWS.Request
Resumes the specified suspended auto scaling processes, or all suspended process, for the specified Auto Scaling group.
For more information, see Suspend and resume Amazon EC2 Auto Scaling processes in the Amazon EC2 Auto Scaling User Guide.
.- rollbackInstanceRefresh(params = {}, callback) ⇒ AWS.Request
Cancels an instance refresh that is in progress and rolls back any changes that it made.
- setDesiredCapacity(params = {}, callback) ⇒ AWS.Request
Sets the size of the specified Auto Scaling group.
If a scale-in activity occurs as a result of a new
DesiredCapacity
value that is lower than the current size of the group, the Auto Scaling group uses its termination policy to determine which instances to terminate.- setInstanceHealth(params = {}, callback) ⇒ AWS.Request
Sets the health status of the specified instance.
For more information, see Set up a custom health check for your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.
.- setInstanceProtection(params = {}, callback) ⇒ AWS.Request
Updates the instance protection settings of the specified instances.
- startInstanceRefresh(params = {}, callback) ⇒ AWS.Request
Starts an instance refresh.
This operation is part of the instance refresh feature in Amazon EC2 Auto Scaling, which helps you update instances in your Auto Scaling group.
- suspendProcesses(params = {}, callback) ⇒ AWS.Request
Suspends the specified auto scaling processes, or all processes, for the specified Auto Scaling group.
If you suspend either the
Launch
orTerminate
process types, it can prevent other process types from functioning properly.- terminateInstanceInAutoScalingGroup(params = {}, callback) ⇒ AWS.Request
Terminates the specified instance and optionally adjusts the desired group size.
- updateAutoScalingGroup(params = {}, callback) ⇒ AWS.Request
We strongly recommend that all Auto Scaling groups use launch templates to ensure full functionality for Amazon EC2 Auto Scaling and Amazon EC2.
Updates the configuration for the specified Auto Scaling group.
To update an Auto Scaling group, specify the name of the group and the property that you want to change.
Methods inherited from AWS.Service
makeRequest, makeUnauthenticatedRequest, waitFor, setupRequestListeners, defineService
Constructor Details
new AWS.AutoScaling(options = {}) ⇒ Object
Constructs a service object. This object has one method for each API operation.
Examples:
Constructing a AutoScaling object
var autoscaling = new AWS.AutoScaling({apiVersion: '2011-01-01'});
Options Hash (options):
-
params
(map)
—
An optional map of parameters to bind to every request sent by this service object. For more information on bound parameters, see "Working with Services" in the Getting Started Guide.
-
endpoint
(String|AWS.Endpoint)
—
The endpoint URI to send requests to. The default endpoint is built from the configured
region
. The endpoint should be a string like'https://{service}.{region}.amazonaws.com'
or an Endpoint object. -
accessKeyId
(String)
—
your AWS access key ID.
-
secretAccessKey
(String)
—
your AWS secret access key.
-
sessionToken
(AWS.Credentials)
—
the optional AWS session token to sign requests with.
-
credentials
(AWS.Credentials)
—
the AWS credentials to sign requests with. You can either specify this object, or specify the accessKeyId and secretAccessKey options directly.
-
credentialProvider
(AWS.CredentialProviderChain)
—
the provider chain used to resolve credentials if no static
credentials
property is set. -
region
(String)
—
the region to send service requests to. See AWS.AutoScaling.region for more information.
-
maxRetries
(Integer)
—
the maximum amount of retries to attempt with a request. See AWS.AutoScaling.maxRetries for more information.
-
maxRedirects
(Integer)
—
the maximum amount of redirects to follow with a request. See AWS.AutoScaling.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
. -
s3UsEast1RegionalEndpoint
('legacy'|'regional')
—
when region is set to 'us-east-1', whether to send s3 request to global endpoints or 'us-east-1' regional endpoints. This config is only applicable to S3 client. Defaults to
legacy
-
s3UseArnRegion
(Boolean)
—
whether to override the request region with the region inferred from requested resource's ARN. Only available for S3 buckets Defaults to
true
-
retryDelayOptions
(map)
—
A set of options to configure the retry delay on retryable errors. Currently supported options are:
- base [Integer] — The base number of milliseconds to use in the exponential backoff for operation retries. Defaults to 100 ms for all services except DynamoDB, where it defaults to 50ms.
- customBackoff [function] — A custom function that accepts a
retry count and error and returns the amount of time to delay in
milliseconds. If the result is a non-zero negative value, no further
retry attempts will be made. The
base
option will be ignored if this option is supplied. The function is only called for retryable errors.
-
httpOptions
(map)
—
A set of options to pass to the low-level HTTP request. Currently supported options are:
- proxy [String] — the URL to proxy requests through
- agent [http.Agent, https.Agent] — the Agent object to perform
HTTP requests with. Used for connection pooling. Defaults to the global
agent (
http.globalAgent
) for non-SSL connections. Note that for SSL connections, a special Agent object is used in order to enable peer certificate verification. This feature is only available in the Node.js environment. - connectTimeout [Integer] — Sets the socket to timeout after
failing to establish a connection with the server after
connectTimeout
milliseconds. This timeout has no effect once a socket connection has been established. - timeout [Integer] — Sets the socket to timeout after timeout milliseconds of inactivity on the socket. Defaults to two minutes (120000).
- xhrAsync [Boolean] — Whether the SDK will send asynchronous HTTP requests. Used in the browser environment only. Set to false to send requests synchronously. Defaults to true (async on).
- xhrWithCredentials [Boolean] — Sets the "withCredentials" property of an XMLHttpRequest object. Used in the browser environment only. Defaults to false.
-
apiVersion
(String, Date)
—
a String in YYYY-MM-DD format (or a date) that represents the latest possible API version that can be used in all services (unless overridden by
apiVersions
). Specify 'latest' to use the latest possible version. -
apiVersions
(map<String, String|Date>)
—
a map of service identifiers (the lowercase service class name) with the API version to use when instantiating a service. Specify 'latest' for each individual that can use the latest available version.
-
logger
(#write, #log)
—
an object that responds to .write() (like a stream) or .log() (like the console object) in order to log information about requests
-
systemClockOffset
(Number)
—
an offset value in milliseconds to apply to all signing times. Use this to compensate for clock skew when your system may be out of sync with the service time. Note that this configuration option can only be applied to the global
AWS.config
object and cannot be overridden in service-specific configuration. Defaults to 0 milliseconds. -
signatureVersion
(String)
—
the signature version to sign requests with (overriding the API configuration). Possible values are: 'v2', 'v3', 'v4'.
-
signatureCache
(Boolean)
—
whether the signature to sign requests with (overriding the API configuration) is cached. Only applies to the signature version 'v4'. Defaults to
true
. -
dynamoDbCrc32
(Boolean)
—
whether to validate the CRC32 checksum of HTTP response bodies returned by DynamoDB. Default:
true
. -
useAccelerateEndpoint
(Boolean)
—
Whether to use the S3 Transfer Acceleration endpoint with the S3 service. Default:
false
. -
clientSideMonitoring
(Boolean)
—
whether to collect and publish this client's performance metrics of all its API requests.
-
endpointDiscoveryEnabled
(Boolean|undefined)
—
whether to call operations with endpoints given by service dynamically. Setting this
-
endpointCacheSize
(Number)
—
the size of the global cache storing endpoints from endpoint discovery operations. Once endpoint cache is created, updating this setting cannot change existing cache size. Defaults to 1000
-
hostPrefixEnabled
(Boolean)
—
whether to marshal request parameters to the prefix of hostname. Defaults to
true
. -
stsRegionalEndpoints
('legacy'|'regional')
—
whether to send sts request to global endpoints or regional endpoints. Defaults to 'legacy'.
-
useFipsEndpoint
(Boolean)
—
Enables FIPS compatible endpoints. Defaults to
false
. -
useDualstackEndpoint
(Boolean)
—
Enables IPv6 dualstack endpoint. Defaults to
false
.
Property Details
Method Details
attachInstances(params = {}, callback) ⇒ AWS.Request
Attaches one or more EC2 instances to the specified Auto Scaling group.
When you attach instances, Amazon EC2 Auto Scaling increases the desired capacity of the group by the number of instances being attached. If the number of instances being attached plus the desired capacity of the group exceeds the maximum size of the group, the operation fails.
If there is a Classic Load Balancer attached to your Auto Scaling group, the instances are also registered with the load balancer. If there are target groups attached to your Auto Scaling group, the instances are also registered with the target groups.
For more information, see Detach or attach instances in the Amazon EC2 Auto Scaling User Guide.
Service Reference:
Examples:
To attach an instance to an Auto Scaling group
/* This example attaches the specified instance to the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", InstanceIds: [ "i-93633f9b" ] }; autoscaling.attachInstances(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Calling the attachInstances operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ InstanceIds: [ 'STRING_VALUE', /* more items */ ] }; autoscaling.attachInstances(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: {})
—
InstanceIds
— (Array<String>
)The IDs of the instances. You can specify up to 20 instances.
AutoScalingGroupName
— (String
)The name of the Auto Scaling 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.
-
(AWS.Response)
—
Returns:
attachLoadBalancers(params = {}, callback) ⇒ AWS.Request
Note: This API operation is superseded by AttachTrafficSources, which can attach multiple traffic sources types. We recommend usingAttachTrafficSources
to simplify how you manage traffic sources. However, we continue to supportAttachLoadBalancers
. You can use both the originalAttachLoadBalancers
API operation andAttachTrafficSources
on the same Auto Scaling group.Attaches one or more Classic Load Balancers to the specified Auto Scaling group. Amazon EC2 Auto Scaling registers the running instances with these Classic Load Balancers.
To describe the load balancers for an Auto Scaling group, call the DescribeLoadBalancers API. To detach a load balancer from the Auto Scaling group, call the DetachLoadBalancers API.
This operation is additive and does not detach existing Classic Load Balancers or target groups from the Auto Scaling group.
For more information, see Use Elastic Load Balancing to distribute traffic across the instances in your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.
Service Reference:
Examples:
To attach a load balancer to an Auto Scaling group
/* This example attaches the specified load balancer to the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", LoadBalancerNames: [ "my-load-balancer" ] }; autoscaling.attachLoadBalancers(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { } */ });
Calling the attachLoadBalancers operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ LoadBalancerNames: [ /* required */ 'STRING_VALUE', /* more items */ ] }; autoscaling.attachLoadBalancers(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
LoadBalancerNames
— (Array<String>
)The names of the load balancers. You can specify up to 10 load balancers.
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:
attachLoadBalancerTargetGroups(params = {}, callback) ⇒ AWS.Request
Note: This API operation is superseded by AttachTrafficSources, which can attach multiple traffic sources types. We recommend usingAttachTrafficSources
to simplify how you manage traffic sources. However, we continue to supportAttachLoadBalancerTargetGroups
. You can use both the originalAttachLoadBalancerTargetGroups
API operation andAttachTrafficSources
on the same Auto Scaling group.Attaches one or more target groups to the specified Auto Scaling group.
This operation is used with the following load balancer types:
-
Application Load Balancer - Operates at the application layer (layer 7) and supports HTTP and HTTPS.
-
Network Load Balancer - Operates at the transport layer (layer 4) and supports TCP, TLS, and UDP.
-
Gateway Load Balancer - Operates at the network layer (layer 3).
To describe the target groups for an Auto Scaling group, call the DescribeLoadBalancerTargetGroups API. To detach the target group from the Auto Scaling group, call the DetachLoadBalancerTargetGroups API.
This operation is additive and does not detach existing target groups or Classic Load Balancers from the Auto Scaling group.
For more information, see Use Elastic Load Balancing to distribute traffic across the instances in your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.
Service Reference:
Examples:
To attach a target group to an Auto Scaling group
/* This example attaches the specified target group to the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", TargetGroupARNs: [ "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067" ] }; autoscaling.attachLoadBalancerTargetGroups(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { } */ });
Calling the attachLoadBalancerTargetGroups operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ TargetGroupARNs: [ /* required */ 'STRING_VALUE', /* more items */ ] }; autoscaling.attachLoadBalancerTargetGroups(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
TargetGroupARNs
— (Array<String>
)The Amazon Resource Names (ARNs) of the target groups. You can specify up to 10 target groups. To get the ARN of a target group, use the Elastic Load Balancing DescribeTargetGroups API operation.
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:
attachTrafficSources(params = {}, callback) ⇒ AWS.Request
Attaches one or more traffic sources to the specified Auto Scaling group.
You can use any of the following as traffic sources for an Auto Scaling group:
-
Application Load Balancer
-
Classic Load Balancer
-
Gateway Load Balancer
-
Network Load Balancer
-
VPC Lattice
This operation is additive and does not detach existing traffic sources from the Auto Scaling group.
After the operation completes, use the DescribeTrafficSources API to return details about the state of the attachments between traffic sources and your Auto Scaling group. To detach a traffic source from the Auto Scaling group, call the DetachTrafficSources API.
Service Reference:
Examples:
To attach a target group to an Auto Scaling group
/* This example attaches the specified target group to the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", TrafficSources: [ { Identifier: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067" } ] }; autoscaling.attachTrafficSources(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { } */ });
Calling the attachTrafficSources operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ TrafficSources: [ /* required */ { Identifier: 'STRING_VALUE', /* required */ Type: 'STRING_VALUE' }, /* more items */ ] }; autoscaling.attachTrafficSources(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
TrafficSources
— (Array<map>
)The unique identifiers of one or more traffic sources. You can specify up to 10 traffic sources.
Identifier
— required — (String
)Identifies the traffic source.
For Application Load Balancers, Gateway Load Balancers, Network Load Balancers, and VPC Lattice, this will be the Amazon Resource Name (ARN) for a target group in this account and Region. For Classic Load Balancers, this will be the name of the Classic Load Balancer in this account and Region.
For example:
-
Application Load Balancer ARN:
arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/1234567890123456
-
Classic Load Balancer name:
my-classic-load-balancer
-
VPC Lattice ARN:
arn:aws:vpc-lattice:us-west-2:123456789012:targetgroup/tg-1234567890123456
To get the ARN of a target group for a Application Load Balancer, Gateway Load Balancer, or Network Load Balancer, or the name of a Classic Load Balancer, use the Elastic Load Balancing DescribeTargetGroups and DescribeLoadBalancers API operations.
To get the ARN of a target group for VPC Lattice, use the VPC Lattice GetTargetGroup API operation.
-
Type
— (String
)Provides additional context for the value of
Identifier
.The following lists the valid values:
-
elb
ifIdentifier
is the name of a Classic Load Balancer. -
elbv2
ifIdentifier
is the ARN of an Application Load Balancer, Gateway Load Balancer, or Network Load Balancer target group. -
vpc-lattice
ifIdentifier
is the ARN of a VPC Lattice target group.
Required if the identifier is the name of a Classic 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.
-
(AWS.Response)
—
Returns:
batchDeleteScheduledAction(params = {}, callback) ⇒ AWS.Request
Deletes one or more scheduled actions for the specified Auto Scaling group.
Service Reference:
Examples:
Calling the batchDeleteScheduledAction operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ ScheduledActionNames: [ /* required */ 'STRING_VALUE', /* more items */ ] }; autoscaling.batchDeleteScheduledAction(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
ScheduledActionNames
— (Array<String>
)The names of the scheduled actions to delete. The maximum number allowed is 50.
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:FailedScheduledActions
— (Array<map>
)The names of the scheduled actions that could not be deleted, including an error message.
ScheduledActionName
— required — (String
)The name of the scheduled action.
ErrorCode
— (String
)The error code.
ErrorMessage
— (String
)The error message accompanying the error code.
-
(AWS.Response)
—
Returns:
batchPutScheduledUpdateGroupAction(params = {}, callback) ⇒ AWS.Request
Creates or updates one or more scheduled scaling actions for an Auto Scaling group.
Service Reference:
Examples:
Calling the batchPutScheduledUpdateGroupAction operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ ScheduledUpdateGroupActions: [ /* required */ { ScheduledActionName: 'STRING_VALUE', /* required */ DesiredCapacity: 'NUMBER_VALUE', EndTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789, MaxSize: 'NUMBER_VALUE', MinSize: 'NUMBER_VALUE', Recurrence: 'STRING_VALUE', StartTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789, TimeZone: 'STRING_VALUE' }, /* more items */ ] }; autoscaling.batchPutScheduledUpdateGroupAction(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
ScheduledUpdateGroupActions
— (Array<map>
)One or more scheduled actions. The maximum number allowed is 50.
ScheduledActionName
— required — (String
)The name of the scaling action.
StartTime
— (Date
)The date and time for the action to start, in YYYY-MM-DDThh:mm:ssZ format in UTC/GMT only and in quotes (for example,
"2019-06-01T00:00:00Z"
).If you specify
Recurrence
andStartTime
, Amazon EC2 Auto Scaling performs the action at this time, and then performs the action based on the specified recurrence.If you try to schedule the action in the past, Amazon EC2 Auto Scaling returns an error message.
EndTime
— (Date
)The date and time for the recurring schedule to end, in UTC.
Recurrence
— (String
)The recurring schedule for the action, in Unix cron syntax format. This format consists of five fields separated by white spaces: [Minute] [Hour] [Day_of_Month] [Month_of_Year] [Day_of_Week]. The value must be in quotes (for example,
"30 0 1 1,6,12 *"
). For more information about this format, see Crontab.When
StartTime
andEndTime
are specified withRecurrence
, they form the boundaries of when the recurring action starts and stops.Cron expressions use Universal Coordinated Time (UTC) by default.
MinSize
— (Integer
)The minimum size of the Auto Scaling group.
MaxSize
— (Integer
)The maximum size of the Auto Scaling group.
DesiredCapacity
— (Integer
)The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain.
TimeZone
— (String
)Specifies the time zone for a cron expression. If a time zone is not provided, UTC is used by default.
Valid values are the canonical names of the IANA time zones, derived from the IANA Time Zone Database (such as
Etc/GMT+9
orPacific/Tahiti
). For more information, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.
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:FailedScheduledUpdateGroupActions
— (Array<map>
)The names of the scheduled actions that could not be created or updated, including an error message.
ScheduledActionName
— required — (String
)The name of the scheduled action.
ErrorCode
— (String
)The error code.
ErrorMessage
— (String
)The error message accompanying the error code.
-
(AWS.Response)
—
Returns:
cancelInstanceRefresh(params = {}, callback) ⇒ AWS.Request
Cancels an instance refresh or rollback that is in progress. If an instance refresh or rollback is not in progress, an
ActiveInstanceRefreshNotFound
error occurs.This operation is part of the instance refresh feature in Amazon EC2 Auto Scaling, which helps you update instances in your Auto Scaling group after you make configuration changes.
When you cancel an instance refresh, this does not roll back any changes that it made. Use the RollbackInstanceRefresh API to roll back instead.
Service Reference:
Examples:
To cancel an instance refresh
/* This example cancels an instance refresh operation in progress. */ var params = { AutoScalingGroupName: "my-auto-scaling-group" }; autoscaling.cancelInstanceRefresh(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { InstanceRefreshId: "08b91cf7-8fa6-48af-b6a6-d227f40f1b9b" } */ });
Calling the cancelInstanceRefresh operation
var params = { AutoScalingGroupName: 'STRING_VALUE' /* required */ }; autoscaling.cancelInstanceRefresh(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling 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. Thedata
object has the following properties:InstanceRefreshId
— (String
)The instance refresh ID associated with the request. This is the unique ID assigned to the instance refresh when it was started.
-
(AWS.Response)
—
Returns:
completeLifecycleAction(params = {}, callback) ⇒ AWS.Request
Completes the lifecycle action for the specified token or instance with the specified result.
This step is a part of the procedure for adding a lifecycle hook to an Auto Scaling group:
-
(Optional) Create a launch template or launch configuration with a user data script that runs while an instance is in a wait state due to a lifecycle hook.
-
(Optional) Create a Lambda function and a rule that allows Amazon EventBridge to invoke your Lambda function when an instance is put into a wait state due to a lifecycle hook.
-
(Optional) Create a notification target and an IAM role. The target can be either an Amazon SQS queue or an Amazon SNS topic. The role allows Amazon EC2 Auto Scaling to publish lifecycle notifications to the target.
-
Create the lifecycle hook. Specify whether the hook is used when the instances launch or terminate.
-
If you need more time, record the lifecycle action heartbeat to keep the instance in a wait state.
-
If you finish before the timeout period ends, send a callback by using the CompleteLifecycleAction API call.
For more information, see Complete a lifecycle action in the Amazon EC2 Auto Scaling User Guide.
Service Reference:
Examples:
To complete the lifecycle action
/* This example notifies Auto Scaling that the specified lifecycle action is complete so that it can finish launching or terminating the instance. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", LifecycleActionResult: "CONTINUE", LifecycleActionToken: "bcd2f1b8-9a78-44d3-8a7a-4dd07d7cf635", LifecycleHookName: "my-lifecycle-hook" }; autoscaling.completeLifecycleAction(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { } */ });
Calling the completeLifecycleAction operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ LifecycleActionResult: 'STRING_VALUE', /* required */ LifecycleHookName: 'STRING_VALUE', /* required */ InstanceId: 'STRING_VALUE', LifecycleActionToken: 'STRING_VALUE' }; autoscaling.completeLifecycleAction(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: {})
—
LifecycleHookName
— (String
)The name of the lifecycle hook.
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
LifecycleActionToken
— (String
)A universally unique identifier (UUID) that identifies a specific lifecycle action associated with an instance. Amazon EC2 Auto Scaling sends this token to the notification target you specified when you created the lifecycle hook.
LifecycleActionResult
— (String
)The action for the group to take. You can specify either
CONTINUE
orABANDON
.InstanceId
— (String
)The ID of the instance.
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:
createAutoScalingGroup(params = {}, callback) ⇒ AWS.Request
We strongly recommend using a launch template when calling this operation to ensure full functionality for Amazon EC2 Auto Scaling and Amazon EC2.
Creates an Auto Scaling group with the specified name and attributes.
If you exceed your maximum limit of Auto Scaling groups, the call fails. To query this limit, call the DescribeAccountLimits API. For information about updating this limit, see Quotas for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
If you're new to Amazon EC2 Auto Scaling, see the introductory tutorials in Get started with Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
Every Auto Scaling group has three size properties (
DesiredCapacity
,MaxSize
, andMinSize
). Usually, you set these sizes based on a specific number of instances. However, if you configure a mixed instances policy that defines weights for the instance types, you must specify these sizes with the same units that you use for weighting instances.Service Reference:
Examples:
To create an Auto Scaling group
/* This example creates an Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", DefaultInstanceWarmup: 120, LaunchTemplate: { LaunchTemplateName: "my-template-for-auto-scaling", Version: "$Default" }, MaxInstanceLifetime: 2592000, MaxSize: 3, MinSize: 1, VPCZoneIdentifier: "subnet-057fa0918fEXAMPLE" }; autoscaling.createAutoScalingGroup(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
To create an Auto Scaling group with an attached target group
/* This example creates an Auto Scaling group and attaches the specified target group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", HealthCheckGracePeriod: 300, HealthCheckType: "ELB", LaunchTemplate: { LaunchTemplateName: "my-template-for-auto-scaling", Version: "$Default" }, MaxSize: 3, MinSize: 1, TargetGroupARNs: [ "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067" ], VPCZoneIdentifier: "subnet-057fa0918fEXAMPLE, subnet-610acd08EXAMPLE" }; autoscaling.createAutoScalingGroup(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
To create an Auto Scaling group with a mixed instances policy
/* This example creates an Auto Scaling group with a mixed instances policy. It specifies the c5.large, c5a.large, and c6g.large instance types and defines a different launch template for the c6g.large instance type. */ var params = { AutoScalingGroupName: "my-asg", DesiredCapacity: 3, MaxSize: 5, MinSize: 1, MixedInstancesPolicy: { InstancesDistribution: { OnDemandBaseCapacity: 1, OnDemandPercentageAboveBaseCapacity: 50, SpotAllocationStrategy: "price-capacity-optimized" }, LaunchTemplate: { LaunchTemplateSpecification: { LaunchTemplateName: "my-launch-template-for-x86", Version: "$Default" }, Overrides: [ { InstanceType: "c6g.large", LaunchTemplateSpecification: { LaunchTemplateName: "my-launch-template-for-arm", Version: "$Default" } }, { InstanceType: "c5.large" }, { InstanceType: "c5a.large" } ] } }, VPCZoneIdentifier: "subnet-057fa0918fEXAMPLE, subnet-610acd08EXAMPLE" }; autoscaling.createAutoScalingGroup(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
To create an Auto Scaling group using attribute-based instance type selection
/* This example creates an Auto Scaling group using attribute-based instance type selection. It requires the instance types to have a minimum of four vCPUs and a maximum of eight vCPUs, a minimum of 16,384 MiB of memory, and an Intel manufactured CPU. */ var params = { AutoScalingGroupName: "my-asg", DesiredCapacity: 4, DesiredCapacityType: "units", MaxSize: 100, MinSize: 0, MixedInstancesPolicy: { InstancesDistribution: { OnDemandPercentageAboveBaseCapacity: 50, SpotAllocationStrategy: "price-capacity-optimized" }, LaunchTemplate: { LaunchTemplateSpecification: { LaunchTemplateName: "my-template-for-auto-scaling", Version: "$Default" }, Overrides: [ { InstanceRequirements: { CpuManufacturers: [ "intel" ], MemoryMiB: { Min: 16384 }, VCpuCount: { Max: 8, Min: 4 } } } ] } }, VPCZoneIdentifier: "subnet-057fa0918fEXAMPLE, subnet-610acd08EXAMPLE" }; autoscaling.createAutoScalingGroup(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Calling the createAutoScalingGroup operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ MaxSize: 'NUMBER_VALUE', /* required */ MinSize: 'NUMBER_VALUE', /* required */ AvailabilityZones: [ 'STRING_VALUE', /* more items */ ], CapacityRebalance: true || false, Context: 'STRING_VALUE', DefaultCooldown: 'NUMBER_VALUE', DefaultInstanceWarmup: 'NUMBER_VALUE', DesiredCapacity: 'NUMBER_VALUE', DesiredCapacityType: 'STRING_VALUE', HealthCheckGracePeriod: 'NUMBER_VALUE', HealthCheckType: 'STRING_VALUE', InstanceId: 'STRING_VALUE', InstanceMaintenancePolicy: { MaxHealthyPercentage: 'NUMBER_VALUE', MinHealthyPercentage: 'NUMBER_VALUE' }, LaunchConfigurationName: 'STRING_VALUE', LaunchTemplate: { LaunchTemplateId: 'STRING_VALUE', LaunchTemplateName: 'STRING_VALUE', Version: 'STRING_VALUE' }, LifecycleHookSpecificationList: [ { LifecycleHookName: 'STRING_VALUE', /* required */ LifecycleTransition: 'STRING_VALUE', /* required */ DefaultResult: 'STRING_VALUE', HeartbeatTimeout: 'NUMBER_VALUE', NotificationMetadata: 'STRING_VALUE', NotificationTargetARN: 'STRING_VALUE', RoleARN: 'STRING_VALUE' }, /* more items */ ], LoadBalancerNames: [ 'STRING_VALUE', /* more items */ ], MaxInstanceLifetime: 'NUMBER_VALUE', MixedInstancesPolicy: { InstancesDistribution: { OnDemandAllocationStrategy: 'STRING_VALUE', OnDemandBaseCapacity: 'NUMBER_VALUE', OnDemandPercentageAboveBaseCapacity: 'NUMBER_VALUE', SpotAllocationStrategy: 'STRING_VALUE', SpotInstancePools: 'NUMBER_VALUE', SpotMaxPrice: 'STRING_VALUE' }, LaunchTemplate: { LaunchTemplateSpecification: { LaunchTemplateId: 'STRING_VALUE', LaunchTemplateName: 'STRING_VALUE', Version: 'STRING_VALUE' }, Overrides: [ { InstanceRequirements: { MemoryMiB: { /* required */ Min: 'NUMBER_VALUE', /* required */ Max: 'NUMBER_VALUE' }, VCpuCount: { /* required */ Min: 'NUMBER_VALUE', /* required */ Max: 'NUMBER_VALUE' }, AcceleratorCount: { Max: 'NUMBER_VALUE', Min: 'NUMBER_VALUE' }, AcceleratorManufacturers: [ nvidia | amd | amazon-web-services | xilinx, /* more items */ ], AcceleratorNames: [ a100 | v100 | k80 | t4 | m60 | radeon-pro-v520 | vu9p, /* more items */ ], AcceleratorTotalMemoryMiB: { Max: 'NUMBER_VALUE', Min: 'NUMBER_VALUE' }, AcceleratorTypes: [ gpu | fpga | inference, /* more items */ ], AllowedInstanceTypes: [ 'STRING_VALUE', /* more items */ ], BareMetal: included | excluded | required, BaselineEbsBandwidthMbps: { Max: 'NUMBER_VALUE', Min: 'NUMBER_VALUE' }, BurstablePerformance: included | excluded | required, CpuManufacturers: [ intel | amd | amazon-web-services, /* more items */ ], ExcludedInstanceTypes: [ 'STRING_VALUE', /* more items */ ], InstanceGenerations: [ current | previous, /* more items */ ], LocalStorage: included | excluded | required, LocalStorageTypes: [ hdd | ssd, /* more items */ ], MaxSpotPriceAsPercentageOfOptimalOnDemandPrice: 'NUMBER_VALUE', MemoryGiBPerVCpu: { Max: 'NUMBER_VALUE', Min: 'NUMBER_VALUE' }, NetworkBandwidthGbps: { Max: 'NUMBER_VALUE', Min: 'NUMBER_VALUE' }, NetworkInterfaceCount: { Max: 'NUMBER_VALUE', Min: 'NUMBER_VALUE' }, OnDemandMaxPricePercentageOverLowestPrice: 'NUMBER_VALUE', RequireHibernateSupport: true || false, SpotMaxPricePercentageOverLowestPrice: 'NUMBER_VALUE', TotalLocalStorageGB: { Max: 'NUMBER_VALUE', Min: 'NUMBER_VALUE' } }, InstanceType: 'STRING_VALUE', LaunchTemplateSpecification: { LaunchTemplateId: 'STRING_VALUE', LaunchTemplateName: 'STRING_VALUE', Version: 'STRING_VALUE' }, WeightedCapacity: 'STRING_VALUE' }, /* more items */ ] } }, NewInstancesProtectedFromScaleIn: true || false, PlacementGroup: 'STRING_VALUE', ServiceLinkedRoleARN: 'STRING_VALUE', Tags: [ { Key: 'STRING_VALUE', /* required */ PropagateAtLaunch: true || false, ResourceId: 'STRING_VALUE', ResourceType: 'STRING_VALUE', Value: 'STRING_VALUE' }, /* more items */ ], TargetGroupARNs: [ 'STRING_VALUE', /* more items */ ], TerminationPolicies: [ 'STRING_VALUE', /* more items */ ], TrafficSources: [ { Identifier: 'STRING_VALUE', /* required */ Type: 'STRING_VALUE' }, /* more items */ ], VPCZoneIdentifier: 'STRING_VALUE' }; autoscaling.createAutoScalingGroup(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group. This name must be unique per Region per account.
The name can contain any ASCII character 33 to 126 including most punctuation characters, digits, and upper and lowercased letters.
Note: You cannot use a colon (:) in the name.LaunchConfigurationName
— (String
)The name of the launch configuration to use to launch instances.
Conditional: You must specify either a launch template (
LaunchTemplate
orMixedInstancesPolicy
) or a launch configuration (LaunchConfigurationName
orInstanceId
).LaunchTemplate
— (map
)Information used to specify the launch template and version to use to launch instances.
Conditional: You must specify either a launch template (
LaunchTemplate
orMixedInstancesPolicy
) or a launch configuration (LaunchConfigurationName
orInstanceId
).Note: The launch template that is specified must be configured for use with an Auto Scaling group. For more information, see Create a launch template for an Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.LaunchTemplateId
— (String
)The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.LaunchTemplateName
— (String
)The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.Version
— (String
)The version number,
$Latest
, or$Default
. To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API. If the value is$Latest
, Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is$Default
, Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is$Default
.
MixedInstancesPolicy
— (map
)The mixed instances policy. For more information, see Auto Scaling groups with multiple instance types and purchase options in the Amazon EC2 Auto Scaling User Guide.
LaunchTemplate
— (map
)One or more launch templates and the instance types (overrides) that are used to launch EC2 instances to fulfill On-Demand and Spot capacities.
LaunchTemplateSpecification
— (map
)The launch template.
LaunchTemplateId
— (String
)The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.LaunchTemplateName
— (String
)The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.Version
— (String
)The version number,
$Latest
, or$Default
. To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API. If the value is$Latest
, Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is$Default
, Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is$Default
.
Overrides
— (Array<map>
)Any properties that you specify override the same properties in the launch template.
InstanceType
— (String
)The instance type, such as
m3.xlarge
. You must specify an instance type that is supported in your requested Region and Availability Zones. For more information, see Instance types in the Amazon EC2 User Guide for Linux Instances.You can specify up to 40 instance types per Auto Scaling group.
WeightedCapacity
— (String
)If you provide a list of instance types to use, you can specify the number of capacity units provided by each instance type in terms of virtual CPUs, memory, storage, throughput, or other relative performance characteristic. When a Spot or On-Demand Instance is launched, the capacity units count toward the desired capacity. Amazon EC2 Auto Scaling launches instances until the desired capacity is totally fulfilled, even if this results in an overage. For example, if there are two units remaining to fulfill capacity, and Amazon EC2 Auto Scaling can only launch an instance with a
WeightedCapacity
of five units, the instance is launched, and the desired capacity is exceeded by three units. For more information, see Configure an Auto Scaling group to use instance weights in the Amazon EC2 Auto Scaling User Guide. Value must be in the range of 1–999.If you specify a value for
WeightedCapacity
for one instance type, you must specify a value forWeightedCapacity
for all of them.Every Auto Scaling group has three size parameters (
DesiredCapacity
,MaxSize
, andMinSize
). Usually, you set these sizes based on a specific number of instances. However, if you configure a mixed instances policy that defines weights for the instance types, you must specify these sizes with the same units that you use for weighting instances.LaunchTemplateSpecification
— (map
)Provides a launch template for the specified instance type or set of instance requirements. For example, some instance types might require a launch template with a different AMI. If not provided, Amazon EC2 Auto Scaling uses the launch template that's specified in the
LaunchTemplate
definition. For more information, see Specifying a different launch template for an instance type in the Amazon EC2 Auto Scaling User Guide.You can specify up to 20 launch templates per Auto Scaling group. The launch templates specified in the overrides and in the
LaunchTemplate
definition count towards this limit.LaunchTemplateId
— (String
)The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.LaunchTemplateName
— (String
)The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.Version
— (String
)The version number,
$Latest
, or$Default
. To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API. If the value is$Latest
, Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is$Default
, Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is$Default
.
InstanceRequirements
— (map
)The instance requirements. Amazon EC2 Auto Scaling uses your specified requirements to identify instance types. Then, it uses your On-Demand and Spot allocation strategies to launch instances from these instance types.
You can specify up to four separate sets of instance requirements per Auto Scaling group. This is useful for provisioning instances from different Amazon Machine Images (AMIs) in the same Auto Scaling group. To do this, create the AMIs and create a new launch template for each AMI. Then, create a compatible set of instance requirements for each launch template.
Note: If you specifyInstanceRequirements
, you can't specifyInstanceType
.VCpuCount
— required — (map
)The minimum and maximum number of vCPUs for an instance type.
Min
— required — (Integer
)The minimum number of vCPUs.
Max
— (Integer
)The maximum number of vCPUs.
MemoryMiB
— required — (map
)The minimum and maximum instance memory size for an instance type, in MiB.
Min
— required — (Integer
)The memory minimum in MiB.
Max
— (Integer
)The memory maximum in MiB.
CpuManufacturers
— (Array<String>
)Lists which specific CPU manufacturers to include.
-
For instance types with Intel CPUs, specify
intel
. -
For instance types with AMD CPUs, specify
amd
. -
For instance types with Amazon Web Services CPUs, specify
amazon-web-services
.
Note: Don't confuse the CPU hardware manufacturer with the CPU hardware architecture. Instances will be launched with a compatible CPU architecture based on the Amazon Machine Image (AMI) that you specify in your launch template.Default: Any manufacturer
-
MemoryGiBPerVCpu
— (map
)The minimum and maximum amount of memory per vCPU for an instance type, in GiB.
Default: No minimum or maximum limits
Min
— (Float
)The memory minimum in GiB.
Max
— (Float
)The memory maximum in GiB.
ExcludedInstanceTypes
— (Array<String>
)The instance types to exclude. You can use strings with one or more wild cards, represented by an asterisk (
*
), to exclude an instance family, type, size, or generation. The following are examples:m5.8xlarge
,c5*.*
,m5a.*
,r*
,*3*
.For example, if you specify
c5*
, you are excluding the entire C5 instance family, which includes all C5a and C5n instance types. If you specifym5a.*
, Amazon EC2 Auto Scaling will exclude all the M5a instance types, but not the M5n instance types.Note: If you specifyExcludedInstanceTypes
, you can't specifyAllowedInstanceTypes
.Default: No excluded instance types
InstanceGenerations
— (Array<String>
)Indicates whether current or previous generation instance types are included.
-
For current generation instance types, specify
current
. The current generation includes EC2 instance types currently recommended for use. This typically includes the latest two to three generations in each instance family. For more information, see Instance types in the Amazon EC2 User Guide for Linux Instances. -
For previous generation instance types, specify
previous
.
Default: Any current or previous generation
-
SpotMaxPricePercentageOverLowestPrice
— (Integer
)[Price protection] The price protection threshold for Spot Instances, as a percentage higher than an identified Spot price. The identified Spot price is the price of the lowest priced current generation C, M, or R instance type with your specified attributes. If no current generation C, M, or R instance type matches your attributes, then the identified price is from either the lowest priced current generation instance types or, failing that, the lowest priced previous generation instance types that match your attributes. When Amazon EC2 Auto Scaling selects instance types with your attributes, we will exclude instance types whose price exceeds your specified threshold.
The parameter accepts an integer, which Amazon EC2 Auto Scaling interprets as a percentage.
If you set
DesiredCapacityType
tovcpu
ormemory-mib
, the price protection threshold is based on the per-vCPU or per-memory price instead of the per instance price.Note: Only one ofSpotMaxPricePercentageOverLowestPrice
orMaxSpotPriceAsPercentageOfOptimalOnDemandPrice
can be specified. If you don't specify either, Amazon EC2 Auto Scaling will automatically apply optimal price protection to consistently select from a wide range of instance types. To indicate no price protection threshold for Spot Instances, meaning you want to consider all instance types that match your attributes, include one of these parameters and specify a high value, such as999999
.MaxSpotPriceAsPercentageOfOptimalOnDemandPrice
— (Integer
)[Price protection] The price protection threshold for Spot Instances, as a percentage of an identified On-Demand price. The identified On-Demand price is the price of the lowest priced current generation C, M, or R instance type with your specified attributes. If no current generation C, M, or R instance type matches your attributes, then the identified price is from either the lowest priced current generation instance types or, failing that, the lowest priced previous generation instance types that match your attributes. When Amazon EC2 Auto Scaling selects instance types with your attributes, we will exclude instance types whose price exceeds your specified threshold.
The parameter accepts an integer, which Amazon EC2 Auto Scaling interprets as a percentage.
If you set
DesiredCapacityType
tovcpu
ormemory-mib
, the price protection threshold is based on the per-vCPU or per-memory price instead of the per instance price.Note: Only one ofSpotMaxPricePercentageOverLowestPrice
orMaxSpotPriceAsPercentageOfOptimalOnDemandPrice
can be specified. If you don't specify either, Amazon EC2 Auto Scaling will automatically apply optimal price protection to consistently select from a wide range of instance types. To indicate no price protection threshold for Spot Instances, meaning you want to consider all instance types that match your attributes, include one of these parameters and specify a high value, such as999999
.OnDemandMaxPricePercentageOverLowestPrice
— (Integer
)[Price protection] The price protection threshold for On-Demand Instances, as a percentage higher than an identified On-Demand price. The identified On-Demand price is the price of the lowest priced current generation C, M, or R instance type with your specified attributes. If no current generation C, M, or R instance type matches your attributes, then the identified price is from either the lowest priced current generation instance types or, failing that, the lowest priced previous generation instance types that match your attributes. When Amazon EC2 Auto Scaling selects instance types with your attributes, we will exclude instance types whose price exceeds your specified threshold.
The parameter accepts an integer, which Amazon EC2 Auto Scaling interprets as a percentage.
To turn off price protection, specify a high value, such as
999999
.If you set
DesiredCapacityType
tovcpu
ormemory-mib
, the price protection threshold is applied based on the per-vCPU or per-memory price instead of the per instance price.Default:
20
BareMetal
— (String
)Indicates whether bare metal instance types are included, excluded, or required.
Default:
Possible values include:excluded
"included"
"excluded"
"required"
BurstablePerformance
— (String
)Indicates whether burstable performance instance types are included, excluded, or required. For more information, see Burstable performance instances in the Amazon EC2 User Guide for Linux Instances.
Default:
Possible values include:excluded
"included"
"excluded"
"required"
RequireHibernateSupport
— (Boolean
)Indicates whether instance types must provide On-Demand Instance hibernation support.
Default:
false
NetworkInterfaceCount
— (map
)The minimum and maximum number of network interfaces for an instance type.
Default: No minimum or maximum limits
Min
— (Integer
)The minimum number of network interfaces.
Max
— (Integer
)The maximum number of network interfaces.
LocalStorage
— (String
)Indicates whether instance types with instance store volumes are included, excluded, or required. For more information, see Amazon EC2 instance store in the Amazon EC2 User Guide for Linux Instances.
Default:
Possible values include:included
"included"
"excluded"
"required"
LocalStorageTypes
— (Array<String>
)Indicates the type of local storage that is required.
-
For instance types with hard disk drive (HDD) storage, specify
hdd
. -
For instance types with solid state drive (SSD) storage, specify
ssd
.
Default: Any local storage type
-
TotalLocalStorageGB
— (map
)The minimum and maximum total local storage size for an instance type, in GB.
Default: No minimum or maximum limits
Min
— (Float
)The storage minimum in GB.
Max
— (Float
)The storage maximum in GB.
BaselineEbsBandwidthMbps
— (map
)The minimum and maximum baseline bandwidth performance for an instance type, in Mbps. For more information, see Amazon EBS–optimized instances in the Amazon EC2 User Guide for Linux Instances.
Default: No minimum or maximum limits
Min
— (Integer
)The minimum value in Mbps.
Max
— (Integer
)The maximum value in Mbps.
AcceleratorTypes
— (Array<String>
)Lists the accelerator types that must be on an instance type.
-
For instance types with GPU accelerators, specify
gpu
. -
For instance types with FPGA accelerators, specify
fpga
. -
For instance types with inference accelerators, specify
inference
.
Default: Any accelerator type
-
AcceleratorCount
— (map
)The minimum and maximum number of accelerators (GPUs, FPGAs, or Amazon Web Services Inferentia chips) for an instance type.
To exclude accelerator-enabled instance types, set
Max
to0
.Default: No minimum or maximum limits
Min
— (Integer
)The minimum value.
Max
— (Integer
)The maximum value.
AcceleratorManufacturers
— (Array<String>
)Indicates whether instance types must have accelerators by specific manufacturers.
-
For instance types with NVIDIA devices, specify
nvidia
. -
For instance types with AMD devices, specify
amd
. -
For instance types with Amazon Web Services devices, specify
amazon-web-services
. -
For instance types with Xilinx devices, specify
xilinx
.
Default: Any manufacturer
-
AcceleratorNames
— (Array<String>
)Lists the accelerators that must be on an instance type.
-
For instance types with NVIDIA A100 GPUs, specify
a100
. -
For instance types with NVIDIA V100 GPUs, specify
v100
. -
For instance types with NVIDIA K80 GPUs, specify
k80
. -
For instance types with NVIDIA T4 GPUs, specify
t4
. -
For instance types with NVIDIA M60 GPUs, specify
m60
. -
For instance types with AMD Radeon Pro V520 GPUs, specify
radeon-pro-v520
. -
For instance types with Xilinx VU9P FPGAs, specify
vu9p
.
Default: Any accelerator
-
AcceleratorTotalMemoryMiB
— (map
)The minimum and maximum total memory size for the accelerators on an instance type, in MiB.
Default: No minimum or maximum limits
Min
— (Integer
)The memory minimum in MiB.
Max
— (Integer
)The memory maximum in MiB.
NetworkBandwidthGbps
— (map
)The minimum and maximum amount of network bandwidth, in gigabits per second (Gbps).
Default: No minimum or maximum limits
Min
— (Float
)The minimum amount of network bandwidth, in gigabits per second (Gbps).
Max
— (Float
)The maximum amount of network bandwidth, in gigabits per second (Gbps).
AllowedInstanceTypes
— (Array<String>
)The instance types to apply your specified attributes against. All other instance types are ignored, even if they match your specified attributes.
You can use strings with one or more wild cards, represented by an asterisk (
*
), to allow an instance type, size, or generation. The following are examples:m5.8xlarge
,c5*.*
,m5a.*
,r*
,*3*
.For example, if you specify
c5*
, Amazon EC2 Auto Scaling will allow the entire C5 instance family, which includes all C5a and C5n instance types. If you specifym5a.*
, Amazon EC2 Auto Scaling will allow all the M5a instance types, but not the M5n instance types.Note: If you specifyAllowedInstanceTypes
, you can't specifyExcludedInstanceTypes
.Default: All instance types
InstancesDistribution
— (map
)The instances distribution.
OnDemandAllocationStrategy
— (String
)The allocation strategy to apply to your On-Demand Instances when they are launched. Possible instance types are determined by the launch template overrides that you specify.
The following lists the valid values:
- lowest-price
-
Uses price to determine which instance types are the highest priority, launching the lowest priced instance types within an Availability Zone first. This is the default value for Auto Scaling groups that specify InstanceRequirements.
- prioritized
-
You set the order of instance types for the launch template overrides from highest to lowest priority (from first to last in the list). Amazon EC2 Auto Scaling launches your highest priority instance types first. If all your On-Demand capacity cannot be fulfilled using your highest priority instance type, then Amazon EC2 Auto Scaling launches the remaining capacity using the second priority instance type, and so on. This is the default value for Auto Scaling groups that don't specify InstanceRequirements and cannot be used for groups that do.
OnDemandBaseCapacity
— (Integer
)The minimum amount of the Auto Scaling group's capacity that must be fulfilled by On-Demand Instances. This base portion is launched first as your group scales.
This number has the same unit of measurement as the group's desired capacity. If you change the default unit of measurement (number of instances) by specifying weighted capacity values in your launch template overrides list, or by changing the default desired capacity type setting of the group, you must specify this number using the same unit of measurement.
Default: 0
OnDemandPercentageAboveBaseCapacity
— (Integer
)Controls the percentages of On-Demand Instances and Spot Instances for your additional capacity beyond
OnDemandBaseCapacity
. Expressed as a number (for example, 20 specifies 20% On-Demand Instances, 80% Spot Instances). If set to 100, only On-Demand Instances are used.Default: 100
SpotAllocationStrategy
— (String
)The allocation strategy to apply to your Spot Instances when they are launched. Possible instance types are determined by the launch template overrides that you specify.
The following lists the valid values:
- capacity-optimized
-
Requests Spot Instances using pools that are optimally chosen based on the available Spot capacity. This strategy has the lowest risk of interruption. To give certain instance types a higher chance of launching first, use
capacity-optimized-prioritized
. - capacity-optimized-prioritized
-
You set the order of instance types for the launch template overrides from highest to lowest priority (from first to last in the list). Amazon EC2 Auto Scaling honors the instance type priorities on a best effort basis but optimizes for capacity first. Note that if the On-Demand allocation strategy is set to
prioritized
, the same priority is applied when fulfilling On-Demand capacity. This is not a valid value for Auto Scaling groups that specify InstanceRequirements. - lowest-price
-
Requests Spot Instances using the lowest priced pools within an Availability Zone, across the number of Spot pools that you specify for the
SpotInstancePools
property. To ensure that your desired capacity is met, you might receive Spot Instances from several pools. This is the default value, but it might lead to high interruption rates because this strategy only considers instance price and not available capacity. - price-capacity-optimized (recommended)
-
The price and capacity optimized allocation strategy looks at both price and capacity to select the Spot Instance pools that are the least likely to be interrupted and have the lowest possible price.
SpotInstancePools
— (Integer
)The number of Spot Instance pools across which to allocate your Spot Instances. The Spot pools are determined from the different instance types in the overrides. Valid only when the
SpotAllocationStrategy
islowest-price
. Value must be in the range of 1–20.Default: 2
SpotMaxPrice
— (String
)The maximum price per unit hour that you are willing to pay for a Spot Instance. If your maximum price is lower than the Spot price for the instance types that you selected, your Spot Instances are not launched. We do not recommend specifying a maximum price because it can lead to increased interruptions. When Spot Instances launch, you pay the current Spot price. To remove a maximum price that you previously set, include the property but specify an empty string ("") for the value.
If you specify a maximum price, your instances will be interrupted more frequently than if you do not specify one.
Valid Range: Minimum value of 0.001
InstanceId
— (String
)The ID of the instance used to base the launch configuration on. If specified, Amazon EC2 Auto Scaling uses the configuration values from the specified instance to create a new launch configuration. To get the instance ID, use the Amazon EC2 DescribeInstances API operation. For more information, see Create an Auto Scaling group using parameters from an existing instance in the Amazon EC2 Auto Scaling User Guide.
MinSize
— (Integer
)The minimum size of the group.
MaxSize
— (Integer
)The maximum size of the group.
Note: With a mixed instances policy that uses instance weighting, Amazon EC2 Auto Scaling may need to go aboveMaxSize
to meet your capacity requirements. In this event, Amazon EC2 Auto Scaling will never go aboveMaxSize
by more than your largest instance weight (weights that define how many units each instance contributes to the desired capacity of the group).DesiredCapacity
— (Integer
)The desired capacity is the initial capacity of the Auto Scaling group at the time of its creation and the capacity it attempts to maintain. It can scale beyond this capacity if you configure auto scaling. This number must be greater than or equal to the minimum size of the group and less than or equal to the maximum size of the group. If you do not specify a desired capacity, the default is the minimum size of the group.
DefaultCooldown
— (Integer
)Only needed if you use simple scaling policies.
The amount of time, in seconds, between one scaling activity ending and another one starting due to simple scaling policies. For more information, see Scaling cooldowns for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
Default:
300
secondsAvailabilityZones
— (Array<String>
)A list of Availability Zones where instances in the Auto Scaling group can be created. Used for launching into the default VPC subnet in each Availability Zone when not using the
VPCZoneIdentifier
property, or for attaching a network interface when an existing network interface ID is specified in a launch template.LoadBalancerNames
— (Array<String>
)A list of Classic Load Balancers associated with this Auto Scaling group. For Application Load Balancers, Network Load Balancers, and Gateway Load Balancers, specify the
TargetGroupARNs
property instead.TargetGroupARNs
— (Array<String>
)The Amazon Resource Names (ARN) of the Elastic Load Balancing target groups to associate with the Auto Scaling group. Instances are registered as targets with the target groups. The target groups receive incoming traffic and route requests to one or more registered targets. For more information, see Use Elastic Load Balancing to distribute traffic across the instances in your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.
HealthCheckType
— (String
)A comma-separated value string of one or more health check types.
The valid values are
EC2
,EBS
,ELB
, andVPC_LATTICE
.EC2
is the default health check and cannot be disabled. For more information, see Health checks for instances in an Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.Only specify
EC2
if you must clear a value that was previously set.HealthCheckGracePeriod
— (Integer
)The amount of time, in seconds, that Amazon EC2 Auto Scaling waits before checking the health status of an EC2 instance that has come into service and marking it unhealthy due to a failed health check. This is useful if your instances do not immediately pass their health checks after they enter the
InService
state. For more information, see Set the health check grace period for an Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.Default:
0
secondsPlacementGroup
— (String
)The name of the placement group into which to launch your instances. For more information, see Placement groups in the Amazon EC2 User Guide for Linux Instances.
Note: A cluster placement group is a logical grouping of instances within a single Availability Zone. You cannot specify multiple Availability Zones and a cluster placement group.VPCZoneIdentifier
— (String
)A comma-separated list of subnet IDs for a virtual private cloud (VPC) where instances in the Auto Scaling group can be created. If you specify
VPCZoneIdentifier
withAvailabilityZones
, the subnets that you specify must reside in those Availability Zones.TerminationPolicies
— (Array<String>
)A policy or a list of policies that are used to select the instance to terminate. These policies are executed in the order that you list them. For more information, see Configure termination policies for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
Valid values:
Default
|AllocationStrategy
|ClosestToNextInstanceHour
|NewestInstance
|OldestInstance
|OldestLaunchConfiguration
|OldestLaunchTemplate
|arn:aws:lambda:region:account-id:function:my-function:my-alias
NewInstancesProtectedFromScaleIn
— (Boolean
)Indicates whether newly launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in. For more information about preventing instances from terminating on scale in, see Use instance scale-in protection in the Amazon EC2 Auto Scaling User Guide.
CapacityRebalance
— (Boolean
)Indicates whether Capacity Rebalancing is enabled. Otherwise, Capacity Rebalancing is disabled. When you turn on Capacity Rebalancing, Amazon EC2 Auto Scaling attempts to launch a Spot Instance whenever Amazon EC2 notifies that a Spot Instance is at an elevated risk of interruption. After launching a new instance, it then terminates an old instance. For more information, see Use Capacity Rebalancing to handle Amazon EC2 Spot Interruptions in the in the Amazon EC2 Auto Scaling User Guide.
LifecycleHookSpecificationList
— (Array<map>
)One or more lifecycle hooks to add to the Auto Scaling group before instances are launched.
LifecycleHookName
— required — (String
)The name of the lifecycle hook.
LifecycleTransition
— required — (String
)The lifecycle transition. For Auto Scaling groups, there are two major lifecycle transitions.
-
To create a lifecycle hook for scale-out events, specify
autoscaling:EC2_INSTANCE_LAUNCHING
. -
To create a lifecycle hook for scale-in events, specify
autoscaling:EC2_INSTANCE_TERMINATING
.
-
NotificationMetadata
— (String
)Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.
HeartbeatTimeout
— (Integer
)The maximum time, in seconds, that can elapse before the lifecycle hook times out. The range is from
30
to7200
seconds. The default value is3600
seconds (1 hour).DefaultResult
— (String
)The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs. The default value is
ABANDON
.Valid values:
CONTINUE
|ABANDON
NotificationTargetARN
— (String
)The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling sends notifications to when an instance is in a wait state for the lifecycle hook. You can specify an Amazon SNS topic or an Amazon SQS queue.
RoleARN
— (String
)The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target. For information about creating this role, see Prepare to add a lifecycle hook to your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.
Valid only if the notification target is an Amazon SNS topic or an Amazon SQS queue.
Tags
— (Array<map>
)One or more tags. You can tag your Auto Scaling group and propagate the tags to the Amazon EC2 instances it launches. Tags are not propagated to Amazon EBS volumes. To add tags to Amazon EBS volumes, specify the tags in a launch template but use caution. If the launch template specifies an instance tag with a key that is also specified for the Auto Scaling group, Amazon EC2 Auto Scaling overrides the value of that instance tag with the value specified by the Auto Scaling group. For more information, see Tag Auto Scaling groups and instances in the Amazon EC2 Auto Scaling User Guide.
ResourceId
— (String
)The name of the Auto Scaling group.
ResourceType
— (String
)The type of resource. The only supported value is
auto-scaling-group
.Key
— required — (String
)The tag key.
Value
— (String
)The tag value.
PropagateAtLaunch
— (Boolean
)Determines whether the tag is added to new instances as they are launched in the group.
ServiceLinkedRoleARN
— (String
)The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other Amazon Web Services service on your behalf. By default, Amazon EC2 Auto Scaling uses a service-linked role named
AWSServiceRoleForAutoScaling
, which it creates if it does not exist. For more information, see Service-linked roles in the Amazon EC2 Auto Scaling User Guide.MaxInstanceLifetime
— (Integer
)The maximum amount of time, in seconds, that an instance can be in service. The default is null. If specified, the value must be either 0 or a number equal to or greater than 86,400 seconds (1 day). For more information, see Replace Auto Scaling instances based on maximum instance lifetime in the Amazon EC2 Auto Scaling User Guide.
Context
— (String
)Reserved.
DesiredCapacityType
— (String
)The unit of measurement for the value specified for desired capacity. Amazon EC2 Auto Scaling supports
DesiredCapacityType
for attribute-based instance type selection only. For more information, see Create a mixed instances group using attribute-based instance type selection in the Amazon EC2 Auto Scaling User Guide.By default, Amazon EC2 Auto Scaling specifies
units
, which translates into number of instances.Valid values:
units
|vcpu
|memory-mib
DefaultInstanceWarmup
— (Integer
)The amount of time, in seconds, until a new instance is considered to have finished initializing and resource consumption to become stable after it enters the
InService
state.During an instance refresh, Amazon EC2 Auto Scaling waits for the warm-up period after it replaces an instance before it moves on to replacing the next instance. Amazon EC2 Auto Scaling also waits for the warm-up period before aggregating the metrics for new instances with existing instances in the Amazon CloudWatch metrics that are used for scaling, resulting in more reliable usage data. For more information, see Set the default instance warmup for an Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.
To manage various warm-up settings at the group level, we recommend that you set the default instance warmup, even if it is set to 0 seconds. To remove a value that you previously set, include the property but specify
-1
for the value. However, we strongly recommend keeping the default instance warmup enabled by specifying a value of0
or other nominal value.Default: None
TrafficSources
— (Array<map>
)The list of traffic sources to attach to this Auto Scaling group. You can use any of the following as traffic sources for an Auto Scaling group: Classic Load Balancer, Application Load Balancer, Gateway Load Balancer, Network Load Balancer, and VPC Lattice.
Identifier
— required — (String
)Identifies the traffic source.
For Application Load Balancers, Gateway Load Balancers, Network Load Balancers, and VPC Lattice, this will be the Amazon Resource Name (ARN) for a target group in this account and Region. For Classic Load Balancers, this will be the name of the Classic Load Balancer in this account and Region.
For example:
-
Application Load Balancer ARN:
arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/1234567890123456
-
Classic Load Balancer name:
my-classic-load-balancer
-
VPC Lattice ARN:
arn:aws:vpc-lattice:us-west-2:123456789012:targetgroup/tg-1234567890123456
To get the ARN of a target group for a Application Load Balancer, Gateway Load Balancer, or Network Load Balancer, or the name of a Classic Load Balancer, use the Elastic Load Balancing DescribeTargetGroups and DescribeLoadBalancers API operations.
To get the ARN of a target group for VPC Lattice, use the VPC Lattice GetTargetGroup API operation.
-
Type
— (String
)Provides additional context for the value of
Identifier
.The following lists the valid values:
-
elb
ifIdentifier
is the name of a Classic Load Balancer. -
elbv2
ifIdentifier
is the ARN of an Application Load Balancer, Gateway Load Balancer, or Network Load Balancer target group. -
vpc-lattice
ifIdentifier
is the ARN of a VPC Lattice target group.
Required if the identifier is the name of a Classic Load Balancer.
-
InstanceMaintenancePolicy
— (map
)An instance maintenance policy. For more information, see Set instance maintenance policy in the Amazon EC2 Auto Scaling User Guide.
MinHealthyPercentage
— (Integer
)Specifies the lower threshold as a percentage of the desired capacity of the Auto Scaling group. It represents the minimum percentage of the group to keep in service, healthy, and ready to use to support your workload when replacing instances. Value range is 0 to 100. To clear a previously set value, specify a value of
-1
.MaxHealthyPercentage
— (Integer
)Specifies the upper threshold as a percentage of the desired capacity of the Auto Scaling group. It represents the maximum percentage of the group that can be in service and healthy, or pending, to support your workload when replacing instances. Value range is 100 to 200. To clear a previously set value, specify a value of
-1
.Both
MinHealthyPercentage
andMaxHealthyPercentage
must be specified, and the difference between them cannot be greater than 100. A large range increases the number of instances that can be replaced at the same time.
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:
createLaunchConfiguration(params = {}, callback) ⇒ AWS.Request
Creates a launch configuration.
If you exceed your maximum limit of launch configurations, the call fails. To query this limit, call the DescribeAccountLimits API. For information about updating this limit, see Quotas for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
For more information, see Launch configurations in the Amazon EC2 Auto Scaling User Guide.
Note: Amazon EC2 Auto Scaling configures instances launched as part of an Auto Scaling group using either a launch template or a launch configuration. We strongly recommend that you do not use launch configurations. They do not provide full functionality for Amazon EC2 Auto Scaling or Amazon EC2. For information about using launch templates, see Launch templates in the Amazon EC2 Auto Scaling User Guide.Service Reference:
Examples:
To create a launch configuration
/* This example creates a launch configuration. */ var params = { IamInstanceProfile: "my-iam-role", ImageId: "ami-12345678", InstanceType: "m3.medium", LaunchConfigurationName: "my-launch-config", SecurityGroups: [ "sg-eb2af88e" ] }; autoscaling.createLaunchConfiguration(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Calling the createLaunchConfiguration operation
var params = { LaunchConfigurationName: 'STRING_VALUE', /* required */ AssociatePublicIpAddress: true || false, BlockDeviceMappings: [ { DeviceName: 'STRING_VALUE', /* required */ Ebs: { DeleteOnTermination: true || false, Encrypted: true || false, Iops: 'NUMBER_VALUE', SnapshotId: 'STRING_VALUE', Throughput: 'NUMBER_VALUE', VolumeSize: 'NUMBER_VALUE', VolumeType: 'STRING_VALUE' }, NoDevice: true || false, VirtualName: 'STRING_VALUE' }, /* more items */ ], ClassicLinkVPCId: 'STRING_VALUE', ClassicLinkVPCSecurityGroups: [ 'STRING_VALUE', /* more items */ ], EbsOptimized: true || false, IamInstanceProfile: 'STRING_VALUE', ImageId: 'STRING_VALUE', InstanceId: 'STRING_VALUE', InstanceMonitoring: { Enabled: true || false }, InstanceType: 'STRING_VALUE', KernelId: 'STRING_VALUE', KeyName: 'STRING_VALUE', MetadataOptions: { HttpEndpoint: disabled | enabled, HttpPutResponseHopLimit: 'NUMBER_VALUE', HttpTokens: optional | required }, PlacementTenancy: 'STRING_VALUE', RamdiskId: 'STRING_VALUE', SecurityGroups: [ 'STRING_VALUE', /* more items */ ], SpotPrice: 'STRING_VALUE', UserData: 'STRING_VALUE' }; autoscaling.createLaunchConfiguration(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: {})
—
LaunchConfigurationName
— (String
)The name of the launch configuration. This name must be unique per Region per account.
ImageId
— (String
)The ID of the Amazon Machine Image (AMI) that was assigned during registration. For more information, see Find a Linux AMI in the Amazon EC2 User Guide for Linux Instances.
If you specify
InstanceId
, anImageId
is not required.KeyName
— (String
)The name of the key pair. For more information, see Amazon EC2 key pairs and Amazon EC2 instances in the Amazon EC2 User Guide for Linux Instances.
SecurityGroups
— (Array<String>
)A list that contains the security group IDs to assign to the instances in the Auto Scaling group. For more information, see Control traffic to your Amazon Web Services resources using security groups in the Amazon Virtual Private Cloud User Guide.
ClassicLinkVPCId
— (String
)Available for backward compatibility.
ClassicLinkVPCSecurityGroups
— (Array<String>
)Available for backward compatibility.
UserData
— (String
)The user data to make available to the launched EC2 instances. For more information, see Instance metadata and user data (Linux) and Instance metadata and user data (Windows). If you are using a command line tool, base64-encoding is performed for you, and you can load the text from a file. Otherwise, you must provide base64-encoded text. User data is limited to 16 KB.
InstanceId
— (String
)The ID of the instance to use to create the launch configuration. The new launch configuration derives attributes from the instance, except for the block device mapping.
To create a launch configuration with a block device mapping or override any other instance attributes, specify them as part of the same request.
For more information, see Create a launch configuration in the Amazon EC2 Auto Scaling User Guide.
InstanceType
— (String
)Specifies the instance type of the EC2 instance. For information about available instance types, see Available instance types in the Amazon EC2 User Guide for Linux Instances.
If you specify
InstanceId
, anInstanceType
is not required.KernelId
— (String
)The ID of the kernel associated with the AMI.
Note: We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see User provided kernels in the Amazon EC2 User Guide for Linux Instances.RamdiskId
— (String
)The ID of the RAM disk to select.
Note: We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see User provided kernels in the Amazon EC2 User Guide for Linux Instances.BlockDeviceMappings
— (Array<map>
)The block device mapping entries that define the block devices to attach to the instances at launch. By default, the block devices specified in the block device mapping for the AMI are used. For more information, see Block device mappings in the Amazon EC2 User Guide for Linux Instances.
VirtualName
— (String
)The name of the instance store volume (virtual device) to attach to an instance at launch. The name must be in the form ephemeralX where X is a number starting from zero (0), for example,
ephemeral0
.DeviceName
— required — (String
)The device name assigned to the volume (for example,
/dev/sdh
orxvdh
). For more information, see Device naming on Linux instances in the Amazon EC2 User Guide for Linux Instances.Note: To define a block device mapping, set the device name and exactly one of the following properties:Ebs
,NoDevice
, orVirtualName
.Ebs
— (map
)Information to attach an EBS volume to an instance at launch.
SnapshotId
— (String
)The snapshot ID of the volume to use.
You must specify either a
VolumeSize
or aSnapshotId
.VolumeSize
— (Integer
)The volume size, in GiBs. The following are the supported volumes sizes for each volume type:
-
gp2
andgp3
: 1-16,384 -
io1
: 4-16,384 -
st1
andsc1
: 125-16,384 -
standard
: 1-1,024
You must specify either a
SnapshotId
or aVolumeSize
. If you specify bothSnapshotId
andVolumeSize
, the volume size must be equal or greater than the size of the snapshot.-
VolumeType
— (String
)The volume type. For more information, see Amazon EBS volume types in the Amazon EBS User Guide.
Valid values:
standard
|io1
|gp2
|st1
|sc1
|gp3
DeleteOnTermination
— (Boolean
)Indicates whether the volume is deleted on instance termination. For Amazon EC2 Auto Scaling, the default value is
true
.Iops
— (Integer
)The number of input/output (I/O) operations per second (IOPS) to provision for the volume. For
gp3
andio1
volumes, this represents the number of IOPS that are provisioned for the volume. Forgp2
volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting.The following are the supported values for each volume type:
-
gp3
: 3,000-16,000 IOPS -
io1
: 100-64,000 IOPS
For
io1
volumes, we guarantee 64,000 IOPS only for Instances built on the Amazon Web Services Nitro System. Other instance families guarantee performance up to 32,000 IOPS.Iops
is supported when the volume type isgp3
orio1
and required only when the volume type isio1
. (Not used withstandard
,gp2
,st1
, orsc1
volumes.)-
Encrypted
— (Boolean
)Specifies whether the volume should be encrypted. Encrypted EBS volumes can only be attached to instances that support Amazon EBS encryption. For more information, see Requirements for Amazon EBS encryption in the Amazon EBS User Guide. If your AMI uses encrypted volumes, you can also only launch it on supported instance types.
Note: If you are creating a volume from a snapshot, you cannot create an unencrypted volume from an encrypted snapshot. Also, you cannot specify a KMS key ID when using a launch configuration. If you enable encryption by default, the EBS volumes that you create are always encrypted, either using the Amazon Web Services managed KMS key or a customer-managed KMS key, regardless of whether the snapshot was encrypted. For more information, see Use Amazon Web Services KMS keys to encrypt Amazon EBS volumes in the Amazon EC2 Auto Scaling User Guide.Throughput
— (Integer
)The throughput (MiBps) to provision for a
gp3
volume.
NoDevice
— (Boolean
)Setting this value to
true
prevents a volume that is included in the block device mapping of the AMI from being mapped to the specified device name at launch.If
NoDevice
istrue
for the root device, instances might fail the EC2 health check. In that case, Amazon EC2 Auto Scaling launches replacement instances.
InstanceMonitoring
— (map
)Controls whether instances in this group are launched with detailed (
true
) or basic (false
) monitoring.The default value is
true
(enabled).When detailed monitoring is enabled, Amazon CloudWatch generates metrics every minute and your account is charged a fee. When you disable detailed monitoring, CloudWatch generates metrics every 5 minutes. For more information, see Configure monitoring for Auto Scaling instances in the Amazon EC2 Auto Scaling User Guide.
Enabled
— (Boolean
)If
true
, detailed monitoring is enabled. Otherwise, basic monitoring is enabled.
SpotPrice
— (String
)The maximum hourly price to be paid for any Spot Instance launched to fulfill the request. Spot Instances are launched when the price you specify exceeds the current Spot price. For more information, see Request Spot Instances for fault-tolerant and flexible applications in the Amazon EC2 Auto Scaling User Guide.
Valid Range: Minimum value of 0.001
Note: When you change your maximum price by creating a new launch configuration, running instances will continue to run as long as the maximum price for those running instances is higher than the current Spot price.IamInstanceProfile
— (String
)The name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance. The instance profile contains the IAM role. For more information, see IAM role for applications that run on Amazon EC2 instances in the Amazon EC2 Auto Scaling User Guide.
EbsOptimized
— (Boolean
)Specifies whether the launch configuration is optimized for EBS I/O (
true
) or not (false
). The optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal I/O performance. This optimization is not available with all instance types. Additional fees are incurred when you enable EBS optimization for an instance type that is not EBS-optimized by default. For more information, see Amazon EBS-optimized instances in the Amazon EC2 User Guide for Linux Instances.The default value is
false
.AssociatePublicIpAddress
— (Boolean
)Specifies whether to assign a public IPv4 address to the group's instances. If the instance is launched into a default subnet, the default is to assign a public IPv4 address, unless you disabled the option to assign a public IPv4 address on the subnet. If the instance is launched into a nondefault subnet, the default is not to assign a public IPv4 address, unless you enabled the option to assign a public IPv4 address on the subnet.
If you specify
true
, each instance in the Auto Scaling group receives a unique public IPv4 address. For more information, see Provide network connectivity for your Auto Scaling instances using Amazon VPC in the Amazon EC2 Auto Scaling User Guide.If you specify this property, you must specify at least one subnet for
VPCZoneIdentifier
when you create your group.PlacementTenancy
— (String
)The tenancy of the instance, either
default
ordedicated
. An instance withdedicated
tenancy runs on isolated, single-tenant hardware and can only be launched into a VPC. To launch dedicated instances into a shared tenancy VPC (a VPC with the instance placement tenancy attribute set todefault
), you must set the value of this property todedicated
.If you specify
PlacementTenancy
, you must specify at least one subnet forVPCZoneIdentifier
when you create your group.Valid values:
default
|dedicated
MetadataOptions
— (map
)The metadata options for the instances. For more information, see Configure the instance metadata options in the Amazon EC2 Auto Scaling User Guide.
HttpTokens
— (String
)The state of token usage for your instance metadata requests. If the parameter is not specified in the request, the default state is
optional
.If the state is
optional
, you can choose to retrieve instance metadata with or without a signed token header on your request. If you retrieve the IAM role credentials without a token, the version 1.0 role credentials are returned. If you retrieve the IAM role credentials using a valid signed token, the version 2.0 role credentials are returned.If the state is
Possible values include:required
, you must send a signed token header with any instance metadata retrieval requests. In this state, retrieving the IAM role credentials always returns the version 2.0 credentials; the version 1.0 credentials are not available."optional"
"required"
HttpPutResponseHopLimit
— (Integer
)The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel.
Default: 1
HttpEndpoint
— (String
)This parameter enables or disables the HTTP metadata endpoint on your instances. If the parameter is not specified, the default state is
enabled
.Note: If you specify a value ofPossible values include:disabled
, you will not be able to access your instance metadata."disabled"
"enabled"
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:
createOrUpdateTags(params = {}, callback) ⇒ AWS.Request
Creates or updates tags for the specified Auto Scaling group.
When you specify a tag with a key that already exists, the operation overwrites the previous tag definition, and you do not get an error message.
For more information, see Tag Auto Scaling groups and instances in the Amazon EC2 Auto Scaling User Guide.
Service Reference:
Examples:
To create or update tags for an Auto Scaling group
/* This example adds two tags to the specified Auto Scaling group. */ var params = { Tags: [ { Key: "Role", PropagateAtLaunch: true, ResourceId: "my-auto-scaling-group", ResourceType: "auto-scaling-group", Value: "WebServer" }, { Key: "Dept", PropagateAtLaunch: true, ResourceId: "my-auto-scaling-group", ResourceType: "auto-scaling-group", Value: "Research" } ] }; autoscaling.createOrUpdateTags(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Calling the createOrUpdateTags operation
var params = { Tags: [ /* required */ { Key: 'STRING_VALUE', /* required */ PropagateAtLaunch: true || false, ResourceId: 'STRING_VALUE', ResourceType: 'STRING_VALUE', Value: 'STRING_VALUE' }, /* more items */ ] }; autoscaling.createOrUpdateTags(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: {})
—
Tags
— (Array<map>
)One or more tags.
ResourceId
— (String
)The name of the Auto Scaling group.
ResourceType
— (String
)The type of resource. The only supported value is
auto-scaling-group
.Key
— required — (String
)The tag key.
Value
— (String
)The tag value.
PropagateAtLaunch
— (Boolean
)Determines whether the tag is added to new instances as they are launched in the 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.
-
(AWS.Response)
—
Returns:
deleteAutoScalingGroup(params = {}, callback) ⇒ AWS.Request
Deletes the specified Auto Scaling group.
If the group has instances or scaling activities in progress, you must specify the option to force the deletion in order for it to succeed. The force delete operation will also terminate the EC2 instances. If the group has a warm pool, the force delete option also deletes the warm pool.
To remove instances from the Auto Scaling group before deleting it, call the DetachInstances API with the list of instances and the option to decrement the desired capacity. This ensures that Amazon EC2 Auto Scaling does not launch replacement instances.
To terminate all instances before deleting the Auto Scaling group, call the UpdateAutoScalingGroup API and set the minimum size and desired capacity of the Auto Scaling group to zero.
If the group has scaling policies, deleting the group deletes the policies, the underlying alarm actions, and any alarm that no longer has an associated action.
For more information, see Delete your Auto Scaling infrastructure in the Amazon EC2 Auto Scaling User Guide.
Service Reference:
Examples:
To delete an Auto Scaling group
/* This example deletes the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group" }; autoscaling.deleteAutoScalingGroup(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
To delete an Auto Scaling group and all its instances
/* This example deletes the specified Auto Scaling group and all its instances. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", ForceDelete: true }; autoscaling.deleteAutoScalingGroup(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Calling the deleteAutoScalingGroup operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ ForceDelete: true || false }; autoscaling.deleteAutoScalingGroup(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
ForceDelete
— (Boolean
)Specifies that the group is to be deleted along with all instances associated with the group, without waiting for all instances to be terminated. This action also deletes any outstanding lifecycle actions associated with the 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.
-
(AWS.Response)
—
Returns:
deleteLaunchConfiguration(params = {}, callback) ⇒ AWS.Request
Deletes the specified launch configuration.
The launch configuration must not be attached to an Auto Scaling group. When this call completes, the launch configuration is no longer available for use.
Service Reference:
Examples:
To delete a launch configuration
/* This example deletes the specified launch configuration. */ var params = { LaunchConfigurationName: "my-launch-config" }; autoscaling.deleteLaunchConfiguration(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Calling the deleteLaunchConfiguration operation
var params = { LaunchConfigurationName: 'STRING_VALUE' /* required */ }; autoscaling.deleteLaunchConfiguration(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: {})
—
LaunchConfigurationName
— (String
)The name of the launch configuration.
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:
deleteLifecycleHook(params = {}, callback) ⇒ AWS.Request
Deletes the specified lifecycle hook.
If there are any outstanding lifecycle actions, they are completed first (
ABANDON
for launching instances,CONTINUE
for terminating instances).Service Reference:
Examples:
To delete a lifecycle hook
/* This example deletes the specified lifecycle hook. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", LifecycleHookName: "my-lifecycle-hook" }; autoscaling.deleteLifecycleHook(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { } */ });
Calling the deleteLifecycleHook operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ LifecycleHookName: 'STRING_VALUE' /* required */ }; autoscaling.deleteLifecycleHook(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: {})
—
LifecycleHookName
— (String
)The name of the lifecycle hook.
AutoScalingGroupName
— (String
)The name of the Auto Scaling 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.
-
(AWS.Response)
—
Returns:
deleteNotificationConfiguration(params = {}, callback) ⇒ AWS.Request
Deletes the specified notification.
Service Reference:
Examples:
To delete an Auto Scaling notification
/* This example deletes the specified notification from the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", TopicARN: "arn:aws:sns:us-west-2:123456789012:my-sns-topic" }; autoscaling.deleteNotificationConfiguration(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Calling the deleteNotificationConfiguration operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ TopicARN: 'STRING_VALUE' /* required */ }; autoscaling.deleteNotificationConfiguration(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
TopicARN
— (String
)The Amazon Resource Name (ARN) of the Amazon SNS topic.
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:
deletePolicy(params = {}, callback) ⇒ AWS.Request
Deletes the specified scaling policy.
Deleting either a step scaling policy or a simple scaling policy deletes the underlying alarm action, but does not delete the alarm, even if it no longer has an associated action.
For more information, see Delete a scaling policy in the Amazon EC2 Auto Scaling User Guide.
Service Reference:
Examples:
To delete an Auto Scaling policy
/* This example deletes the specified Auto Scaling policy. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", PolicyName: "my-step-scale-out-policy" }; autoscaling.deletePolicy(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Calling the deletePolicy operation
var params = { PolicyName: 'STRING_VALUE', /* required */ AutoScalingGroupName: 'STRING_VALUE' }; autoscaling.deletePolicy(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
PolicyName
— (String
)The name or Amazon Resource Name (ARN) of the policy.
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:
deleteScheduledAction(params = {}, callback) ⇒ AWS.Request
Deletes the specified scheduled action.
Service Reference:
Examples:
To delete a scheduled action from an Auto Scaling group
/* This example deletes the specified scheduled action from the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", ScheduledActionName: "my-scheduled-action" }; autoscaling.deleteScheduledAction(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Calling the deleteScheduledAction operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ ScheduledActionName: 'STRING_VALUE' /* required */ }; autoscaling.deleteScheduledAction(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
ScheduledActionName
— (String
)The name of the action to delete.
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:
deleteTags(params = {}, callback) ⇒ AWS.Request
Deletes the specified tags.
Service Reference:
Examples:
To delete a tag from an Auto Scaling group
/* This example deletes the specified tag from the specified Auto Scaling group. */ var params = { Tags: [ { Key: "Dept", ResourceId: "my-auto-scaling-group", ResourceType: "auto-scaling-group", Value: "Research" } ] }; autoscaling.deleteTags(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Calling the deleteTags operation
var params = { Tags: [ /* required */ { Key: 'STRING_VALUE', /* required */ PropagateAtLaunch: true || false, ResourceId: 'STRING_VALUE', ResourceType: 'STRING_VALUE', Value: 'STRING_VALUE' }, /* more items */ ] }; autoscaling.deleteTags(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: {})
—
Tags
— (Array<map>
)One or more tags.
ResourceId
— (String
)The name of the Auto Scaling group.
ResourceType
— (String
)The type of resource. The only supported value is
auto-scaling-group
.Key
— required — (String
)The tag key.
Value
— (String
)The tag value.
PropagateAtLaunch
— (Boolean
)Determines whether the tag is added to new instances as they are launched in the 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.
-
(AWS.Response)
—
Returns:
deleteWarmPool(params = {}, callback) ⇒ AWS.Request
Deletes the warm pool for the specified Auto Scaling group.
For more information, see Warm pools for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
Service Reference:
Examples:
Calling the deleteWarmPool operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ ForceDelete: true || false }; autoscaling.deleteWarmPool(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
ForceDelete
— (Boolean
)Specifies that the warm pool is to be deleted along with all of its associated instances, without waiting for all instances to be terminated. This parameter also deletes any outstanding lifecycle actions associated with the warm pool instances.
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:
describeAccountLimits(params = {}, callback) ⇒ AWS.Request
Describes the current Amazon EC2 Auto Scaling resource quotas for your account.
When you establish an Amazon Web Services account, the account has initial quotas on the maximum number of Auto Scaling groups and launch configurations that you can create in a given Region. For more information, see Quotas for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
Service Reference:
Examples:
To describe your Auto Scaling account limits
/* This example describes the Amazon EC2 Auto Scaling service quotas for your account. */ var params = {}; autoscaling.describeAccountLimits(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { MaxNumberOfAutoScalingGroups: 20, MaxNumberOfLaunchConfigurations: 100, NumberOfAutoScalingGroups: 3, NumberOfLaunchConfigurations: 5 } */ });
Calling the describeAccountLimits operation
autoscaling.describeAccountLimits(function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Parameters:
- params (Object) (defaults to: {})
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:MaxNumberOfAutoScalingGroups
— (Integer
)The maximum number of groups allowed for your account. The default is 200 groups per Region.
MaxNumberOfLaunchConfigurations
— (Integer
)The maximum number of launch configurations allowed for your account. The default is 200 launch configurations per Region.
NumberOfAutoScalingGroups
— (Integer
)The current number of groups for your account.
NumberOfLaunchConfigurations
— (Integer
)The current number of launch configurations for your account.
-
(AWS.Response)
—
Returns:
describeAdjustmentTypes(params = {}, callback) ⇒ AWS.Request
Describes the available adjustment types for step scaling and simple scaling policies.
The following adjustment types are supported:
-
ChangeInCapacity
-
ExactCapacity
-
PercentChangeInCapacity
Service Reference:
Examples:
To describe the Amazon EC2 Auto Scaling adjustment types
/* This example describes the available adjustment types. */ var params = {}; autoscaling.describeAdjustmentTypes(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { AdjustmentTypes: [ { AdjustmentType: "ChangeInCapacity" }, { AdjustmentType: "ExactCapcity" }, { AdjustmentType: "PercentChangeInCapacity" } ] } */ });
Calling the describeAdjustmentTypes operation
autoscaling.describeAdjustmentTypes(function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Parameters:
- params (Object) (defaults to: {})
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:AdjustmentTypes
— (Array<map>
)The policy adjustment types.
AdjustmentType
— (String
)The policy adjustment type. The valid values are
ChangeInCapacity
,ExactCapacity
, andPercentChangeInCapacity
.
-
(AWS.Response)
—
Returns:
describeAutoScalingGroups(params = {}, callback) ⇒ AWS.Request
Gets information about the Auto Scaling groups in the account and Region.
If you specify Auto Scaling group names, the output includes information for only the specified Auto Scaling groups. If you specify filters, the output includes information for only those Auto Scaling groups that meet the filter criteria. If you do not specify group names or filters, the output includes information for all Auto Scaling groups.
This operation also returns information about instances in Auto Scaling groups. To retrieve information about the instances in a warm pool, you must call the DescribeWarmPool API.
Service Reference:
Examples:
To describe an Auto Scaling group
/* This example describes the specified Auto Scaling group. */ var params = { AutoScalingGroupNames: [ "my-auto-scaling-group" ] }; autoscaling.describeAutoScalingGroups(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { AutoScalingGroups: [ { AutoScalingGroupARN: "arn:aws:autoscaling:us-west-1:123456789012:autoScalingGroup:12345678-1234-1234-1234-123456789012:autoScalingGroupName/my-auto-scaling-group", AutoScalingGroupName: "my-auto-scaling-group", AvailabilityZones: [ "us-west-2a", "us-west-2b", "us-west-2c" ], CreatedTime: <Date Representation>, DefaultCooldown: 300, DesiredCapacity: 2, EnabledMetrics: [ ], HealthCheckGracePeriod: 300, HealthCheckType: "EC2", Instances: [ { AvailabilityZone: "us-west-2c", HealthStatus: "Healthy", InstanceId: "i-05b4f7d5be44822a6", InstanceType: "t3.micro", LaunchConfigurationName: "my-launch-config", LifecycleState: "InService", ProtectedFromScaleIn: false }, { AvailabilityZone: "us-west-2b", HealthStatus: "Healthy", InstanceId: "i-0c20ac468fa3049e8", InstanceType: "t3.micro", LaunchConfigurationName: "my-launch-config", LifecycleState: "InService", ProtectedFromScaleIn: false } ], LaunchConfigurationName: "my-launch-config", LoadBalancerNames: [ ], MaxSize: 5, MinSize: 1, NewInstancesProtectedFromScaleIn: false, ServiceLinkedRoleARN: "arn:aws:iam::123456789012:role/aws-service-role/autoscaling.amazonaws.com/AWSServiceRoleForAutoScaling", SuspendedProcesses: [ ], Tags: [ ], TargetGroupARNs: [ ], TerminationPolicies: [ "Default" ], TrafficSources: [ ], VPCZoneIdentifier: "subnet-5ea0c127,subnet-6194ea3b,subnet-c934b782" } ] } */ });
Calling the describeAutoScalingGroups operation
var params = { AutoScalingGroupNames: [ 'STRING_VALUE', /* more items */ ], Filters: [ { Name: 'STRING_VALUE', Values: [ 'STRING_VALUE', /* more items */ ] }, /* more items */ ], MaxRecords: 'NUMBER_VALUE', NextToken: 'STRING_VALUE' }; autoscaling.describeAutoScalingGroups(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: {})
—
AutoScalingGroupNames
— (Array<String>
)The names of the Auto Scaling groups. By default, you can only specify up to 50 names. You can optionally increase this limit using the
MaxRecords
property.If you omit this property, all Auto Scaling groups are described.
NextToken
— (String
)The token for the next set of items to return. (You received this token from a previous call.)
MaxRecords
— (Integer
)The maximum number of items to return with this call. The default value is
50
and the maximum value is100
.Filters
— (Array<map>
)One or more filters to limit the results based on specific tags.
Name
— (String
)The name of the filter.
The valid values for
Name
depend on which API operation you're using with the filter (DescribeAutoScalingGroups or DescribeTags).DescribeAutoScalingGroups
Valid values for
Name
include the following:-
tag-key
- Accepts tag keys. The results only include information about the Auto Scaling groups associated with these tag keys. -
tag-value
- Accepts tag values. The results only include information about the Auto Scaling groups associated with these tag values. -
tag:<key>
- Accepts the key/value combination of the tag. Use the tag key in the filter name and the tag value as the filter value. The results only include information about the Auto Scaling groups associated with the specified key/value combination.
DescribeTags
Valid values for
Name
include the following:-
auto-scaling-group
- Accepts the names of Auto Scaling groups. The results only include information about the tags associated with these Auto Scaling groups. -
key
- Accepts tag keys. The results only include information about the tags associated with these tag keys. -
value
- Accepts tag values. The results only include information about the tags associated with these tag values. -
propagate-at-launch
- Accepts a Boolean value, which specifies whether tags propagate to instances at launch. The results only include information about the tags associated with the specified Boolean value.
-
Values
— (Array<String>
)One or more filter values. Filter values are case-sensitive.
If you specify multiple values for a filter, the values are automatically logically joined with an
OR
, and the request returns all results that match any of the specified values. For example, specify "tag:environment" for the filter name and "production,development" for the filter values to find Auto Scaling groups with the tag "environment=production" or "environment=development".
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:AutoScalingGroups
— (Array<map>
)The groups.
AutoScalingGroupName
— required — (String
)The name of the Auto Scaling group.
AutoScalingGroupARN
— (String
)The Amazon Resource Name (ARN) of the Auto Scaling group.
LaunchConfigurationName
— (String
)The name of the associated launch configuration.
LaunchTemplate
— (map
)The launch template for the group.
LaunchTemplateId
— (String
)The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.LaunchTemplateName
— (String
)The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.Version
— (String
)The version number,
$Latest
, or$Default
. To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API. If the value is$Latest
, Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is$Default
, Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is$Default
.
MixedInstancesPolicy
— (map
)The mixed instances policy for the group.
LaunchTemplate
— (map
)One or more launch templates and the instance types (overrides) that are used to launch EC2 instances to fulfill On-Demand and Spot capacities.
LaunchTemplateSpecification
— (map
)The launch template.
LaunchTemplateId
— (String
)The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.LaunchTemplateName
— (String
)The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.Version
— (String
)The version number,
$Latest
, or$Default
. To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API. If the value is$Latest
, Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is$Default
, Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is$Default
.
Overrides
— (Array<map>
)Any properties that you specify override the same properties in the launch template.
InstanceType
— (String
)The instance type, such as
m3.xlarge
. You must specify an instance type that is supported in your requested Region and Availability Zones. For more information, see Instance types in the Amazon EC2 User Guide for Linux Instances.You can specify up to 40 instance types per Auto Scaling group.
WeightedCapacity
— (String
)If you provide a list of instance types to use, you can specify the number of capacity units provided by each instance type in terms of virtual CPUs, memory, storage, throughput, or other relative performance characteristic. When a Spot or On-Demand Instance is launched, the capacity units count toward the desired capacity. Amazon EC2 Auto Scaling launches instances until the desired capacity is totally fulfilled, even if this results in an overage. For example, if there are two units remaining to fulfill capacity, and Amazon EC2 Auto Scaling can only launch an instance with a
WeightedCapacity
of five units, the instance is launched, and the desired capacity is exceeded by three units. For more information, see Configure an Auto Scaling group to use instance weights in the Amazon EC2 Auto Scaling User Guide. Value must be in the range of 1–999.If you specify a value for
WeightedCapacity
for one instance type, you must specify a value forWeightedCapacity
for all of them.Every Auto Scaling group has three size parameters (
DesiredCapacity
,MaxSize
, andMinSize
). Usually, you set these sizes based on a specific number of instances. However, if you configure a mixed instances policy that defines weights for the instance types, you must specify these sizes with the same units that you use for weighting instances.LaunchTemplateSpecification
— (map
)Provides a launch template for the specified instance type or set of instance requirements. For example, some instance types might require a launch template with a different AMI. If not provided, Amazon EC2 Auto Scaling uses the launch template that's specified in the
LaunchTemplate
definition. For more information, see Specifying a different launch template for an instance type in the Amazon EC2 Auto Scaling User Guide.You can specify up to 20 launch templates per Auto Scaling group. The launch templates specified in the overrides and in the
LaunchTemplate
definition count towards this limit.LaunchTemplateId
— (String
)The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.LaunchTemplateName
— (String
)The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.Version
— (String
)The version number,
$Latest
, or$Default
. To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API. If the value is$Latest
, Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is$Default
, Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is$Default
.
InstanceRequirements
— (map
)The instance requirements. Amazon EC2 Auto Scaling uses your specified requirements to identify instance types. Then, it uses your On-Demand and Spot allocation strategies to launch instances from these instance types.
You can specify up to four separate sets of instance requirements per Auto Scaling group. This is useful for provisioning instances from different Amazon Machine Images (AMIs) in the same Auto Scaling group. To do this, create the AMIs and create a new launch template for each AMI. Then, create a compatible set of instance requirements for each launch template.
Note: If you specifyInstanceRequirements
, you can't specifyInstanceType
.VCpuCount
— required — (map
)The minimum and maximum number of vCPUs for an instance type.
Min
— required — (Integer
)The minimum number of vCPUs.
Max
— (Integer
)The maximum number of vCPUs.
MemoryMiB
— required — (map
)The minimum and maximum instance memory size for an instance type, in MiB.
Min
— required — (Integer
)The memory minimum in MiB.
Max
— (Integer
)The memory maximum in MiB.
CpuManufacturers
— (Array<String>
)Lists which specific CPU manufacturers to include.
-
For instance types with Intel CPUs, specify
intel
. -
For instance types with AMD CPUs, specify
amd
. -
For instance types with Amazon Web Services CPUs, specify
amazon-web-services
.
Note: Don't confuse the CPU hardware manufacturer with the CPU hardware architecture. Instances will be launched with a compatible CPU architecture based on the Amazon Machine Image (AMI) that you specify in your launch template.Default: Any manufacturer
-
MemoryGiBPerVCpu
— (map
)The minimum and maximum amount of memory per vCPU for an instance type, in GiB.
Default: No minimum or maximum limits
Min
— (Float
)The memory minimum in GiB.
Max
— (Float
)The memory maximum in GiB.
ExcludedInstanceTypes
— (Array<String>
)The instance types to exclude. You can use strings with one or more wild cards, represented by an asterisk (
*
), to exclude an instance family, type, size, or generation. The following are examples:m5.8xlarge
,c5*.*
,m5a.*
,r*
,*3*
.For example, if you specify
c5*
, you are excluding the entire C5 instance family, which includes all C5a and C5n instance types. If you specifym5a.*
, Amazon EC2 Auto Scaling will exclude all the M5a instance types, but not the M5n instance types.Note: If you specifyExcludedInstanceTypes
, you can't specifyAllowedInstanceTypes
.Default: No excluded instance types
InstanceGenerations
— (Array<String>
)Indicates whether current or previous generation instance types are included.
-
For current generation instance types, specify
current
. The current generation includes EC2 instance types currently recommended for use. This typically includes the latest two to three generations in each instance family. For more information, see Instance types in the Amazon EC2 User Guide for Linux Instances. -
For previous generation instance types, specify
previous
.
Default: Any current or previous generation
-
SpotMaxPricePercentageOverLowestPrice
— (Integer
)[Price protection] The price protection threshold for Spot Instances, as a percentage higher than an identified Spot price. The identified Spot price is the price of the lowest priced current generation C, M, or R instance type with your specified attributes. If no current generation C, M, or R instance type matches your attributes, then the identified price is from either the lowest priced current generation instance types or, failing that, the lowest priced previous generation instance types that match your attributes. When Amazon EC2 Auto Scaling selects instance types with your attributes, we will exclude instance types whose price exceeds your specified threshold.
The parameter accepts an integer, which Amazon EC2 Auto Scaling interprets as a percentage.
If you set
DesiredCapacityType
tovcpu
ormemory-mib
, the price protection threshold is based on the per-vCPU or per-memory price instead of the per instance price.Note: Only one ofSpotMaxPricePercentageOverLowestPrice
orMaxSpotPriceAsPercentageOfOptimalOnDemandPrice
can be specified. If you don't specify either, Amazon EC2 Auto Scaling will automatically apply optimal price protection to consistently select from a wide range of instance types. To indicate no price protection threshold for Spot Instances, meaning you want to consider all instance types that match your attributes, include one of these parameters and specify a high value, such as999999
.MaxSpotPriceAsPercentageOfOptimalOnDemandPrice
— (Integer
)[Price protection] The price protection threshold for Spot Instances, as a percentage of an identified On-Demand price. The identified On-Demand price is the price of the lowest priced current generation C, M, or R instance type with your specified attributes. If no current generation C, M, or R instance type matches your attributes, then the identified price is from either the lowest priced current generation instance types or, failing that, the lowest priced previous generation instance types that match your attributes. When Amazon EC2 Auto Scaling selects instance types with your attributes, we will exclude instance types whose price exceeds your specified threshold.
The parameter accepts an integer, which Amazon EC2 Auto Scaling interprets as a percentage.
If you set
DesiredCapacityType
tovcpu
ormemory-mib
, the price protection threshold is based on the per-vCPU or per-memory price instead of the per instance price.Note: Only one ofSpotMaxPricePercentageOverLowestPrice
orMaxSpotPriceAsPercentageOfOptimalOnDemandPrice
can be specified. If you don't specify either, Amazon EC2 Auto Scaling will automatically apply optimal price protection to consistently select from a wide range of instance types. To indicate no price protection threshold for Spot Instances, meaning you want to consider all instance types that match your attributes, include one of these parameters and specify a high value, such as999999
.OnDemandMaxPricePercentageOverLowestPrice
— (Integer
)[Price protection] The price protection threshold for On-Demand Instances, as a percentage higher than an identified On-Demand price. The identified On-Demand price is the price of the lowest priced current generation C, M, or R instance type with your specified attributes. If no current generation C, M, or R instance type matches your attributes, then the identified price is from either the lowest priced current generation instance types or, failing that, the lowest priced previous generation instance types that match your attributes. When Amazon EC2 Auto Scaling selects instance types with your attributes, we will exclude instance types whose price exceeds your specified threshold.
The parameter accepts an integer, which Amazon EC2 Auto Scaling interprets as a percentage.
To turn off price protection, specify a high value, such as
999999
.If you set
DesiredCapacityType
tovcpu
ormemory-mib
, the price protection threshold is applied based on the per-vCPU or per-memory price instead of the per instance price.Default:
20
BareMetal
— (String
)Indicates whether bare metal instance types are included, excluded, or required.
Default:
Possible values include:excluded
"included"
"excluded"
"required"
BurstablePerformance
— (String
)Indicates whether burstable performance instance types are included, excluded, or required. For more information, see Burstable performance instances in the Amazon EC2 User Guide for Linux Instances.
Default:
Possible values include:excluded
"included"
"excluded"
"required"
RequireHibernateSupport
— (Boolean
)Indicates whether instance types must provide On-Demand Instance hibernation support.
Default:
false
NetworkInterfaceCount
— (map
)The minimum and maximum number of network interfaces for an instance type.
Default: No minimum or maximum limits
Min
— (Integer
)The minimum number of network interfaces.
Max
— (Integer
)The maximum number of network interfaces.
LocalStorage
— (String
)Indicates whether instance types with instance store volumes are included, excluded, or required. For more information, see Amazon EC2 instance store in the Amazon EC2 User Guide for Linux Instances.
Default:
Possible values include:included
"included"
"excluded"
"required"
LocalStorageTypes
— (Array<String>
)Indicates the type of local storage that is required.
-
For instance types with hard disk drive (HDD) storage, specify
hdd
. -
For instance types with solid state drive (SSD) storage, specify
ssd
.
Default: Any local storage type
-
TotalLocalStorageGB
— (map
)The minimum and maximum total local storage size for an instance type, in GB.
Default: No minimum or maximum limits
Min
— (Float
)The storage minimum in GB.
Max
— (Float
)The storage maximum in GB.
BaselineEbsBandwidthMbps
— (map
)The minimum and maximum baseline bandwidth performance for an instance type, in Mbps. For more information, see Amazon EBS–optimized instances in the Amazon EC2 User Guide for Linux Instances.
Default: No minimum or maximum limits
Min
— (Integer
)The minimum value in Mbps.
Max
— (Integer
)The maximum value in Mbps.
AcceleratorTypes
— (Array<String>
)Lists the accelerator types that must be on an instance type.
-
For instance types with GPU accelerators, specify
gpu
. -
For instance types with FPGA accelerators, specify
fpga
. -
For instance types with inference accelerators, specify
inference
.
Default: Any accelerator type
-
AcceleratorCount
— (map
)The minimum and maximum number of accelerators (GPUs, FPGAs, or Amazon Web Services Inferentia chips) for an instance type.
To exclude accelerator-enabled instance types, set
Max
to0
.Default: No minimum or maximum limits
Min
— (Integer
)The minimum value.
Max
— (Integer
)The maximum value.
AcceleratorManufacturers
— (Array<String>
)Indicates whether instance types must have accelerators by specific manufacturers.
-
For instance types with NVIDIA devices, specify
nvidia
. -
For instance types with AMD devices, specify
amd
. -
For instance types with Amazon Web Services devices, specify
amazon-web-services
. -
For instance types with Xilinx devices, specify
xilinx
.
Default: Any manufacturer
-
AcceleratorNames
— (Array<String>
)Lists the accelerators that must be on an instance type.
-
For instance types with NVIDIA A100 GPUs, specify
a100
. -
For instance types with NVIDIA V100 GPUs, specify
v100
. -
For instance types with NVIDIA K80 GPUs, specify
k80
. -
For instance types with NVIDIA T4 GPUs, specify
t4
. -
For instance types with NVIDIA M60 GPUs, specify
m60
. -
For instance types with AMD Radeon Pro V520 GPUs, specify
radeon-pro-v520
. -
For instance types with Xilinx VU9P FPGAs, specify
vu9p
.
Default: Any accelerator
-
AcceleratorTotalMemoryMiB
— (map
)The minimum and maximum total memory size for the accelerators on an instance type, in MiB.
Default: No minimum or maximum limits
Min
— (Integer
)The memory minimum in MiB.
Max
— (Integer
)The memory maximum in MiB.
NetworkBandwidthGbps
— (map
)The minimum and maximum amount of network bandwidth, in gigabits per second (Gbps).
Default: No minimum or maximum limits
Min
— (Float
)The minimum amount of network bandwidth, in gigabits per second (Gbps).
Max
— (Float
)The maximum amount of network bandwidth, in gigabits per second (Gbps).
AllowedInstanceTypes
— (Array<String>
)The instance types to apply your specified attributes against. All other instance types are ignored, even if they match your specified attributes.
You can use strings with one or more wild cards, represented by an asterisk (
*
), to allow an instance type, size, or generation. The following are examples:m5.8xlarge
,c5*.*
,m5a.*
,r*
,*3*
.For example, if you specify
c5*
, Amazon EC2 Auto Scaling will allow the entire C5 instance family, which includes all C5a and C5n instance types. If you specifym5a.*
, Amazon EC2 Auto Scaling will allow all the M5a instance types, but not the M5n instance types.Note: If you specifyAllowedInstanceTypes
, you can't specifyExcludedInstanceTypes
.Default: All instance types
InstancesDistribution
— (map
)The instances distribution.
OnDemandAllocationStrategy
— (String
)The allocation strategy to apply to your On-Demand Instances when they are launched. Possible instance types are determined by the launch template overrides that you specify.
The following lists the valid values:
- lowest-price
-
Uses price to determine which instance types are the highest priority, launching the lowest priced instance types within an Availability Zone first. This is the default value for Auto Scaling groups that specify InstanceRequirements.
- prioritized
-
You set the order of instance types for the launch template overrides from highest to lowest priority (from first to last in the list). Amazon EC2 Auto Scaling launches your highest priority instance types first. If all your On-Demand capacity cannot be fulfilled using your highest priority instance type, then Amazon EC2 Auto Scaling launches the remaining capacity using the second priority instance type, and so on. This is the default value for Auto Scaling groups that don't specify InstanceRequirements and cannot be used for groups that do.
OnDemandBaseCapacity
— (Integer
)The minimum amount of the Auto Scaling group's capacity that must be fulfilled by On-Demand Instances. This base portion is launched first as your group scales.
This number has the same unit of measurement as the group's desired capacity. If you change the default unit of measurement (number of instances) by specifying weighted capacity values in your launch template overrides list, or by changing the default desired capacity type setting of the group, you must specify this number using the same unit of measurement.
Default: 0
OnDemandPercentageAboveBaseCapacity
— (Integer
)Controls the percentages of On-Demand Instances and Spot Instances for your additional capacity beyond
OnDemandBaseCapacity
. Expressed as a number (for example, 20 specifies 20% On-Demand Instances, 80% Spot Instances). If set to 100, only On-Demand Instances are used.Default: 100
SpotAllocationStrategy
— (String
)The allocation strategy to apply to your Spot Instances when they are launched. Possible instance types are determined by the launch template overrides that you specify.
The following lists the valid values:
- capacity-optimized
-
Requests Spot Instances using pools that are optimally chosen based on the available Spot capacity. This strategy has the lowest risk of interruption. To give certain instance types a higher chance of launching first, use
capacity-optimized-prioritized
. - capacity-optimized-prioritized
-
You set the order of instance types for the launch template overrides from highest to lowest priority (from first to last in the list). Amazon EC2 Auto Scaling honors the instance type priorities on a best effort basis but optimizes for capacity first. Note that if the On-Demand allocation strategy is set to
prioritized
, the same priority is applied when fulfilling On-Demand capacity. This is not a valid value for Auto Scaling groups that specify InstanceRequirements. - lowest-price
-
Requests Spot Instances using the lowest priced pools within an Availability Zone, across the number of Spot pools that you specify for the
SpotInstancePools
property. To ensure that your desired capacity is met, you might receive Spot Instances from several pools. This is the default value, but it might lead to high interruption rates because this strategy only considers instance price and not available capacity. - price-capacity-optimized (recommended)
-
The price and capacity optimized allocation strategy looks at both price and capacity to select the Spot Instance pools that are the least likely to be interrupted and have the lowest possible price.
SpotInstancePools
— (Integer
)The number of Spot Instance pools across which to allocate your Spot Instances. The Spot pools are determined from the different instance types in the overrides. Valid only when the
SpotAllocationStrategy
islowest-price
. Value must be in the range of 1–20.Default: 2
SpotMaxPrice
— (String
)The maximum price per unit hour that you are willing to pay for a Spot Instance. If your maximum price is lower than the Spot price for the instance types that you selected, your Spot Instances are not launched. We do not recommend specifying a maximum price because it can lead to increased interruptions. When Spot Instances launch, you pay the current Spot price. To remove a maximum price that you previously set, include the property but specify an empty string ("") for the value.
If you specify a maximum price, your instances will be interrupted more frequently than if you do not specify one.
Valid Range: Minimum value of 0.001
MinSize
— required — (Integer
)The minimum size of the group.
MaxSize
— required — (Integer
)The maximum size of the group.
DesiredCapacity
— required — (Integer
)The desired size of the group.
PredictedCapacity
— (Integer
)The predicted capacity of the group when it has a predictive scaling policy.
DefaultCooldown
— required — (Integer
)The duration of the default cooldown period, in seconds.
AvailabilityZones
— required — (Array<String>
)One or more Availability Zones for the group.
LoadBalancerNames
— (Array<String>
)One or more load balancers associated with the group.
TargetGroupARNs
— (Array<String>
)The Amazon Resource Names (ARN) of the target groups for your load balancer.
HealthCheckType
— required — (String
)A comma-separated value string of one or more health check types.
HealthCheckGracePeriod
— (Integer
)The duration of the health check grace period, in seconds.
Instances
— (Array<map>
)The EC2 instances associated with the group.
InstanceId
— required — (String
)The ID of the instance.
InstanceType
— (String
)The instance type of the EC2 instance.
AvailabilityZone
— required — (String
)The Availability Zone in which the instance is running.
LifecycleState
— required — (String
)A description of the current lifecycle state. The
Possible values include:Quarantined
state is not used. For more information, see Amazon EC2 Auto Scaling instance lifecycle in the Amazon EC2 Auto Scaling User Guide."Pending"
"Pending:Wait"
"Pending:Proceed"
"Quarantined"
"InService"
"Terminating"
"Terminating:Wait"
"Terminating:Proceed"
"Terminated"
"Detaching"
"Detached"
"EnteringStandby"
"Standby"
"Warmed:Pending"
"Warmed:Pending:Wait"
"Warmed:Pending:Proceed"
"Warmed:Terminating"
"Warmed:Terminating:Wait"
"Warmed:Terminating:Proceed"
"Warmed:Terminated"
"Warmed:Stopped"
"Warmed:Running"
"Warmed:Hibernated"
HealthStatus
— required — (String
)The last reported health status of the instance.
Healthy
means that the instance is healthy and should remain in service.Unhealthy
means that the instance is unhealthy and that Amazon EC2 Auto Scaling should terminate and replace it.LaunchConfigurationName
— (String
)The launch configuration associated with the instance.
LaunchTemplate
— (map
)The launch template for the instance.
LaunchTemplateId
— (String
)The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.LaunchTemplateName
— (String
)The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.Version
— (String
)The version number,
$Latest
, or$Default
. To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API. If the value is$Latest
, Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is$Default
, Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is$Default
.
ProtectedFromScaleIn
— required — (Boolean
)Indicates whether the instance is protected from termination by Amazon EC2 Auto Scaling when scaling in.
WeightedCapacity
— (String
)The number of capacity units contributed by the instance based on its instance type.
Valid Range: Minimum value of 1. Maximum value of 999.
CreatedTime
— required — (Date
)The date and time the group was created.
SuspendedProcesses
— (Array<map>
)The suspended processes associated with the group.
ProcessName
— (String
)The name of the suspended process.
SuspensionReason
— (String
)The reason that the process was suspended.
PlacementGroup
— (String
)The name of the placement group into which to launch your instances, if any.
VPCZoneIdentifier
— (String
)One or more subnet IDs, if applicable, separated by commas.
EnabledMetrics
— (Array<map>
)The metrics enabled for the group.
Metric
— (String
)One of the following metrics:
-
GroupMinSize
-
GroupMaxSize
-
GroupDesiredCapacity
-
GroupInServiceInstances
-
GroupPendingInstances
-
GroupStandbyInstances
-
GroupTerminatingInstances
-
GroupTotalInstances
-
GroupInServiceCapacity
-
GroupPendingCapacity
-
GroupStandbyCapacity
-
GroupTerminatingCapacity
-
GroupTotalCapacity
-
WarmPoolDesiredCapacity
-
WarmPoolWarmedCapacity
-
WarmPoolPendingCapacity
-
WarmPoolTerminatingCapacity
-
WarmPoolTotalCapacity
-
GroupAndWarmPoolDesiredCapacity
-
GroupAndWarmPoolTotalCapacity
For more information, see Amazon CloudWatch metrics for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
-
Granularity
— (String
)The granularity of the metric. The only valid value is
1Minute
.
Status
— (String
)The current state of the group when the DeleteAutoScalingGroup operation is in progress.
Tags
— (Array<map>
)The tags for the group.
ResourceId
— (String
)The name of the group.
ResourceType
— (String
)The type of resource. The only supported value is
auto-scaling-group
.Key
— (String
)The tag key.
Value
— (String
)The tag value.
PropagateAtLaunch
— (Boolean
)Determines whether the tag is added to new instances as they are launched in the group.
TerminationPolicies
— (Array<String>
)The termination policies for the group.
NewInstancesProtectedFromScaleIn
— (Boolean
)Indicates whether newly launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in.
ServiceLinkedRoleARN
— (String
)The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other Amazon Web Services on your behalf.
MaxInstanceLifetime
— (Integer
)The maximum amount of time, in seconds, that an instance can be in service.
Valid Range: Minimum value of 0.
CapacityRebalance
— (Boolean
)Indicates whether Capacity Rebalancing is enabled.
WarmPoolConfiguration
— (map
)The warm pool for the group.
MaxGroupPreparedCapacity
— (Integer
)The maximum number of instances that are allowed to be in the warm pool or in any state except
Terminated
for the Auto Scaling group.MinSize
— (Integer
)The minimum number of instances to maintain in the warm pool.
PoolState
— (String
)The instance state to transition to after the lifecycle actions are complete.
Possible values include:"Stopped"
"Running"
"Hibernated"
Status
— (String
)The status of a warm pool that is marked for deletion.
Possible values include:"PendingDelete"
InstanceReusePolicy
— (map
)The instance reuse policy.
ReuseOnScaleIn
— (Boolean
)Specifies whether instances in the Auto Scaling group can be returned to the warm pool on scale in.
WarmPoolSize
— (Integer
)The current size of the warm pool.
Context
— (String
)Reserved.
DesiredCapacityType
— (String
)The unit of measurement for the value specified for desired capacity. Amazon EC2 Auto Scaling supports
DesiredCapacityType
for attribute-based instance type selection only.DefaultInstanceWarmup
— (Integer
)The duration of the default instance warmup, in seconds.
TrafficSources
— (Array<map>
)The traffic sources associated with this Auto Scaling group.
Identifier
— required — (String
)Identifies the traffic source.
For Application Load Balancers, Gateway Load Balancers, Network Load Balancers, and VPC Lattice, this will be the Amazon Resource Name (ARN) for a target group in this account and Region. For Classic Load Balancers, this will be the name of the Classic Load Balancer in this account and Region.
For example:
-
Application Load Balancer ARN:
arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/1234567890123456
-
Classic Load Balancer name:
my-classic-load-balancer
-
VPC Lattice ARN:
arn:aws:vpc-lattice:us-west-2:123456789012:targetgroup/tg-1234567890123456
To get the ARN of a target group for a Application Load Balancer, Gateway Load Balancer, or Network Load Balancer, or the name of a Classic Load Balancer, use the Elastic Load Balancing DescribeTargetGroups and DescribeLoadBalancers API operations.
To get the ARN of a target group for VPC Lattice, use the VPC Lattice GetTargetGroup API operation.
-
Type
— (String
)Provides additional context for the value of
Identifier
.The following lists the valid values:
-
elb
ifIdentifier
is the name of a Classic Load Balancer. -
elbv2
ifIdentifier
is the ARN of an Application Load Balancer, Gateway Load Balancer, or Network Load Balancer target group. -
vpc-lattice
ifIdentifier
is the ARN of a VPC Lattice target group.
Required if the identifier is the name of a Classic Load Balancer.
-
InstanceMaintenancePolicy
— (map
)An instance maintenance policy.
MinHealthyPercentage
— (Integer
)Specifies the lower threshold as a percentage of the desired capacity of the Auto Scaling group. It represents the minimum percentage of the group to keep in service, healthy, and ready to use to support your workload when replacing instances. Value range is 0 to 100. To clear a previously set value, specify a value of
-1
.MaxHealthyPercentage
— (Integer
)Specifies the upper threshold as a percentage of the desired capacity of the Auto Scaling group. It represents the maximum percentage of the group that can be in service and healthy, or pending, to support your workload when replacing instances. Value range is 100 to 200. To clear a previously set value, specify a value of
-1
.Both
MinHealthyPercentage
andMaxHealthyPercentage
must be specified, and the difference between them cannot be greater than 100. A large range increases the number of instances that can be replaced at the same time.
NextToken
— (String
)A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
-
(AWS.Response)
—
Returns:
describeAutoScalingInstances(params = {}, callback) ⇒ AWS.Request
Gets information about the Auto Scaling instances in the account and Region.
Service Reference:
Examples:
To describe one or more Auto Scaling instances
/* This example describes the specified Auto Scaling instance. */ var params = { InstanceIds: [ "i-05b4f7d5be44822a6" ] }; autoscaling.describeAutoScalingInstances(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { AutoScalingInstances: [ { AutoScalingGroupName: "my-auto-scaling-group", AvailabilityZone: "us-west-2c", HealthStatus: "HEALTHY", InstanceId: "i-05b4f7d5be44822a6", InstanceType: "t3.micro", LaunchConfigurationName: "my-launch-config", LifecycleState: "InService", ProtectedFromScaleIn: false } ] } */ });
Calling the describeAutoScalingInstances operation
var params = { InstanceIds: [ 'STRING_VALUE', /* more items */ ], MaxRecords: 'NUMBER_VALUE', NextToken: 'STRING_VALUE' }; autoscaling.describeAutoScalingInstances(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: {})
—
InstanceIds
— (Array<String>
)The IDs of the instances. If you omit this property, all Auto Scaling instances are described. If you specify an ID that does not exist, it is ignored with no error.
Array Members: Maximum number of 50 items.
MaxRecords
— (Integer
)The maximum number of items to return with this call. The default value is
50
and the maximum value is50
.NextToken
— (String
)The token for the next set of items to return. (You received this token from a previous 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. Thedata
object has the following properties:AutoScalingInstances
— (Array<map>
)The instances.
InstanceId
— required — (String
)The ID of the instance.
InstanceType
— (String
)The instance type of the EC2 instance.
AutoScalingGroupName
— required — (String
)The name of the Auto Scaling group for the instance.
AvailabilityZone
— required — (String
)The Availability Zone for the instance.
LifecycleState
— required — (String
)The lifecycle state for the instance. The
Quarantined
state is not used. For more information, see Amazon EC2 Auto Scaling instance lifecycle in the Amazon EC2 Auto Scaling User Guide.Valid values:
Pending
|Pending:Wait
|Pending:Proceed
|Quarantined
|InService
|Terminating
|Terminating:Wait
|Terminating:Proceed
|Terminated
|Detaching
|Detached
|EnteringStandby
|Standby
|Warmed:Pending
|Warmed:Pending:Wait
|Warmed:Pending:Proceed
|Warmed:Terminating
|Warmed:Terminating:Wait
|Warmed:Terminating:Proceed
|Warmed:Terminated
|Warmed:Stopped
|Warmed:Running
HealthStatus
— required — (String
)The last reported health status of this instance.
Healthy
means that the instance is healthy and should remain in service.Unhealthy
means that the instance is unhealthy and Amazon EC2 Auto Scaling should terminate and replace it.LaunchConfigurationName
— (String
)The launch configuration used to launch the instance. This value is not available if you attached the instance to the Auto Scaling group.
LaunchTemplate
— (map
)The launch template for the instance.
LaunchTemplateId
— (String
)The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.LaunchTemplateName
— (String
)The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.Version
— (String
)The version number,
$Latest
, or$Default
. To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API. If the value is$Latest
, Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is$Default
, Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is$Default
.
ProtectedFromScaleIn
— required — (Boolean
)Indicates whether the instance is protected from termination by Amazon EC2 Auto Scaling when scaling in.
WeightedCapacity
— (String
)The number of capacity units contributed by the instance based on its instance type.
Valid Range: Minimum value of 1. Maximum value of 999.
NextToken
— (String
)A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
-
(AWS.Response)
—
Returns:
describeAutoScalingNotificationTypes(params = {}, callback) ⇒ AWS.Request
Describes the notification types that are supported by Amazon EC2 Auto Scaling.
Service Reference:
Examples:
To describe the Auto Scaling notification types
/* This example describes the available notification types. */ var params = {}; autoscaling.describeAutoScalingNotificationTypes(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { AutoScalingNotificationTypes: [ "autoscaling:EC2_INSTANCE_LAUNCH", "autoscaling:EC2_INSTANCE_LAUNCH_ERROR", "autoscaling:EC2_INSTANCE_TERMINATE", "autoscaling:EC2_INSTANCE_TERMINATE_ERROR", "autoscaling:TEST_NOTIFICATION" ] } */ });
Calling the describeAutoScalingNotificationTypes operation
autoscaling.describeAutoScalingNotificationTypes(function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Parameters:
- params (Object) (defaults to: {})
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:AutoScalingNotificationTypes
— (Array<String>
)The notification types.
-
(AWS.Response)
—
Returns:
describeInstanceRefreshes(params = {}, callback) ⇒ AWS.Request
Gets information about the instance refreshes for the specified Auto Scaling group from the previous six weeks.
This operation is part of the instance refresh feature in Amazon EC2 Auto Scaling, which helps you update instances in your Auto Scaling group after you make configuration changes.
To help you determine the status of an instance refresh, Amazon EC2 Auto Scaling returns information about the instance refreshes you previously initiated, including their status, start time, end time, the percentage of the instance refresh that is complete, and the number of instances remaining to update before the instance refresh is complete. If a rollback is initiated while an instance refresh is in progress, Amazon EC2 Auto Scaling also returns information about the rollback of the instance refresh.
Service Reference:
Examples:
To list instance refreshes
/* This example describes the instance refreshes for the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group" }; autoscaling.describeInstanceRefreshes(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { InstanceRefreshes: [ { AutoScalingGroupName: "my-auto-scaling-group", InstanceRefreshId: "08b91cf7-8fa6-48af-b6a6-d227f40f1b9b", InstancesToUpdate: 0, PercentageComplete: 50, Preferences: { AlarmSpecification: { Alarms: [ "my-alarm" ] }, AutoRollback: true, InstanceWarmup: 200, MaxHealthyPercentage: 120, MinHealthyPercentage: 90, ScaleInProtectedInstances: "Ignore", SkipMatching: false, StandbyInstances: "Ignore" }, StartTime: <Date Representation>, Status: "InProgress", StatusReason: "Waiting for instances to warm up before continuing. For example: i-0645704820a8e83ff is warming up." }, { AutoScalingGroupName: "my-auto-scaling-group", EndTime: <Date Representation>, InstanceRefreshId: "0e151305-1e57-4a32-a256-1fd14157c5ec", InstancesToUpdate: 0, PercentageComplete: 100, Preferences: { AlarmSpecification: { Alarms: [ "my-alarm" ] }, AutoRollback: true, InstanceWarmup: 200, MaxHealthyPercentage: 120, MinHealthyPercentage: 90, ScaleInProtectedInstances: "Ignore", SkipMatching: false, StandbyInstances: "Ignore" }, StartTime: <Date Representation>, Status: "Successful" } ] } */ });
Calling the describeInstanceRefreshes operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ InstanceRefreshIds: [ 'STRING_VALUE', /* more items */ ], MaxRecords: 'NUMBER_VALUE', NextToken: 'STRING_VALUE' }; autoscaling.describeInstanceRefreshes(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
InstanceRefreshIds
— (Array<String>
)One or more instance refresh IDs.
NextToken
— (String
)The token for the next set of items to return. (You received this token from a previous call.)
MaxRecords
— (Integer
)The maximum number of items to return with this call. The default value is
50
and the maximum value is100
.
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:InstanceRefreshes
— (Array<map>
)The instance refreshes for the specified group, sorted by creation timestamp in descending order.
InstanceRefreshId
— (String
)The instance refresh ID.
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
Status
— (String
)The current status for the instance refresh operation:
-
Pending
- The request was created, but the instance refresh has not started. -
InProgress
- An instance refresh is in progress. -
Successful
- An instance refresh completed successfully. -
Failed
- An instance refresh failed to complete. You can troubleshoot using the status reason and the scaling activities. -
Cancelling
- An ongoing instance refresh is being cancelled. -
Cancelled
- The instance refresh is cancelled. -
RollbackInProgress
- An instance refresh is being rolled back. -
RollbackFailed
- The rollback failed to complete. You can troubleshoot using the status reason and the scaling activities. -
RollbackSuccessful
- The rollback completed successfully.
"Pending"
"InProgress"
"Successful"
"Failed"
"Cancelling"
"Cancelled"
"RollbackInProgress"
"RollbackFailed"
"RollbackSuccessful"
-
StatusReason
— (String
)The explanation for the specific status assigned to this operation.
StartTime
— (Date
)The date and time at which the instance refresh began.
EndTime
— (Date
)The date and time at which the instance refresh ended.
PercentageComplete
— (Integer
)The percentage of the instance refresh that is complete. For each instance replacement, Amazon EC2 Auto Scaling tracks the instance's health status and warm-up time. When the instance's health status changes to healthy and the specified warm-up time passes, the instance is considered updated and is added to the percentage complete.
Note:PercentageComplete
does not include instances that are replaced during a rollback. This value gradually goes back down to zero during a rollback.InstancesToUpdate
— (Integer
)The number of instances remaining to update before the instance refresh is complete.
Note: If you roll back the instance refresh,InstancesToUpdate
shows you the number of instances that were not yet updated by the instance refresh. Therefore, these instances don't need to be replaced as part of the rollback.ProgressDetails
— (map
)Additional progress details for an Auto Scaling group that has a warm pool.
LivePoolProgress
— (map
)Reports progress on replacing instances that are in the Auto Scaling group.
PercentageComplete
— (Integer
)The percentage of instances in the Auto Scaling group that have been replaced. For each instance replacement, Amazon EC2 Auto Scaling tracks the instance's health status and warm-up time. When the instance's health status changes to healthy and the specified warm-up time passes, the instance is considered updated and is added to the percentage complete.
InstancesToUpdate
— (Integer
)The number of instances remaining to update.
WarmPoolProgress
— (map
)Reports progress on replacing instances that are in the warm pool.
PercentageComplete
— (Integer
)The percentage of instances in the warm pool that have been replaced. For each instance replacement, Amazon EC2 Auto Scaling tracks the instance's health status and warm-up time. When the instance's health status changes to healthy and the specified warm-up time passes, the instance is considered updated and is added to the percentage complete.
InstancesToUpdate
— (Integer
)The number of instances remaining to update.
Preferences
— (map
)The preferences for an instance refresh.
MinHealthyPercentage
— (Integer
)Specifies the minimum percentage of the group to keep in service, healthy, and ready to use to support your workload to allow the operation to continue. The value is expressed as a percentage of the desired capacity of the Auto Scaling group. Value range is 0 to 100.
If you do not specify this property, the default is 90 percent, or the percentage set in the instance maintenance policy for the Auto Scaling group, if defined.
InstanceWarmup
— (Integer
)A time period, in seconds, during which an instance refresh waits before moving on to replacing the next instance after a new instance enters the
InService
state.This property is not required for normal usage. Instead, use the
DefaultInstanceWarmup
property of the Auto Scaling group. TheInstanceWarmup
andDefaultInstanceWarmup
properties work the same way. Only specify this property if you must override theDefaultInstanceWarmup
property.If you do not specify this property, the instance warmup by default is the value of the
DefaultInstanceWarmup
property, if defined (which is recommended in all cases), or theHealthCheckGracePeriod
property otherwise.CheckpointPercentages
— (Array<Integer>
)(Optional) Threshold values for each checkpoint in ascending order. Each number must be unique. To replace all instances in the Auto Scaling group, the last number in the array must be
100
.For usage examples, see Add checkpoints to an instance refresh in the Amazon EC2 Auto Scaling User Guide.
CheckpointDelay
— (Integer
)(Optional) The amount of time, in seconds, to wait after a checkpoint before continuing. This property is optional, but if you specify a value for it, you must also specify a value for
CheckpointPercentages
. If you specify a value forCheckpointPercentages
and not forCheckpointDelay
, theCheckpointDelay
defaults to3600
(1 hour).SkipMatching
— (Boolean
)(Optional) Indicates whether skip matching is enabled. If enabled (
true
), then Amazon EC2 Auto Scaling skips replacing instances that match the desired configuration. If no desired configuration is specified, then it skips replacing instances that have the same launch template and instance types that the Auto Scaling group was using before the start of the instance refresh. The default isfalse
.For more information, see Use an instance refresh with skip matching in the Amazon EC2 Auto Scaling User Guide.
AutoRollback
— (Boolean
)(Optional) Indicates whether to roll back the Auto Scaling group to its previous configuration if the instance refresh fails or a CloudWatch alarm threshold is met. The default is
false
.A rollback is not supported in the following situations:
-
There is no desired configuration specified for the instance refresh.
-
The Auto Scaling group has a launch template that uses an Amazon Web Services Systems Manager parameter instead of an AMI ID for the
ImageId
property. -
The Auto Scaling group uses the launch template's
$Latest
or$Default
version.
For more information, see Undo changes with a rollback in the Amazon EC2 Auto Scaling User Guide.
-
ScaleInProtectedInstances
— (String
)Choose the behavior that you want Amazon EC2 Auto Scaling to use if instances protected from scale in are found.
The following lists the valid values:
- Refresh
-
Amazon EC2 Auto Scaling replaces instances that are protected from scale in.
- Ignore
-
Amazon EC2 Auto Scaling ignores instances that are protected from scale in and continues to replace instances that are not protected.
- Wait (default)
-
Amazon EC2 Auto Scaling waits one hour for you to remove scale-in protection. Otherwise, the instance refresh will fail.
"Refresh"
"Ignore"
"Wait"
StandbyInstances
— (String
)Choose the behavior that you want Amazon EC2 Auto Scaling to use if instances in
Standby
state are found.The following lists the valid values:
- Terminate
-
Amazon EC2 Auto Scaling terminates instances that are in
Standby
. - Ignore
-
Amazon EC2 Auto Scaling ignores instances that are in
Standby
and continues to replace instances that are in theInService
state. - Wait (default)
-
Amazon EC2 Auto Scaling waits one hour for you to return the instances to service. Otherwise, the instance refresh will fail.
"Terminate"
"Ignore"
"Wait"
AlarmSpecification
— (map
)(Optional) The CloudWatch alarm specification. CloudWatch alarms can be used to identify any issues and fail the operation if an alarm threshold is met.
Alarms
— (Array<String>
)The names of one or more CloudWatch alarms to monitor for the instance refresh. You can specify up to 10 alarms.
MaxHealthyPercentage
— (Integer
)Specifies the maximum percentage of the group that can be in service and healthy, or pending, to support your workload when replacing instances. The value is expressed as a percentage of the desired capacity of the Auto Scaling group. Value range is 100 to 200.
If you specify
MaxHealthyPercentage
, you must also specifyMinHealthyPercentage
, and the difference between them cannot be greater than 100. A larger range increases the number of instances that can be replaced at the same time.If you do not specify this property, the default is 100 percent, or the percentage set in the instance maintenance policy for the Auto Scaling group, if defined.
DesiredConfiguration
— (map
)Describes the desired configuration for the instance refresh.
LaunchTemplate
— (map
)Describes the launch template and the version of the launch template that Amazon EC2 Auto Scaling uses to launch Amazon EC2 instances. For more information about launch templates, see Launch templates in the Amazon EC2 Auto Scaling User Guide.
LaunchTemplateId
— (String
)The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.LaunchTemplateName
— (String
)The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.Version
— (String
)The version number,
$Latest
, or$Default
. To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API. If the value is$Latest
, Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is$Default
, Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is$Default
.
MixedInstancesPolicy
— (map
)Use this structure to launch multiple instance types and On-Demand Instances and Spot Instances within a single Auto Scaling group.
A mixed instances policy contains information that Amazon EC2 Auto Scaling can use to launch instances and help optimize your costs. For more information, see Auto Scaling groups with multiple instance types and purchase options in the Amazon EC2 Auto Scaling User Guide.
LaunchTemplate
— (map
)One or more launch templates and the instance types (overrides) that are used to launch EC2 instances to fulfill On-Demand and Spot capacities.
LaunchTemplateSpecification
— (map
)The launch template.
LaunchTemplateId
— (String
)The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.LaunchTemplateName
— (String
)The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.Version
— (String
)The version number,
$Latest
, or$Default
. To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API. If the value is$Latest
, Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is$Default
, Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is$Default
.
Overrides
— (Array<map>
)Any properties that you specify override the same properties in the launch template.
InstanceType
— (String
)The instance type, such as
m3.xlarge
. You must specify an instance type that is supported in your requested Region and Availability Zones. For more information, see Instance types in the Amazon EC2 User Guide for Linux Instances.You can specify up to 40 instance types per Auto Scaling group.
WeightedCapacity
— (String
)If you provide a list of instance types to use, you can specify the number of capacity units provided by each instance type in terms of virtual CPUs, memory, storage, throughput, or other relative performance characteristic. When a Spot or On-Demand Instance is launched, the capacity units count toward the desired capacity. Amazon EC2 Auto Scaling launches instances until the desired capacity is totally fulfilled, even if this results in an overage. For example, if there are two units remaining to fulfill capacity, and Amazon EC2 Auto Scaling can only launch an instance with a
WeightedCapacity
of five units, the instance is launched, and the desired capacity is exceeded by three units. For more information, see Configure an Auto Scaling group to use instance weights in the Amazon EC2 Auto Scaling User Guide. Value must be in the range of 1–999.If you specify a value for
WeightedCapacity
for one instance type, you must specify a value forWeightedCapacity
for all of them.Every Auto Scaling group has three size parameters (
DesiredCapacity
,MaxSize
, andMinSize
). Usually, you set these sizes based on a specific number of instances. However, if you configure a mixed instances policy that defines weights for the instance types, you must specify these sizes with the same units that you use for weighting instances.LaunchTemplateSpecification
— (map
)Provides a launch template for the specified instance type or set of instance requirements. For example, some instance types might require a launch template with a different AMI. If not provided, Amazon EC2 Auto Scaling uses the launch template that's specified in the
LaunchTemplate
definition. For more information, see Specifying a different launch template for an instance type in the Amazon EC2 Auto Scaling User Guide.You can specify up to 20 launch templates per Auto Scaling group. The launch templates specified in the overrides and in the
LaunchTemplate
definition count towards this limit.LaunchTemplateId
— (String
)The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.LaunchTemplateName
— (String
)The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.Version
— (String
)The version number,
$Latest
, or$Default
. To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API. If the value is$Latest
, Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is$Default
, Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is$Default
.
InstanceRequirements
— (map
)The instance requirements. Amazon EC2 Auto Scaling uses your specified requirements to identify instance types. Then, it uses your On-Demand and Spot allocation strategies to launch instances from these instance types.
You can specify up to four separate sets of instance requirements per Auto Scaling group. This is useful for provisioning instances from different Amazon Machine Images (AMIs) in the same Auto Scaling group. To do this, create the AMIs and create a new launch template for each AMI. Then, create a compatible set of instance requirements for each launch template.
Note: If you specifyInstanceRequirements
, you can't specifyInstanceType
.VCpuCount
— required — (map
)The minimum and maximum number of vCPUs for an instance type.
Min
— required — (Integer
)The minimum number of vCPUs.
Max
— (Integer
)The maximum number of vCPUs.
MemoryMiB
— required — (map
)The minimum and maximum instance memory size for an instance type, in MiB.
Min
— required — (Integer
)The memory minimum in MiB.
Max
— (Integer
)The memory maximum in MiB.
CpuManufacturers
— (Array<String>
)Lists which specific CPU manufacturers to include.
-
For instance types with Intel CPUs, specify
intel
. -
For instance types with AMD CPUs, specify
amd
. -
For instance types with Amazon Web Services CPUs, specify
amazon-web-services
.
Note: Don't confuse the CPU hardware manufacturer with the CPU hardware architecture. Instances will be launched with a compatible CPU architecture based on the Amazon Machine Image (AMI) that you specify in your launch template.Default: Any manufacturer
-
MemoryGiBPerVCpu
— (map
)The minimum and maximum amount of memory per vCPU for an instance type, in GiB.
Default: No minimum or maximum limits
Min
— (Float
)The memory minimum in GiB.
Max
— (Float
)The memory maximum in GiB.
ExcludedInstanceTypes
— (Array<String>
)The instance types to exclude. You can use strings with one or more wild cards, represented by an asterisk (
*
), to exclude an instance family, type, size, or generation. The following are examples:m5.8xlarge
,c5*.*
,m5a.*
,r*
,*3*
.For example, if you specify
c5*
, you are excluding the entire C5 instance family, which includes all C5a and C5n instance types. If you specifym5a.*
, Amazon EC2 Auto Scaling will exclude all the M5a instance types, but not the M5n instance types.Note: If you specifyExcludedInstanceTypes
, you can't specifyAllowedInstanceTypes
.Default: No excluded instance types
InstanceGenerations
— (Array<String>
)Indicates whether current or previous generation instance types are included.
-
For current generation instance types, specify
current
. The current generation includes EC2 instance types currently recommended for use. This typically includes the latest two to three generations in each instance family. For more information, see Instance types in the Amazon EC2 User Guide for Linux Instances. -
For previous generation instance types, specify
previous
.
Default: Any current or previous generation
-
SpotMaxPricePercentageOverLowestPrice
— (Integer
)[Price protection] The price protection threshold for Spot Instances, as a percentage higher than an identified Spot price. The identified Spot price is the price of the lowest priced current generation C, M, or R instance type with your specified attributes. If no current generation C, M, or R instance type matches your attributes, then the identified price is from either the lowest priced current generation instance types or, failing that, the lowest priced previous generation instance types that match your attributes. When Amazon EC2 Auto Scaling selects instance types with your attributes, we will exclude instance types whose price exceeds your specified threshold.
The parameter accepts an integer, which Amazon EC2 Auto Scaling interprets as a percentage.
If you set
DesiredCapacityType
tovcpu
ormemory-mib
, the price protection threshold is based on the per-vCPU or per-memory price instead of the per instance price.Note: Only one ofSpotMaxPricePercentageOverLowestPrice
orMaxSpotPriceAsPercentageOfOptimalOnDemandPrice
can be specified. If you don't specify either, Amazon EC2 Auto Scaling will automatically apply optimal price protection to consistently select from a wide range of instance types. To indicate no price protection threshold for Spot Instances, meaning you want to consider all instance types that match your attributes, include one of these parameters and specify a high value, such as999999
.MaxSpotPriceAsPercentageOfOptimalOnDemandPrice
— (Integer
)[Price protection] The price protection threshold for Spot Instances, as a percentage of an identified On-Demand price. The identified On-Demand price is the price of the lowest priced current generation C, M, or R instance type with your specified attributes. If no current generation C, M, or R instance type matches your attributes, then the identified price is from either the lowest priced current generation instance types or, failing that, the lowest priced previous generation instance types that match your attributes. When Amazon EC2 Auto Scaling selects instance types with your attributes, we will exclude instance types whose price exceeds your specified threshold.
The parameter accepts an integer, which Amazon EC2 Auto Scaling interprets as a percentage.
If you set
DesiredCapacityType
tovcpu
ormemory-mib
, the price protection threshold is based on the per-vCPU or per-memory price instead of the per instance price.Note: Only one ofSpotMaxPricePercentageOverLowestPrice
orMaxSpotPriceAsPercentageOfOptimalOnDemandPrice
can be specified. If you don't specify either, Amazon EC2 Auto Scaling will automatically apply optimal price protection to consistently select from a wide range of instance types. To indicate no price protection threshold for Spot Instances, meaning you want to consider all instance types that match your attributes, include one of these parameters and specify a high value, such as999999
.OnDemandMaxPricePercentageOverLowestPrice
— (Integer
)[Price protection] The price protection threshold for On-Demand Instances, as a percentage higher than an identified On-Demand price. The identified On-Demand price is the price of the lowest priced current generation C, M, or R instance type with your specified attributes. If no current generation C, M, or R instance type matches your attributes, then the identified price is from either the lowest priced current generation instance types or, failing that, the lowest priced previous generation instance types that match your attributes. When Amazon EC2 Auto Scaling selects instance types with your attributes, we will exclude instance types whose price exceeds your specified threshold.
The parameter accepts an integer, which Amazon EC2 Auto Scaling interprets as a percentage.
To turn off price protection, specify a high value, such as
999999
.If you set
DesiredCapacityType
tovcpu
ormemory-mib
, the price protection threshold is applied based on the per-vCPU or per-memory price instead of the per instance price.Default:
20
BareMetal
— (String
)Indicates whether bare metal instance types are included, excluded, or required.
Default:
Possible values include:excluded
"included"
"excluded"
"required"
BurstablePerformance
— (String
)Indicates whether burstable performance instance types are included, excluded, or required. For more information, see Burstable performance instances in the Amazon EC2 User Guide for Linux Instances.
Default:
Possible values include:excluded
"included"
"excluded"
"required"
RequireHibernateSupport
— (Boolean
)Indicates whether instance types must provide On-Demand Instance hibernation support.
Default:
false
NetworkInterfaceCount
— (map
)The minimum and maximum number of network interfaces for an instance type.
Default: No minimum or maximum limits
Min
— (Integer
)The minimum number of network interfaces.
Max
— (Integer
)The maximum number of network interfaces.
LocalStorage
— (String
)Indicates whether instance types with instance store volumes are included, excluded, or required. For more information, see Amazon EC2 instance store in the Amazon EC2 User Guide for Linux Instances.
Default:
Possible values include:included
"included"
"excluded"
"required"
LocalStorageTypes
— (Array<String>
)Indicates the type of local storage that is required.
-
For instance types with hard disk drive (HDD) storage, specify
hdd
. -
For instance types with solid state drive (SSD) storage, specify
ssd
.
Default: Any local storage type
-
TotalLocalStorageGB
— (map
)The minimum and maximum total local storage size for an instance type, in GB.
Default: No minimum or maximum limits
Min
— (Float
)The storage minimum in GB.
Max
— (Float
)The storage maximum in GB.
BaselineEbsBandwidthMbps
— (map
)The minimum and maximum baseline bandwidth performance for an instance type, in Mbps. For more information, see Amazon EBS–optimized instances in the Amazon EC2 User Guide for Linux Instances.
Default: No minimum or maximum limits
Min
— (Integer
)The minimum value in Mbps.
Max
— (Integer
)The maximum value in Mbps.
AcceleratorTypes
— (Array<String>
)Lists the accelerator types that must be on an instance type.
-
For instance types with GPU accelerators, specify
gpu
. -
For instance types with FPGA accelerators, specify
fpga
. -
For instance types with inference accelerators, specify
inference
.
Default: Any accelerator type
-
AcceleratorCount
— (map
)The minimum and maximum number of accelerators (GPUs, FPGAs, or Amazon Web Services Inferentia chips) for an instance type.
To exclude accelerator-enabled instance types, set
Max
to0
.Default: No minimum or maximum limits
Min
— (Integer
)The minimum value.
Max
— (Integer
)The maximum value.
AcceleratorManufacturers
— (Array<String>
)Indicates whether instance types must have accelerators by specific manufacturers.
-
For instance types with NVIDIA devices, specify
nvidia
. -
For instance types with AMD devices, specify
amd
. -
For instance types with Amazon Web Services devices, specify
amazon-web-services
. -
For instance types with Xilinx devices, specify
xilinx
.
Default: Any manufacturer
-
AcceleratorNames
— (Array<String>
)Lists the accelerators that must be on an instance type.
-
For instance types with NVIDIA A100 GPUs, specify
a100
. -
For instance types with NVIDIA V100 GPUs, specify
v100
. -
For instance types with NVIDIA K80 GPUs, specify
k80
. -
For instance types with NVIDIA T4 GPUs, specify
t4
. -
For instance types with NVIDIA M60 GPUs, specify
m60
. -
For instance types with AMD Radeon Pro V520 GPUs, specify
radeon-pro-v520
. -
For instance types with Xilinx VU9P FPGAs, specify
vu9p
.
Default: Any accelerator
-
AcceleratorTotalMemoryMiB
— (map
)The minimum and maximum total memory size for the accelerators on an instance type, in MiB.
Default: No minimum or maximum limits
Min
— (Integer
)The memory minimum in MiB.
Max
— (Integer
)The memory maximum in MiB.
NetworkBandwidthGbps
— (map
)The minimum and maximum amount of network bandwidth, in gigabits per second (Gbps).
Default: No minimum or maximum limits
Min
— (Float
)The minimum amount of network bandwidth, in gigabits per second (Gbps).
Max
— (Float
)The maximum amount of network bandwidth, in gigabits per second (Gbps).
AllowedInstanceTypes
— (Array<String>
)The instance types to apply your specified attributes against. All other instance types are ignored, even if they match your specified attributes.
You can use strings with one or more wild cards, represented by an asterisk (
*
), to allow an instance type, size, or generation. The following are examples:m5.8xlarge
,c5*.*
,m5a.*
,r*
,*3*
.For example, if you specify
c5*
, Amazon EC2 Auto Scaling will allow the entire C5 instance family, which includes all C5a and C5n instance types. If you specifym5a.*
, Amazon EC2 Auto Scaling will allow all the M5a instance types, but not the M5n instance types.Note: If you specifyAllowedInstanceTypes
, you can't specifyExcludedInstanceTypes
.Default: All instance types
InstancesDistribution
— (map
)The instances distribution.
OnDemandAllocationStrategy
— (String
)The allocation strategy to apply to your On-Demand Instances when they are launched. Possible instance types are determined by the launch template overrides that you specify.
The following lists the valid values:
- lowest-price
-
Uses price to determine which instance types are the highest priority, launching the lowest priced instance types within an Availability Zone first. This is the default value for Auto Scaling groups that specify InstanceRequirements.
- prioritized
-
You set the order of instance types for the launch template overrides from highest to lowest priority (from first to last in the list). Amazon EC2 Auto Scaling launches your highest priority instance types first. If all your On-Demand capacity cannot be fulfilled using your highest priority instance type, then Amazon EC2 Auto Scaling launches the remaining capacity using the second priority instance type, and so on. This is the default value for Auto Scaling groups that don't specify InstanceRequirements and cannot be used for groups that do.
OnDemandBaseCapacity
— (Integer
)The minimum amount of the Auto Scaling group's capacity that must be fulfilled by On-Demand Instances. This base portion is launched first as your group scales.
This number has the same unit of measurement as the group's desired capacity. If you change the default unit of measurement (number of instances) by specifying weighted capacity values in your launch template overrides list, or by changing the default desired capacity type setting of the group, you must specify this number using the same unit of measurement.
Default: 0
OnDemandPercentageAboveBaseCapacity
— (Integer
)Controls the percentages of On-Demand Instances and Spot Instances for your additional capacity beyond
OnDemandBaseCapacity
. Expressed as a number (for example, 20 specifies 20% On-Demand Instances, 80% Spot Instances). If set to 100, only On-Demand Instances are used.Default: 100
SpotAllocationStrategy
— (String
)The allocation strategy to apply to your Spot Instances when they are launched. Possible instance types are determined by the launch template overrides that you specify.
The following lists the valid values:
- capacity-optimized
-
Requests Spot Instances using pools that are optimally chosen based on the available Spot capacity. This strategy has the lowest risk of interruption. To give certain instance types a higher chance of launching first, use
capacity-optimized-prioritized
. - capacity-optimized-prioritized
-
You set the order of instance types for the launch template overrides from highest to lowest priority (from first to last in the list). Amazon EC2 Auto Scaling honors the instance type priorities on a best effort basis but optimizes for capacity first. Note that if the On-Demand allocation strategy is set to
prioritized
, the same priority is applied when fulfilling On-Demand capacity. This is not a valid value for Auto Scaling groups that specify InstanceRequirements. - lowest-price
-
Requests Spot Instances using the lowest priced pools within an Availability Zone, across the number of Spot pools that you specify for the
SpotInstancePools
property. To ensure that your desired capacity is met, you might receive Spot Instances from several pools. This is the default value, but it might lead to high interruption rates because this strategy only considers instance price and not available capacity. - price-capacity-optimized (recommended)
-
The price and capacity optimized allocation strategy looks at both price and capacity to select the Spot Instance pools that are the least likely to be interrupted and have the lowest possible price.
SpotInstancePools
— (Integer
)The number of Spot Instance pools across which to allocate your Spot Instances. The Spot pools are determined from the different instance types in the overrides. Valid only when the
SpotAllocationStrategy
islowest-price
. Value must be in the range of 1–20.Default: 2
SpotMaxPrice
— (String
)The maximum price per unit hour that you are willing to pay for a Spot Instance. If your maximum price is lower than the Spot price for the instance types that you selected, your Spot Instances are not launched. We do not recommend specifying a maximum price because it can lead to increased interruptions. When Spot Instances launch, you pay the current Spot price. To remove a maximum price that you previously set, include the property but specify an empty string ("") for the value.
If you specify a maximum price, your instances will be interrupted more frequently than if you do not specify one.
Valid Range: Minimum value of 0.001
RollbackDetails
— (map
)The rollback details.
RollbackReason
— (String
)The reason for this instance refresh rollback (for example, whether a manual or automatic rollback was initiated).
RollbackStartTime
— (Date
)The date and time at which the rollback began.
PercentageCompleteOnRollback
— (Integer
)Indicates the value of
PercentageComplete
at the time the rollback started.InstancesToUpdateOnRollback
— (Integer
)Indicates the value of
InstancesToUpdate
at the time the rollback started.ProgressDetailsOnRollback
— (map
)Reports progress on replacing instances in an Auto Scaling group that has a warm pool. This includes separate details for instances in the warm pool and instances in the Auto Scaling group (the live pool).
LivePoolProgress
— (map
)Reports progress on replacing instances that are in the Auto Scaling group.
PercentageComplete
— (Integer
)The percentage of instances in the Auto Scaling group that have been replaced. For each instance replacement, Amazon EC2 Auto Scaling tracks the instance's health status and warm-up time. When the instance's health status changes to healthy and the specified warm-up time passes, the instance is considered updated and is added to the percentage complete.
InstancesToUpdate
— (Integer
)The number of instances remaining to update.
WarmPoolProgress
— (map
)Reports progress on replacing instances that are in the warm pool.
PercentageComplete
— (Integer
)The percentage of instances in the warm pool that have been replaced. For each instance replacement, Amazon EC2 Auto Scaling tracks the instance's health status and warm-up time. When the instance's health status changes to healthy and the specified warm-up time passes, the instance is considered updated and is added to the percentage complete.
InstancesToUpdate
— (Integer
)The number of instances remaining to update.
NextToken
— (String
)A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
-
(AWS.Response)
—
Returns:
describeLaunchConfigurations(params = {}, callback) ⇒ AWS.Request
Gets information about the launch configurations in the account and Region.
Service Reference:
Examples:
To describe Auto Scaling launch configurations
/* This example describes the specified launch configuration. */ var params = { LaunchConfigurationNames: [ "my-launch-config" ] }; autoscaling.describeLaunchConfigurations(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { LaunchConfigurations: [ { AssociatePublicIpAddress: true, BlockDeviceMappings: [ ], CreatedTime: <Date Representation>, EbsOptimized: false, ImageId: "ami-043a5034", InstanceMonitoring: { Enabled: true }, InstanceType: "t1.micro", LaunchConfigurationARN: "arn:aws:autoscaling:us-west-2:123456789012:launchConfiguration:98d3b196-4cf9-4e88-8ca1-8547c24ced8b:launchConfigurationName/my-launch-config", LaunchConfigurationName: "my-launch-config", SecurityGroups: [ "sg-67ef0308" ] } ] } */ });
Calling the describeLaunchConfigurations operation
var params = { LaunchConfigurationNames: [ 'STRING_VALUE', /* more items */ ], MaxRecords: 'NUMBER_VALUE', NextToken: 'STRING_VALUE' }; autoscaling.describeLaunchConfigurations(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: {})
—
LaunchConfigurationNames
— (Array<String>
)The launch configuration names. If you omit this property, all launch configurations are described.
Array Members: Maximum number of 50 items.
NextToken
— (String
)The token for the next set of items to return. (You received this token from a previous call.)
MaxRecords
— (Integer
)The maximum number of items to return with this call. The default value is
50
and the maximum value is100
.
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:LaunchConfigurations
— (Array<map>
)The launch configurations.
LaunchConfigurationName
— required — (String
)The name of the launch configuration.
LaunchConfigurationARN
— (String
)The Amazon Resource Name (ARN) of the launch configuration.
ImageId
— required — (String
)The ID of the Amazon Machine Image (AMI) to use to launch your EC2 instances. For more information, see Find a Linux AMI in the Amazon EC2 User Guide for Linux Instances.
KeyName
— (String
)The name of the key pair.
For more information, see Amazon EC2 key pairs and Amazon EC2 instances in the Amazon EC2 User Guide for Linux Instances.
SecurityGroups
— (Array<String>
)A list that contains the security groups to assign to the instances in the Auto Scaling group. For more information, see Control traffic to your Amazon Web Services resources using security groups in the Amazon Virtual Private Cloud User Guide.
ClassicLinkVPCId
— (String
)Available for backward compatibility.
ClassicLinkVPCSecurityGroups
— (Array<String>
)Available for backward compatibility.
UserData
— (String
)The user data to make available to the launched EC2 instances. For more information, see Instance metadata and user data (Linux) and Instance metadata and user data (Windows). If you are using a command line tool, base64-encoding is performed for you, and you can load the text from a file. Otherwise, you must provide base64-encoded text. User data is limited to 16 KB.
InstanceType
— required — (String
)The instance type for the instances. For information about available instance types, see Available instance types in the Amazon EC2 User Guide for Linux Instances.
KernelId
— (String
)The ID of the kernel associated with the AMI.
RamdiskId
— (String
)The ID of the RAM disk associated with the AMI.
BlockDeviceMappings
— (Array<map>
)The block device mapping entries that define the block devices to attach to the instances at launch. By default, the block devices specified in the block device mapping for the AMI are used. For more information, see Block device mappings in the Amazon EC2 User Guide for Linux Instances.
VirtualName
— (String
)The name of the instance store volume (virtual device) to attach to an instance at launch. The name must be in the form ephemeralX where X is a number starting from zero (0), for example,
ephemeral0
.DeviceName
— required — (String
)The device name assigned to the volume (for example,
/dev/sdh
orxvdh
). For more information, see Device naming on Linux instances in the Amazon EC2 User Guide for Linux Instances.Note: To define a block device mapping, set the device name and exactly one of the following properties:Ebs
,NoDevice
, orVirtualName
.Ebs
— (map
)Information to attach an EBS volume to an instance at launch.
SnapshotId
— (String
)The snapshot ID of the volume to use.
You must specify either a
VolumeSize
or aSnapshotId
.VolumeSize
— (Integer
)The volume size, in GiBs. The following are the supported volumes sizes for each volume type:
-
gp2
andgp3
: 1-16,384 -
io1
: 4-16,384 -
st1
andsc1
: 125-16,384 -
standard
: 1-1,024
You must specify either a
SnapshotId
or aVolumeSize
. If you specify bothSnapshotId
andVolumeSize
, the volume size must be equal or greater than the size of the snapshot.-
VolumeType
— (String
)The volume type. For more information, see Amazon EBS volume types in the Amazon EBS User Guide.
Valid values:
standard
|io1
|gp2
|st1
|sc1
|gp3
DeleteOnTermination
— (Boolean
)Indicates whether the volume is deleted on instance termination. For Amazon EC2 Auto Scaling, the default value is
true
.Iops
— (Integer
)The number of input/output (I/O) operations per second (IOPS) to provision for the volume. For
gp3
andio1
volumes, this represents the number of IOPS that are provisioned for the volume. Forgp2
volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting.The following are the supported values for each volume type:
-
gp3
: 3,000-16,000 IOPS -
io1
: 100-64,000 IOPS
For
io1
volumes, we guarantee 64,000 IOPS only for Instances built on the Amazon Web Services Nitro System. Other instance families guarantee performance up to 32,000 IOPS.Iops
is supported when the volume type isgp3
orio1
and required only when the volume type isio1
. (Not used withstandard
,gp2
,st1
, orsc1
volumes.)-
Encrypted
— (Boolean
)Specifies whether the volume should be encrypted. Encrypted EBS volumes can only be attached to instances that support Amazon EBS encryption. For more information, see Requirements for Amazon EBS encryption in the Amazon EBS User Guide. If your AMI uses encrypted volumes, you can also only launch it on supported instance types.
Note: If you are creating a volume from a snapshot, you cannot create an unencrypted volume from an encrypted snapshot. Also, you cannot specify a KMS key ID when using a launch configuration. If you enable encryption by default, the EBS volumes that you create are always encrypted, either using the Amazon Web Services managed KMS key or a customer-managed KMS key, regardless of whether the snapshot was encrypted. For more information, see Use Amazon Web Services KMS keys to encrypt Amazon EBS volumes in the Amazon EC2 Auto Scaling User Guide.Throughput
— (Integer
)The throughput (MiBps) to provision for a
gp3
volume.
NoDevice
— (Boolean
)Setting this value to
true
prevents a volume that is included in the block device mapping of the AMI from being mapped to the specified device name at launch.If
NoDevice
istrue
for the root device, instances might fail the EC2 health check. In that case, Amazon EC2 Auto Scaling launches replacement instances.
InstanceMonitoring
— (map
)Controls whether instances in this group are launched with detailed (
true
) or basic (false
) monitoring.For more information, see Configure monitoring for Auto Scaling instances in the Amazon EC2 Auto Scaling User Guide.
Enabled
— (Boolean
)If
true
, detailed monitoring is enabled. Otherwise, basic monitoring is enabled.
SpotPrice
— (String
)The maximum hourly price to be paid for any Spot Instance launched to fulfill the request. Spot Instances are launched when the price you specify exceeds the current Spot price. For more information, see Requesting Spot Instances for fault-tolerant and flexible applications in the Amazon EC2 Auto Scaling User Guide.
IamInstanceProfile
— (String
)The name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance. The instance profile contains the IAM role. For more information, see IAM role for applications that run on Amazon EC2 instances in the Amazon EC2 Auto Scaling User Guide.
CreatedTime
— required — (Date
)The creation date and time for the launch configuration.
EbsOptimized
— (Boolean
)Specifies whether the launch configuration is optimized for EBS I/O (
true
) or not (false
). For more information, see Amazon EBS-optimized instances in the Amazon EC2 User Guide for Linux Instances.AssociatePublicIpAddress
— (Boolean
)Specifies whether to assign a public IPv4 address to the group's instances. If the instance is launched into a default subnet, the default is to assign a public IPv4 address, unless you disabled the option to assign a public IPv4 address on the subnet. If the instance is launched into a nondefault subnet, the default is not to assign a public IPv4 address, unless you enabled the option to assign a public IPv4 address on the subnet. For more information, see Provide network connectivity for your Auto Scaling instances using Amazon VPC in the Amazon EC2 Auto Scaling User Guide.
PlacementTenancy
— (String
)The tenancy of the instance, either
default
ordedicated
. An instance withdedicated
tenancy runs on isolated, single-tenant hardware and can only be launched into a VPC.MetadataOptions
— (map
)The metadata options for the instances. For more information, see Configure the instance metadata options in the Amazon EC2 Auto Scaling User Guide.
HttpTokens
— (String
)The state of token usage for your instance metadata requests. If the parameter is not specified in the request, the default state is
optional
.If the state is
optional
, you can choose to retrieve instance metadata with or without a signed token header on your request. If you retrieve the IAM role credentials without a token, the version 1.0 role credentials are returned. If you retrieve the IAM role credentials using a valid signed token, the version 2.0 role credentials are returned.If the state is
Possible values include:required
, you must send a signed token header with any instance metadata retrieval requests. In this state, retrieving the IAM role credentials always returns the version 2.0 credentials; the version 1.0 credentials are not available."optional"
"required"
HttpPutResponseHopLimit
— (Integer
)The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel.
Default: 1
HttpEndpoint
— (String
)This parameter enables or disables the HTTP metadata endpoint on your instances. If the parameter is not specified, the default state is
enabled
.Note: If you specify a value ofPossible values include:disabled
, you will not be able to access your instance metadata."disabled"
"enabled"
NextToken
— (String
)A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
-
(AWS.Response)
—
Returns:
describeLifecycleHooks(params = {}, callback) ⇒ AWS.Request
Gets information about the lifecycle hooks for the specified Auto Scaling group.
Service Reference:
Examples:
To describe your lifecycle hooks
/* This example describes the lifecycle hooks for the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group" }; autoscaling.describeLifecycleHooks(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { LifecycleHooks: [ { AutoScalingGroupName: "my-auto-scaling-group", DefaultResult: "ABANDON", GlobalTimeout: 172800, HeartbeatTimeout: 3600, LifecycleHookName: "my-lifecycle-hook", LifecycleTransition: "autoscaling:EC2_INSTANCE_LAUNCHING", NotificationTargetARN: "arn:aws:sns:us-west-2:123456789012:my-sns-topic", RoleARN: "arn:aws:iam::123456789012:role/my-auto-scaling-role" } ] } */ });
Calling the describeLifecycleHooks operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ LifecycleHookNames: [ 'STRING_VALUE', /* more items */ ] }; autoscaling.describeLifecycleHooks(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
LifecycleHookNames
— (Array<String>
)The names of one or more lifecycle hooks. If you omit this property, all lifecycle hooks are described.
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:LifecycleHooks
— (Array<map>
)The lifecycle hooks for the specified group.
LifecycleHookName
— (String
)The name of the lifecycle hook.
AutoScalingGroupName
— (String
)The name of the Auto Scaling group for the lifecycle hook.
LifecycleTransition
— (String
)The lifecycle transition.
Valid values:
autoscaling:EC2_INSTANCE_LAUNCHING
|autoscaling:EC2_INSTANCE_TERMINATING
NotificationTargetARN
— (String
)The ARN of the target that Amazon EC2 Auto Scaling sends notifications to when an instance is in a wait state for the lifecycle hook.
RoleARN
— (String
)The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target (an Amazon SNS topic or an Amazon SQS queue).
NotificationMetadata
— (String
)Additional information that is included any time Amazon EC2 Auto Scaling sends a message to the notification target.
HeartbeatTimeout
— (Integer
)The maximum time, in seconds, that can elapse before the lifecycle hook times out. If the lifecycle hook times out, Amazon EC2 Auto Scaling performs the action that you specified in the
DefaultResult
property.GlobalTimeout
— (Integer
)The maximum time, in seconds, that an instance can remain in a wait state. The maximum is 172800 seconds (48 hours) or 100 times
HeartbeatTimeout
, whichever is smaller.DefaultResult
— (String
)The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs.
Valid values:
CONTINUE
|ABANDON
-
(AWS.Response)
—
Returns:
describeLifecycleHookTypes(params = {}, callback) ⇒ AWS.Request
Describes the available types of lifecycle hooks.
The following hook types are supported:
-
autoscaling:EC2_INSTANCE_LAUNCHING
-
autoscaling:EC2_INSTANCE_TERMINATING
Service Reference:
Examples:
To describe the available types of lifecycle hooks
/* This example describes the available lifecycle hook types. */ var params = {}; autoscaling.describeLifecycleHookTypes(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { LifecycleHookTypes: [ "autoscaling:EC2_INSTANCE_LAUNCHING", "autoscaling:EC2_INSTANCE_TERMINATING" ] } */ });
Calling the describeLifecycleHookTypes operation
autoscaling.describeLifecycleHookTypes(function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Parameters:
- params (Object) (defaults to: {})
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:LifecycleHookTypes
— (Array<String>
)The lifecycle hook types.
-
(AWS.Response)
—
Returns:
describeLoadBalancers(params = {}, callback) ⇒ AWS.Request
Note: This API operation is superseded by DescribeTrafficSources, which can describe multiple traffic sources types. We recommend usingDescribeTrafficSources
to simplify how you manage traffic sources. However, we continue to supportDescribeLoadBalancers
. You can use both the originalDescribeLoadBalancers
API operation andDescribeTrafficSources
on the same Auto Scaling group.Gets information about the load balancers for the specified Auto Scaling group.
This operation describes only Classic Load Balancers. If you have Application Load Balancers, Network Load Balancers, or Gateway Load Balancers, use the DescribeLoadBalancerTargetGroups API instead.
To determine the attachment status of the load balancer, use the
State
element in the response. When you attach a load balancer to an Auto Scaling group, the initialState
value isAdding
. The state transitions toAdded
after all Auto Scaling instances are registered with the load balancer. If Elastic Load Balancing health checks are enabled for the Auto Scaling group, the state transitions toInService
after at least one Auto Scaling instance passes the health check. When the load balancer is in theInService
state, Amazon EC2 Auto Scaling can terminate and replace any instances that are reported as unhealthy. If no registered instances pass the health checks, the load balancer doesn't enter theInService
state.Load balancers also have an
InService
state if you attach them in the CreateAutoScalingGroup API call. If your load balancer state isInService
, but it is not working properly, check the scaling activities by calling DescribeScalingActivities and take any corrective actions necessary.For help with failed health checks, see Troubleshooting Amazon EC2 Auto Scaling: Health checks in the Amazon EC2 Auto Scaling User Guide. For more information, see Use Elastic Load Balancing to distribute traffic across the instances in your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.
Service Reference:
Examples:
To describe the load balancers for an Auto Scaling group
/* This example describes the load balancers attached to the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group" }; autoscaling.describeLoadBalancers(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { LoadBalancers: [ { LoadBalancerName: "my-load-balancer", State: "Added" } ] } */ });
Calling the describeLoadBalancers operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ MaxRecords: 'NUMBER_VALUE', NextToken: 'STRING_VALUE' }; autoscaling.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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
NextToken
— (String
)The token for the next set of items to return. (You received this token from a previous call.)
MaxRecords
— (Integer
)The maximum number of items to return with this call. The default value is
100
and the maximum value is100
.
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:LoadBalancers
— (Array<map>
)The load balancers.
LoadBalancerName
— (String
)The name of the load balancer.
State
— (String
)One of the following load balancer states:
-
Adding
- The Auto Scaling instances are being registered with the load balancer. -
Added
- All Auto Scaling instances are registered with the load balancer. -
InService
- At least one Auto Scaling instance passed anELB
health check. -
Removing
- The Auto Scaling instances are being deregistered from the load balancer. If connection draining is enabled, Elastic Load Balancing waits for in-flight requests to complete before deregistering the instances. -
Removed
- All Auto Scaling instances are deregistered from the load balancer.
-
NextToken
— (String
)A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
-
(AWS.Response)
—
Returns:
describeLoadBalancerTargetGroups(params = {}, callback) ⇒ AWS.Request
Note: This API operation is superseded by DescribeTrafficSources, which can describe multiple traffic sources types. We recommend usingDetachTrafficSources
to simplify how you manage traffic sources. However, we continue to supportDescribeLoadBalancerTargetGroups
. You can use both the originalDescribeLoadBalancerTargetGroups
API operation andDescribeTrafficSources
on the same Auto Scaling group.Gets information about the Elastic Load Balancing target groups for the specified Auto Scaling group.
To determine the attachment status of the target group, use the
State
element in the response. When you attach a target group to an Auto Scaling group, the initialState
value isAdding
. The state transitions toAdded
after all Auto Scaling instances are registered with the target group. If Elastic Load Balancing health checks are enabled for the Auto Scaling group, the state transitions toInService
after at least one Auto Scaling instance passes the health check. When the target group is in theInService
state, Amazon EC2 Auto Scaling can terminate and replace any instances that are reported as unhealthy. If no registered instances pass the health checks, the target group doesn't enter theInService
state.Target groups also have an
InService
state if you attach them in the CreateAutoScalingGroup API call. If your target group state isInService
, but it is not working properly, check the scaling activities by calling DescribeScalingActivities and take any corrective actions necessary.For help with failed health checks, see Troubleshooting Amazon EC2 Auto Scaling: Health checks in the Amazon EC2 Auto Scaling User Guide. For more information, see Use Elastic Load Balancing to distribute traffic across the instances in your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.
Note: You can use this operation to describe target groups that were attached by using AttachLoadBalancerTargetGroups, but not for target groups that were attached by using AttachTrafficSources.Service Reference:
Examples:
To describe the target groups for an Auto Scaling group
/* This example describes the target groups attached to the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group" }; autoscaling.describeLoadBalancerTargetGroups(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { LoadBalancerTargetGroups: [ { LoadBalancerTargetGroupARN: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", State: "Added" } ] } */ });
Calling the describeLoadBalancerTargetGroups operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ MaxRecords: 'NUMBER_VALUE', NextToken: 'STRING_VALUE' }; autoscaling.describeLoadBalancerTargetGroups(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
NextToken
— (String
)The token for the next set of items to return. (You received this token from a previous call.)
MaxRecords
— (Integer
)The maximum number of items to return with this call. The default value is
100
and the maximum value is100
.
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:LoadBalancerTargetGroups
— (Array<map>
)Information about the target groups.
LoadBalancerTargetGroupARN
— (String
)The Amazon Resource Name (ARN) of the target group.
State
— (String
)The state of the target group.
-
Adding
- The Auto Scaling instances are being registered with the target group. -
Added
- All Auto Scaling instances are registered with the target group. -
InService
- At least one Auto Scaling instance passed anELB
health check. -
Removing
- The Auto Scaling instances are being deregistered from the target group. If connection draining is enabled, Elastic Load Balancing waits for in-flight requests to complete before deregistering the instances. -
Removed
- All Auto Scaling instances are deregistered from the target group.
-
NextToken
— (String
)A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
-
(AWS.Response)
—
Returns:
describeMetricCollectionTypes(params = {}, callback) ⇒ AWS.Request
Describes the available CloudWatch metrics for Amazon EC2 Auto Scaling.
Service Reference:
Examples:
To describe the Auto Scaling metric collection types
/* This example describes the available metric collection types. */ var params = {}; autoscaling.describeMetricCollectionTypes(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { Granularities: [ { Granularity: "1Minute" } ], Metrics: [ { Metric: "GroupMinSize" }, { Metric: "GroupMaxSize" }, { Metric: "GroupDesiredCapacity" }, { Metric: "GroupInServiceInstances" }, { Metric: "GroupPendingInstances" }, { Metric: "GroupTerminatingInstances" }, { Metric: "GroupStandbyInstances" }, { Metric: "GroupTotalInstances" } ] } */ });
Calling the describeMetricCollectionTypes operation
autoscaling.describeMetricCollectionTypes(function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Parameters:
- params (Object) (defaults to: {})
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:Metrics
— (Array<map>
)The metrics.
Metric
— (String
)One of the following metrics:
-
GroupMinSize
-
GroupMaxSize
-
GroupDesiredCapacity
-
GroupInServiceInstances
-
GroupPendingInstances
-
GroupStandbyInstances
-
GroupTerminatingInstances
-
GroupTotalInstances
-
GroupInServiceCapacity
-
GroupPendingCapacity
-
GroupStandbyCapacity
-
GroupTerminatingCapacity
-
GroupTotalCapacity
-
WarmPoolDesiredCapacity
-
WarmPoolWarmedCapacity
-
WarmPoolPendingCapacity
-
WarmPoolTerminatingCapacity
-
WarmPoolTotalCapacity
-
GroupAndWarmPoolDesiredCapacity
-
GroupAndWarmPoolTotalCapacity
-
Granularities
— (Array<map>
)The granularities for the metrics.
Granularity
— (String
)The granularity. The only valid value is
1Minute
.
-
(AWS.Response)
—
Returns:
describeNotificationConfigurations(params = {}, callback) ⇒ AWS.Request
Gets information about the Amazon SNS notifications that are configured for one or more Auto Scaling groups.
Service Reference:
Examples:
To describe Auto Scaling notification configurations
/* This example describes the notification configurations for the specified Auto Scaling group. */ var params = { AutoScalingGroupNames: [ "my-auto-scaling-group" ] }; autoscaling.describeNotificationConfigurations(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { NotificationConfigurations: [ { AutoScalingGroupName: "my-auto-scaling-group", NotificationType: "autoscaling:TEST_NOTIFICATION", TopicARN: "arn:aws:sns:us-west-2:123456789012:my-sns-topic-2" }, { AutoScalingGroupName: "my-auto-scaling-group", NotificationType: "autoscaling:TEST_NOTIFICATION", TopicARN: "arn:aws:sns:us-west-2:123456789012:my-sns-topic" } ] } */ });
Calling the describeNotificationConfigurations operation
var params = { AutoScalingGroupNames: [ 'STRING_VALUE', /* more items */ ], MaxRecords: 'NUMBER_VALUE', NextToken: 'STRING_VALUE' }; autoscaling.describeNotificationConfigurations(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: {})
—
AutoScalingGroupNames
— (Array<String>
)The name of the Auto Scaling group.
NextToken
— (String
)The token for the next set of items to return. (You received this token from a previous call.)
MaxRecords
— (Integer
)The maximum number of items to return with this call. The default value is
50
and the maximum value is100
.
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:NotificationConfigurations
— (Array<map>
)The notification configurations.
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
TopicARN
— (String
)The Amazon Resource Name (ARN) of the Amazon SNS topic.
NotificationType
— (String
)One of the following event notification types:
-
autoscaling:EC2_INSTANCE_LAUNCH
-
autoscaling:EC2_INSTANCE_LAUNCH_ERROR
-
autoscaling:EC2_INSTANCE_TERMINATE
-
autoscaling:EC2_INSTANCE_TERMINATE_ERROR
-
autoscaling:TEST_NOTIFICATION
-
NextToken
— (String
)A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
-
(AWS.Response)
—
Returns:
describePolicies(params = {}, callback) ⇒ AWS.Request
Gets information about the scaling policies in the account and Region.
Service Reference:
Examples:
To describe scaling policies
/* This example describes the policies for the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group" }; autoscaling.describePolicies(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { ScalingPolicies: [ { AdjustmentType: "ChangeInCapacity", Alarms: [ ], AutoScalingGroupName: "my-auto-scaling-group", PolicyARN: "arn:aws:autoscaling:us-west-2:123456789012:scalingPolicy:2233f3d7-6290-403b-b632-93c553560106:autoScalingGroupName/my-auto-scaling-group:policyName/ScaleIn", PolicyName: "ScaleIn", ScalingAdjustment: -1 }, { AdjustmentType: "PercentChangeInCapacity", Alarms: [ ], AutoScalingGroupName: "my-auto-scaling-group", Cooldown: 60, MinAdjustmentStep: 2, PolicyARN: "arn:aws:autoscaling:us-west-2:123456789012:scalingPolicy:2b435159-cf77-4e89-8c0e-d63b497baad7:autoScalingGroupName/my-auto-scaling-group:policyName/ScalePercentChange", PolicyName: "ScalePercentChange", ScalingAdjustment: 25 } ] } */ });
Calling the describePolicies operation
var params = { AutoScalingGroupName: 'STRING_VALUE', MaxRecords: 'NUMBER_VALUE', NextToken: 'STRING_VALUE', PolicyNames: [ 'STRING_VALUE', /* more items */ ], PolicyTypes: [ 'STRING_VALUE', /* more items */ ] }; autoscaling.describePolicies(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
PolicyNames
— (Array<String>
)The names of one or more policies. If you omit this property, all policies are described. If a group name is provided, the results are limited to that group. If you specify an unknown policy name, it is ignored with no error.
Array Members: Maximum number of 50 items.
PolicyTypes
— (Array<String>
)One or more policy types. The valid values are
SimpleScaling
,StepScaling
,TargetTrackingScaling
, andPredictiveScaling
.NextToken
— (String
)The token for the next set of items to return. (You received this token from a previous call.)
MaxRecords
— (Integer
)The maximum number of items to be returned with each call. The default value is
50
and the maximum value is100
.
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:ScalingPolicies
— (Array<map>
)The scaling policies.
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
PolicyName
— (String
)The name of the scaling policy.
PolicyARN
— (String
)The Amazon Resource Name (ARN) of the policy.
PolicyType
— (String
)One of the following policy types:
-
TargetTrackingScaling
-
StepScaling
-
SimpleScaling
(default) -
PredictiveScaling
For more information, see Target tracking scaling policies and Step and simple scaling policies in the Amazon EC2 Auto Scaling User Guide.
-
AdjustmentType
— (String
)Specifies how the scaling adjustment is interpreted (for example, an absolute number or a percentage). The valid values are
ChangeInCapacity
,ExactCapacity
, andPercentChangeInCapacity
.MinAdjustmentStep
— (Integer
)Available for backward compatibility. Use
MinAdjustmentMagnitude
instead.MinAdjustmentMagnitude
— (Integer
)The minimum value to scale by when the adjustment type is
PercentChangeInCapacity
.ScalingAdjustment
— (Integer
)The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity.
Cooldown
— (Integer
)The duration of the policy's cooldown period, in seconds.
StepAdjustments
— (Array<map>
)A set of adjustments that enable you to scale based on the size of the alarm breach.
MetricIntervalLowerBound
— (Float
)The lower bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is above the breach threshold, the lower bound is inclusive (the metric must be greater than or equal to the threshold plus the lower bound). Otherwise, it is exclusive (the metric must be greater than the threshold plus the lower bound). A null value indicates negative infinity.
MetricIntervalUpperBound
— (Float
)The upper bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is above the breach threshold, the upper bound is exclusive (the metric must be less than the threshold plus the upper bound). Otherwise, it is inclusive (the metric must be less than or equal to the threshold plus the upper bound). A null value indicates positive infinity.
The upper bound must be greater than the lower bound.
ScalingAdjustment
— required — (Integer
)The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity. For exact capacity, you must specify a non-negative value.
MetricAggregationType
— (String
)The aggregation type for the CloudWatch metrics. The valid values are
Minimum
,Maximum
, andAverage
.EstimatedInstanceWarmup
— (Integer
)The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics.
Alarms
— (Array<map>
)The CloudWatch alarms related to the policy.
AlarmName
— (String
)The name of the alarm.
AlarmARN
— (String
)The Amazon Resource Name (ARN) of the alarm.
TargetTrackingConfiguration
— (map
)A target tracking scaling policy.
PredefinedMetricSpecification
— (map
)A predefined metric. You must specify either a predefined metric or a customized metric.
PredefinedMetricType
— required — (String
)The metric type. The following predefined metrics are available:
-
ASGAverageCPUUtilization
- Average CPU utilization of the Auto Scaling group. -
ASGAverageNetworkIn
- Average number of bytes received on all network interfaces by the Auto Scaling group. -
ASGAverageNetworkOut
- Average number of bytes sent out on all network interfaces by the Auto Scaling group. -
ALBRequestCountPerTarget
- Average Application Load Balancer request count per target for your Auto Scaling group.
"ASGAverageCPUUtilization"
"ASGAverageNetworkIn"
"ASGAverageNetworkOut"
"ALBRequestCountPerTarget"
-
ResourceLabel
— (String
)A label that uniquely identifies a specific Application Load Balancer target group from which to determine the average request count served by your Auto Scaling group. You can't specify a resource label unless the target group is attached to the Auto Scaling group.
You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is:
app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff
.Where:
-
app/<load-balancer-name>/<load-balancer-id> is the final portion of the load balancer ARN
-
targetgroup/<target-group-name>/<target-group-id> is the final portion of the target group ARN.
To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.
-
CustomizedMetricSpecification
— (map
)A customized metric. You must specify either a predefined metric or a customized metric.
MetricName
— (String
)The name of the metric. To get the exact metric name, namespace, and dimensions, inspect the Metric object that is returned by a call to ListMetrics.
Namespace
— (String
)The namespace of the metric.
Dimensions
— (Array<map>
)The dimensions of the metric.
Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.
Name
— required — (String
)The name of the dimension.
Value
— required — (String
)The value of the dimension.
Statistic
— (String
)The statistic of the metric.
Possible values include:"Average"
"Minimum"
"Maximum"
"SampleCount"
"Sum"
Unit
— (String
)The unit of the metric. For a complete list of the units that CloudWatch supports, see the MetricDatum data type in the Amazon CloudWatch API Reference.
Metrics
— (Array<map>
)The metrics to include in the target tracking scaling policy, as a metric data query. This can include both raw metric and metric math expressions.
Id
— required — (String
)A short name that identifies the object's results in the response. This name must be unique among all
TargetTrackingMetricDataQuery
objects specified for a single scaling policy. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscores. The first character must be a lowercase letter.Expression
— (String
)The math expression to perform on the returned data, if this object is performing a math expression. This expression can use the
Id
of the other metrics to refer to those metrics, and can also use theId
of other expressions to use the result of those expressions.Conditional: Within each
TargetTrackingMetricDataQuery
object, you must specify eitherExpression
orMetricStat
, but not both.MetricStat
— (map
)Information about the metric data to return.
Conditional: Within each
TargetTrackingMetricDataQuery
object, you must specify eitherExpression
orMetricStat
, but not both.Metric
— required — (map
)The metric to use.
Namespace
— required — (String
)The namespace of the metric. For more information, see the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide.
MetricName
— required — (String
)The name of the metric.
Dimensions
— (Array<map>
)The dimensions for the metric. For the list of available dimensions, see the Amazon Web Services documentation available from the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide.
Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.
Name
— required — (String
)The name of the dimension.
Value
— required — (String
)The value of the dimension.
Stat
— required — (String
)The statistic to return. It can include any CloudWatch statistic or extended statistic. For a list of valid values, see the table in Statistics in the Amazon CloudWatch User Guide.
The most commonly used metric for scaling is
Average
.Unit
— (String
)The unit to use for the returned data points. For a complete list of the units that CloudWatch supports, see the MetricDatum data type in the Amazon CloudWatch API Reference.
Label
— (String
)A human-readable label for this metric or expression. This is especially useful if this is a math expression, so that you know what the value represents.
ReturnData
— (Boolean
)Indicates whether to return the timestamps and raw data values of this metric.
If you use any math expressions, specify
true
for this value for only the final math expression that the metric specification is based on. You must specifyfalse
forReturnData
for all the other metrics and expressions used in the metric specification.If you are only retrieving metrics and not performing any math expressions, do not specify anything for
ReturnData
. This sets it to its default (true
).
TargetValue
— required — (Float
)The target value for the metric.
Note: Some metrics are based on a count instead of a percentage, such as the request count for an Application Load Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these metrics, specify the target utilization as the optimal average request or message count per instance during any one-minute interval.DisableScaleIn
— (Boolean
)Indicates whether scaling in by the target tracking scaling policy is disabled. If scaling in is disabled, the target tracking scaling policy doesn't remove instances from the Auto Scaling group. Otherwise, the target tracking scaling policy can remove instances from the Auto Scaling group. The default is
false
.
Enabled
— (Boolean
)Indicates whether the policy is enabled (
true
) or disabled (false
).PredictiveScalingConfiguration
— (map
)A predictive scaling policy.
MetricSpecifications
— required — (Array<map>
)This structure includes the metrics and target utilization to use for predictive scaling.
This is an array, but we currently only support a single metric specification. That is, you can specify a target value and a single metric pair, or a target value and one scaling metric and one load metric.
TargetValue
— required — (Float
)Specifies the target utilization.
Note: Some metrics are based on a count instead of a percentage, such as the request count for an Application Load Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these metrics, specify the target utilization as the optimal average request or message count per instance during any one-minute interval.PredefinedMetricPairSpecification
— (map
)The predefined metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate scaling metric and load metric to use.
PredefinedMetricType
— required — (String
)Indicates which metrics to use. There are two different types of metrics for each metric type: one is a load metric and one is a scaling metric. For example, if the metric type is
Possible values include:ASGCPUUtilization
, the Auto Scaling group's total CPU metric is used as the load metric, and the average CPU metric is used for the scaling metric."ASGCPUUtilization"
"ASGNetworkIn"
"ASGNetworkOut"
"ALBRequestCount"
ResourceLabel
— (String
)A label that uniquely identifies a specific Application Load Balancer target group from which to determine the total and average request count served by your Auto Scaling group. You can't specify a resource label unless the target group is attached to the Auto Scaling group.
You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is:
app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff
.Where:
-
app/<load-balancer-name>/<load-balancer-id> is the final portion of the load balancer ARN
-
targetgroup/<target-group-name>/<target-group-id> is the final portion of the target group ARN.
To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.
-
PredefinedScalingMetricSpecification
— (map
)The predefined scaling metric specification.
PredefinedMetricType
— required — (String
)The metric type.
Possible values include:"ASGAverageCPUUtilization"
"ASGAverageNetworkIn"
"ASGAverageNetworkOut"
"ALBRequestCountPerTarget"
ResourceLabel
— (String
)A label that uniquely identifies a specific Application Load Balancer target group from which to determine the average request count served by your Auto Scaling group. You can't specify a resource label unless the target group is attached to the Auto Scaling group.
You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is:
app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff
.Where:
-
app/<load-balancer-name>/<load-balancer-id> is the final portion of the load balancer ARN
-
targetgroup/<target-group-name>/<target-group-id> is the final portion of the target group ARN.
To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.
-
PredefinedLoadMetricSpecification
— (map
)The predefined load metric specification.
PredefinedMetricType
— required — (String
)The metric type.
Possible values include:"ASGTotalCPUUtilization"
"ASGTotalNetworkIn"
"ASGTotalNetworkOut"
"ALBTargetGroupRequestCount"
ResourceLabel
— (String
)A label that uniquely identifies a specific Application Load Balancer target group from which to determine the request count served by your Auto Scaling group. You can't specify a resource label unless the target group is attached to the Auto Scaling group.
You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is:
app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff
.Where:
-
app/<load-balancer-name>/<load-balancer-id> is the final portion of the load balancer ARN
-
targetgroup/<target-group-name>/<target-group-id> is the final portion of the target group ARN.
To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.
-
CustomizedScalingMetricSpecification
— (map
)The customized scaling metric specification.
MetricDataQueries
— required — (Array<map>
)One or more metric data queries to provide the data points for a scaling metric. Use multiple metric data queries only if you are performing a math expression on returned data.
Id
— required — (String
)A short name that identifies the object's results in the response. This name must be unique among all
MetricDataQuery
objects specified for a single scaling policy. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscores. The first character must be a lowercase letter.Expression
— (String
)The math expression to perform on the returned data, if this object is performing a math expression. This expression can use the
Id
of the other metrics to refer to those metrics, and can also use theId
of other expressions to use the result of those expressions.Conditional: Within each
MetricDataQuery
object, you must specify eitherExpression
orMetricStat
, but not both.MetricStat
— (map
)Information about the metric data to return.
Conditional: Within each
MetricDataQuery
object, you must specify eitherExpression
orMetricStat
, but not both.Metric
— required — (map
)The CloudWatch metric to return, including the metric name, namespace, and dimensions. To get the exact metric name, namespace, and dimensions, inspect the Metric object that is returned by a call to ListMetrics.
Namespace
— required — (String
)The namespace of the metric. For more information, see the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide.
MetricName
— required — (String
)The name of the metric.
Dimensions
— (Array<map>
)The dimensions for the metric. For the list of available dimensions, see the Amazon Web Services documentation available from the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide.
Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.
Name
— required — (String
)The name of the dimension.
Value
— required — (String
)The value of the dimension.
Stat
— required — (String
)The statistic to return. It can include any CloudWatch statistic or extended statistic. For a list of valid values, see the table in Statistics in the Amazon CloudWatch User Guide.
The most commonly used metrics for predictive scaling are
Average
andSum
.Unit
— (String
)The unit to use for the returned data points. For a complete list of the units that CloudWatch supports, see the MetricDatum data type in the Amazon CloudWatch API Reference.
Label
— (String
)A human-readable label for this metric or expression. This is especially useful if this is a math expression, so that you know what the value represents.
ReturnData
— (Boolean
)Indicates whether to return the timestamps and raw data values of this metric.
If you use any math expressions, specify
true
for this value for only the final math expression that the metric specification is based on. You must specifyfalse
forReturnData
for all the other metrics and expressions used in the metric specification.If you are only retrieving metrics and not performing any math expressions, do not specify anything for
ReturnData
. This sets it to its default (true
).
CustomizedLoadMetricSpecification
— (map
)The customized load metric specification.
MetricDataQueries
— required — (Array<map>
)One or more metric data queries to provide the data points for a load metric. Use multiple metric data queries only if you are performing a math expression on returned data.
Id
— required — (String
)A short name that identifies the object's results in the response. This name must be unique among all
MetricDataQuery
objects specified for a single scaling policy. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscores. The first character must be a lowercase letter.Expression
— (String
)The math expression to perform on the returned data, if this object is performing a math expression. This expression can use the
Id
of the other metrics to refer to those metrics, and can also use theId
of other expressions to use the result of those expressions.Conditional: Within each
MetricDataQuery
object, you must specify eitherExpression
orMetricStat
, but not both.MetricStat
— (map
)Information about the metric data to return.
Conditional: Within each
MetricDataQuery
object, you must specify eitherExpression
orMetricStat
, but not both.Metric
— required — (map
)The CloudWatch metric to return, including the metric name, namespace, and dimensions. To get the exact metric name, namespace, and dimensions, inspect the Metric object that is returned by a call to ListMetrics.
Namespace
— required — (String
)The namespace of the metric. For more information, see the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide.
MetricName
— required — (String
)The name of the metric.
Dimensions
— (Array<map>
)The dimensions for the metric. For the list of available dimensions, see the Amazon Web Services documentation available from the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide.
Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.
Name
— required — (String
)The name of the dimension.
Value
— required — (String
)The value of the dimension.
Stat
— required — (String
)The statistic to return. It can include any CloudWatch statistic or extended statistic. For a list of valid values, see the table in Statistics in the Amazon CloudWatch User Guide.
The most commonly used metrics for predictive scaling are
Average
andSum
.Unit
— (String
)The unit to use for the returned data points. For a complete list of the units that CloudWatch supports, see the MetricDatum data type in the Amazon CloudWatch API Reference.
Label
— (String
)A human-readable label for this metric or expression. This is especially useful if this is a math expression, so that you know what the value represents.
ReturnData
— (Boolean
)Indicates whether to return the timestamps and raw data values of this metric.
If you use any math expressions, specify
true
for this value for only the final math expression that the metric specification is based on. You must specifyfalse
forReturnData
for all the other metrics and expressions used in the metric specification.If you are only retrieving metrics and not performing any math expressions, do not specify anything for
ReturnData
. This sets it to its default (true
).
CustomizedCapacityMetricSpecification
— (map
)The customized capacity metric specification.
MetricDataQueries
— required — (Array<map>
)One or more metric data queries to provide the data points for a capacity metric. Use multiple metric data queries only if you are performing a math expression on returned data.
Id
— required — (String
)A short name that identifies the object's results in the response. This name must be unique among all
MetricDataQuery
objects specified for a single scaling policy. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscores. The first character must be a lowercase letter.Expression
— (String
)The math expression to perform on the returned data, if this object is performing a math expression. This expression can use the
Id
of the other metrics to refer to those metrics, and can also use theId
of other expressions to use the result of those expressions.Conditional: Within each
MetricDataQuery
object, you must specify eitherExpression
orMetricStat
, but not both.MetricStat
— (map
)Information about the metric data to return.
Conditional: Within each
MetricDataQuery
object, you must specify eitherExpression
orMetricStat
, but not both.Metric
— required — (map
)The CloudWatch metric to return, including the metric name, namespace, and dimensions. To get the exact metric name, namespace, and dimensions, inspect the Metric object that is returned by a call to ListMetrics.
Namespace
— required — (String
)The namespace of the metric. For more information, see the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide.
MetricName
— required — (String
)The name of the metric.
Dimensions
— (Array<map>
)The dimensions for the metric. For the list of available dimensions, see the Amazon Web Services documentation available from the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide.
Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.
Name
— required — (String
)The name of the dimension.
Value
— required — (String
)The value of the dimension.
Stat
— required — (String
)The statistic to return. It can include any CloudWatch statistic or extended statistic. For a list of valid values, see the table in Statistics in the Amazon CloudWatch User Guide.
The most commonly used metrics for predictive scaling are
Average
andSum
.Unit
— (String
)The unit to use for the returned data points. For a complete list of the units that CloudWatch supports, see the MetricDatum data type in the Amazon CloudWatch API Reference.
Label
— (String
)A human-readable label for this metric or expression. This is especially useful if this is a math expression, so that you know what the value represents.
ReturnData
— (Boolean
)Indicates whether to return the timestamps and raw data values of this metric.
If you use any math expressions, specify
true
for this value for only the final math expression that the metric specification is based on. You must specifyfalse
forReturnData
for all the other metrics and expressions used in the metric specification.If you are only retrieving metrics and not performing any math expressions, do not specify anything for
ReturnData
. This sets it to its default (true
).
Mode
— (String
)The predictive scaling mode. Defaults to
Possible values include:ForecastOnly
if not specified."ForecastAndScale"
"ForecastOnly"
SchedulingBufferTime
— (Integer
)The amount of time, in seconds, by which the instance launch time can be advanced. For example, the forecast says to add capacity at 10:00 AM, and you choose to pre-launch instances by 5 minutes. In that case, the instances will be launched at 9:55 AM. The intention is to give resources time to be provisioned. It can take a few minutes to launch an EC2 instance. The actual amount of time required depends on several factors, such as the size of the instance and whether there are startup scripts to complete.
The value must be less than the forecast interval duration of 3600 seconds (60 minutes). Defaults to 300 seconds if not specified.
MaxCapacityBreachBehavior
— (String
)Defines the behavior that should be applied if the forecast capacity approaches or exceeds the maximum capacity of the Auto Scaling group. Defaults to
HonorMaxCapacity
if not specified.The following are possible values:
-
HonorMaxCapacity
- Amazon EC2 Auto Scaling can't increase the maximum capacity of the group when the forecast capacity is close to or exceeds the maximum capacity. -
IncreaseMaxCapacity
- Amazon EC2 Auto Scaling can increase the maximum capacity of the group when the forecast capacity is close to or exceeds the maximum capacity. The upper limit is determined by the forecasted capacity and the value forMaxCapacityBuffer
.
Use caution when allowing the maximum capacity to be automatically increased. This can lead to more instances being launched than intended if the increased maximum capacity is not monitored and managed. The increased maximum capacity then becomes the new normal maximum capacity for the Auto Scaling group until you manually update it. The maximum capacity does not automatically decrease back to the original maximum.
"HonorMaxCapacity"
"IncreaseMaxCapacity"
-
MaxCapacityBuffer
— (Integer
)The size of the capacity buffer to use when the forecast capacity is close to or exceeds the maximum capacity. The value is specified as a percentage relative to the forecast capacity. For example, if the buffer is 10, this means a 10 percent buffer, such that if the forecast capacity is 50, and the maximum capacity is 40, then the effective maximum capacity is 55.
If set to 0, Amazon EC2 Auto Scaling may scale capacity higher than the maximum capacity to equal but not exceed forecast capacity.
Required if the
MaxCapacityBreachBehavior
property is set toIncreaseMaxCapacity
, and cannot be used otherwise.
NextToken
— (String
)A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
-
(AWS.Response)
—
Returns:
describeScalingActivities(params = {}, callback) ⇒ AWS.Request
Gets information about the scaling activities in the account and Region.
When scaling events occur, you see a record of the scaling activity in the scaling activities. For more information, see Verify a scaling activity for an Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.
If the scaling event succeeds, the value of the
StatusCode
element in the response isSuccessful
. If an attempt to launch instances failed, theStatusCode
value isFailed
orCancelled
and theStatusMessage
element in the response indicates the cause of the failure. For help interpreting theStatusMessage
, see Troubleshooting Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.Service Reference:
Examples:
To describe the scaling activities for an Auto Scaling group
/* This example describes the scaling activities for the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group" }; autoscaling.describeScalingActivities(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { Activities: [ { ActivityId: "f9f2d65b-f1f2-43e7-b46d-d86756459699", AutoScalingGroupARN: "arn:aws:autoscaling:us-east-1:123456789012:autoScalingGroup:12345678-1234-1234-1234-123456789012:autoScalingGroupName/my-auto-scaling-group", AutoScalingGroupName: "my-auto-scaling-group", Cause: "At 2013-08-19T20:53:25Z a user request created an AutoScalingGroup changing the desired capacity from 0 to 1. At 2013-08-19T20:53:29Z an instance was started in response to a difference between desired and actual capacity, increasing the capacity from 0 to 1.", Description: "Launching a new EC2 instance: i-4ba0837f", Details: "details", EndTime: <Date Representation>, Progress: 100, StartTime: <Date Representation>, StatusCode: "Successful" } ] } */ });
Calling the describeScalingActivities operation
var params = { ActivityIds: [ 'STRING_VALUE', /* more items */ ], AutoScalingGroupName: 'STRING_VALUE', IncludeDeletedGroups: true || false, MaxRecords: 'NUMBER_VALUE', NextToken: 'STRING_VALUE' }; autoscaling.describeScalingActivities(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: {})
—
ActivityIds
— (Array<String>
)The activity IDs of the desired scaling activities. If you omit this property, all activities for the past six weeks are described. If unknown activities are requested, they are ignored with no error. If you specify an Auto Scaling group, the results are limited to that group.
Array Members: Maximum number of 50 IDs.
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
IncludeDeletedGroups
— (Boolean
)Indicates whether to include scaling activity from deleted Auto Scaling groups.
MaxRecords
— (Integer
)The maximum number of items to return with this call. The default value is
100
and the maximum value is100
.NextToken
— (String
)The token for the next set of items to return. (You received this token from a previous 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. Thedata
object has the following properties:Activities
— (Array<map>
)The scaling activities. Activities are sorted by start time. Activities still in progress are described first.
ActivityId
— required — (String
)The ID of the activity.
AutoScalingGroupName
— required — (String
)The name of the Auto Scaling group.
Description
— (String
)A friendly, more verbose description of the activity.
Cause
— required — (String
)The reason the activity began.
StartTime
— required — (Date
)The start time of the activity.
EndTime
— (Date
)The end time of the activity.
StatusCode
— required — (String
)The current status of the activity.
Possible values include:"PendingSpotBidPlacement"
"WaitingForSpotInstanceRequestId"
"WaitingForSpotInstanceId"
"WaitingForInstanceId"
"PreInService"
"InProgress"
"WaitingForELBConnectionDraining"
"MidLifecycleAction"
"WaitingForInstanceWarmup"
"Successful"
"Failed"
"Cancelled"
"WaitingForConnectionDraining"
StatusMessage
— (String
)A friendly, more verbose description of the activity status.
Progress
— (Integer
)A value between 0 and 100 that indicates the progress of the activity.
Details
— (String
)The details about the activity.
AutoScalingGroupState
— (String
)The state of the Auto Scaling group, which is either
InService
orDeleted
.AutoScalingGroupARN
— (String
)The Amazon Resource Name (ARN) of the Auto Scaling group.
NextToken
— (String
)A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
-
(AWS.Response)
—
Returns:
describeScalingProcessTypes(params = {}, callback) ⇒ AWS.Request
Describes the scaling process types for use with the ResumeProcesses and SuspendProcesses APIs.
Service Reference:
Examples:
To describe the Auto Scaling process types
/* This example describes the Auto Scaling process types. */ var params = {}; autoscaling.describeScalingProcessTypes(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { Processes: [ { ProcessName: "AZRebalance" }, { ProcessName: "AddToLoadBalancer" }, { ProcessName: "AlarmNotification" }, { ProcessName: "HealthCheck" }, { ProcessName: "Launch" }, { ProcessName: "ReplaceUnhealthy" }, { ProcessName: "ScheduledActions" }, { ProcessName: "Terminate" } ] } */ });
Calling the describeScalingProcessTypes operation
autoscaling.describeScalingProcessTypes(function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Parameters:
- params (Object) (defaults to: {})
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:Processes
— (Array<map>
)The names of the process types.
ProcessName
— required — (String
)One of the following processes:
-
Launch
-
Terminate
-
AddToLoadBalancer
-
AlarmNotification
-
AZRebalance
-
HealthCheck
-
InstanceRefresh
-
ReplaceUnhealthy
-
ScheduledActions
-
-
(AWS.Response)
—
Returns:
describeScheduledActions(params = {}, callback) ⇒ AWS.Request
Gets information about the scheduled actions that haven't run or that have not reached their end time.
To describe the scaling activities for scheduled actions that have already run, call the DescribeScalingActivities API.
Service Reference:
Examples:
To describe scheduled actions
/* This example describes the scheduled actions for the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group" }; autoscaling.describeScheduledActions(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { ScheduledUpdateGroupActions: [ { AutoScalingGroupName: "my-auto-scaling-group", DesiredCapacity: 4, MaxSize: 6, MinSize: 2, Recurrence: "30 0 1 12 0", ScheduledActionARN: "arn:aws:autoscaling:us-west-2:123456789012:scheduledUpdateGroupAction:8e86b655-b2e6-4410-8f29-b4f094d6871c:autoScalingGroupName/my-auto-scaling-group:scheduledActionName/my-scheduled-action", ScheduledActionName: "my-scheduled-action", StartTime: <Date Representation>, Time: <Date Representation> } ] } */ });
Calling the describeScheduledActions operation
var params = { AutoScalingGroupName: 'STRING_VALUE', EndTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789, MaxRecords: 'NUMBER_VALUE', NextToken: 'STRING_VALUE', ScheduledActionNames: [ 'STRING_VALUE', /* more items */ ], StartTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789 }; autoscaling.describeScheduledActions(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
ScheduledActionNames
— (Array<String>
)The names of one or more scheduled actions. If you omit this property, all scheduled actions are described. If you specify an unknown scheduled action, it is ignored with no error.
Array Members: Maximum number of 50 actions.
StartTime
— (Date
)The earliest scheduled start time to return. If scheduled action names are provided, this property is ignored.
EndTime
— (Date
)The latest scheduled start time to return. If scheduled action names are provided, this property is ignored.
NextToken
— (String
)The token for the next set of items to return. (You received this token from a previous call.)
MaxRecords
— (Integer
)The maximum number of items to return with this call. The default value is
50
and the maximum value is100
.
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:ScheduledUpdateGroupActions
— (Array<map>
)The scheduled actions.
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
ScheduledActionName
— (String
)The name of the scheduled action.
ScheduledActionARN
— (String
)The Amazon Resource Name (ARN) of the scheduled action.
Time
— (Date
)This property is no longer used.
StartTime
— (Date
)The date and time in UTC for this action to start. For example,
"2019-06-01T00:00:00Z"
.EndTime
— (Date
)The date and time in UTC for the recurring schedule to end. For example,
"2019-06-01T00:00:00Z"
.Recurrence
— (String
)The recurring schedule for the action, in Unix cron syntax format.
When
StartTime
andEndTime
are specified withRecurrence
, they form the boundaries of when the recurring action starts and stops.MinSize
— (Integer
)The minimum size of the Auto Scaling group.
MaxSize
— (Integer
)The maximum size of the Auto Scaling group.
DesiredCapacity
— (Integer
)The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain.
TimeZone
— (String
)The time zone for the cron expression.
NextToken
— (String
)A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
-
(AWS.Response)
—
Returns:
describeTags(params = {}, callback) ⇒ AWS.Request
Describes the specified tags.
You can use filters to limit the results. For example, you can query for the tags for a specific Auto Scaling group. You can specify multiple values for a filter. A tag must match at least one of the specified values for it to be included in the results.
You can also specify multiple filters. The result includes information for a particular tag only if it matches all the filters. If there's no match, no special message is returned.
For more information, see Tag Auto Scaling groups and instances in the Amazon EC2 Auto Scaling User Guide.
Service Reference:
Examples:
To describe tags
/* This example describes the tags for the specified Auto Scaling group. */ var params = { Filters: [ { Name: "auto-scaling-group", Values: [ "my-auto-scaling-group" ] } ] }; autoscaling.describeTags(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { Tags: [ { Key: "Dept", PropagateAtLaunch: true, ResourceId: "my-auto-scaling-group", ResourceType: "auto-scaling-group", Value: "Research" }, { Key: "Role", PropagateAtLaunch: true, ResourceId: "my-auto-scaling-group", ResourceType: "auto-scaling-group", Value: "WebServer" } ] } */ });
Calling the describeTags operation
var params = { Filters: [ { Name: 'STRING_VALUE', Values: [ 'STRING_VALUE', /* more items */ ] }, /* more items */ ], MaxRecords: 'NUMBER_VALUE', NextToken: 'STRING_VALUE' }; autoscaling.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: {})
—
Filters
— (Array<map>
)One or more filters to scope the tags to return. The maximum number of filters per filter type (for example,
auto-scaling-group
) is 1000.Name
— (String
)The name of the filter.
The valid values for
Name
depend on which API operation you're using with the filter (DescribeAutoScalingGroups or DescribeTags).DescribeAutoScalingGroups
Valid values for
Name
include the following:-
tag-key
- Accepts tag keys. The results only include information about the Auto Scaling groups associated with these tag keys. -
tag-value
- Accepts tag values. The results only include information about the Auto Scaling groups associated with these tag values. -
tag:<key>
- Accepts the key/value combination of the tag. Use the tag key in the filter name and the tag value as the filter value. The results only include information about the Auto Scaling groups associated with the specified key/value combination.
DescribeTags
Valid values for
Name
include the following:-
auto-scaling-group
- Accepts the names of Auto Scaling groups. The results only include information about the tags associated with these Auto Scaling groups. -
key
- Accepts tag keys. The results only include information about the tags associated with these tag keys. -
value
- Accepts tag values. The results only include information about the tags associated with these tag values. -
propagate-at-launch
- Accepts a Boolean value, which specifies whether tags propagate to instances at launch. The results only include information about the tags associated with the specified Boolean value.
-
Values
— (Array<String>
)One or more filter values. Filter values are case-sensitive.
If you specify multiple values for a filter, the values are automatically logically joined with an
OR
, and the request returns all results that match any of the specified values. For example, specify "tag:environment" for the filter name and "production,development" for the filter values to find Auto Scaling groups with the tag "environment=production" or "environment=development".
NextToken
— (String
)The token for the next set of items to return. (You received this token from a previous call.)
MaxRecords
— (Integer
)The maximum number of items to return with this call. The default value is
50
and the maximum value is100
.
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:Tags
— (Array<map>
)One or more tags.
ResourceId
— (String
)The name of the group.
ResourceType
— (String
)The type of resource. The only supported value is
auto-scaling-group
.Key
— (String
)The tag key.
Value
— (String
)The tag value.
PropagateAtLaunch
— (Boolean
)Determines whether the tag is added to new instances as they are launched in the group.
NextToken
— (String
)A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
-
(AWS.Response)
—
Returns:
describeTerminationPolicyTypes(params = {}, callback) ⇒ AWS.Request
Describes the termination policies supported by Amazon EC2 Auto Scaling.
For more information, see Configure termination policies for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
Service Reference:
Examples:
To describe termination policy types
/* This example describes the available termination policy types. */ var params = {}; autoscaling.describeTerminationPolicyTypes(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { TerminationPolicyTypes: [ "ClosestToNextInstanceHour", "Default", "NewestInstance", "OldestInstance", "OldestLaunchConfiguration" ] } */ });
Calling the describeTerminationPolicyTypes operation
autoscaling.describeTerminationPolicyTypes(function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Parameters:
- params (Object) (defaults to: {})
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:TerminationPolicyTypes
— (Array<String>
)The termination policies supported by Amazon EC2 Auto Scaling:
OldestInstance
,OldestLaunchConfiguration
,NewestInstance
,ClosestToNextInstanceHour
,Default
,OldestLaunchTemplate
, andAllocationStrategy
.
-
(AWS.Response)
—
Returns:
describeTrafficSources(params = {}, callback) ⇒ AWS.Request
Gets information about the traffic sources for the specified Auto Scaling group.
You can optionally provide a traffic source type. If you provide a traffic source type, then the results only include that traffic source type.
If you do not provide a traffic source type, then the results include all the traffic sources for the specified Auto Scaling group.
Service Reference:
Examples:
To describe the target groups for an Auto Scaling group
/* This example describes the target groups attached to the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group" }; autoscaling.describeTrafficSources(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { NextToken: "", TrafficSources: [ { Identifier: "arn:aws:vpc-lattice:us-west-2:123456789012:targetgroup/tg-0e2f2665eEXAMPLE", State: "InService", Type: "vpc-lattice" } ] } */ });
Calling the describeTrafficSources operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ MaxRecords: 'NUMBER_VALUE', NextToken: 'STRING_VALUE', TrafficSourceType: 'STRING_VALUE' }; autoscaling.describeTrafficSources(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
TrafficSourceType
— (String
)The traffic source type that you want to describe.
The following lists the valid values:
-
elb
if the traffic source is a Classic Load Balancer. -
elbv2
if the traffic source is a Application Load Balancer, Gateway Load Balancer, or Network Load Balancer. -
vpc-lattice
if the traffic source is VPC Lattice.
-
NextToken
— (String
)The token for the next set of items to return. (You received this token from a previous call.)
MaxRecords
— (Integer
)The maximum number of items to return with this call. The maximum value is
50
.
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:TrafficSources
— (Array<map>
)Information about the traffic sources.
TrafficSource
— (String
)This is replaced by
Identifier
.State
— (String
)Describes the current state of a traffic source.
The state values are as follows:
-
Adding
- The Auto Scaling instances are being registered with the load balancer or target group. -
Added
- All Auto Scaling instances are registered with the load balancer or target group. -
InService
- For an Elastic Load Balancing load balancer or target group, at least one Auto Scaling instance passed anELB
health check. For VPC Lattice, at least one Auto Scaling instance passed anVPC_LATTICE
health check. -
Removing
- The Auto Scaling instances are being deregistered from the load balancer or target group. If connection draining (deregistration delay) is enabled, Elastic Load Balancing or VPC Lattice waits for in-flight requests to complete before deregistering the instances. -
Removed
- All Auto Scaling instances are deregistered from the load balancer or target group.
-
Identifier
— (String
)The unique identifier of the traffic source.
Type
— (String
)Provides additional context for the value of
Identifier
.The following lists the valid values:
-
elb
ifIdentifier
is the name of a Classic Load Balancer. -
elbv2
ifIdentifier
is the ARN of an Application Load Balancer, Gateway Load Balancer, or Network Load Balancer target group. -
vpc-lattice
ifIdentifier
is the ARN of a VPC Lattice target group.
Required if the identifier is the name of a Classic Load Balancer.
-
NextToken
— (String
)This string indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
-
(AWS.Response)
—
Returns:
describeWarmPool(params = {}, callback) ⇒ AWS.Request
Gets information about a warm pool and its instances.
For more information, see Warm pools for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
Service Reference:
Examples:
Calling the describeWarmPool operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ MaxRecords: 'NUMBER_VALUE', NextToken: 'STRING_VALUE' }; autoscaling.describeWarmPool(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
MaxRecords
— (Integer
)The maximum number of instances to return with this call. The maximum value is
50
.NextToken
— (String
)The token for the next set of instances to return. (You received this token from a previous 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. Thedata
object has the following properties:WarmPoolConfiguration
— (map
)The warm pool configuration details.
MaxGroupPreparedCapacity
— (Integer
)The maximum number of instances that are allowed to be in the warm pool or in any state except
Terminated
for the Auto Scaling group.MinSize
— (Integer
)The minimum number of instances to maintain in the warm pool.
PoolState
— (String
)The instance state to transition to after the lifecycle actions are complete.
Possible values include:"Stopped"
"Running"
"Hibernated"
Status
— (String
)The status of a warm pool that is marked for deletion.
Possible values include:"PendingDelete"
InstanceReusePolicy
— (map
)The instance reuse policy.
ReuseOnScaleIn
— (Boolean
)Specifies whether instances in the Auto Scaling group can be returned to the warm pool on scale in.
Instances
— (Array<map>
)The instances that are currently in the warm pool.
InstanceId
— required — (String
)The ID of the instance.
InstanceType
— (String
)The instance type of the EC2 instance.
AvailabilityZone
— required — (String
)The Availability Zone in which the instance is running.
LifecycleState
— required — (String
)A description of the current lifecycle state. The
Possible values include:Quarantined
state is not used. For more information, see Amazon EC2 Auto Scaling instance lifecycle in the Amazon EC2 Auto Scaling User Guide."Pending"
"Pending:Wait"
"Pending:Proceed"
"Quarantined"
"InService"
"Terminating"
"Terminating:Wait"
"Terminating:Proceed"
"Terminated"
"Detaching"
"Detached"
"EnteringStandby"
"Standby"
"Warmed:Pending"
"Warmed:Pending:Wait"
"Warmed:Pending:Proceed"
"Warmed:Terminating"
"Warmed:Terminating:Wait"
"Warmed:Terminating:Proceed"
"Warmed:Terminated"
"Warmed:Stopped"
"Warmed:Running"
"Warmed:Hibernated"
HealthStatus
— required — (String
)The last reported health status of the instance.
Healthy
means that the instance is healthy and should remain in service.Unhealthy
means that the instance is unhealthy and that Amazon EC2 Auto Scaling should terminate and replace it.LaunchConfigurationName
— (String
)The launch configuration associated with the instance.
LaunchTemplate
— (map
)The launch template for the instance.
LaunchTemplateId
— (String
)The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.LaunchTemplateName
— (String
)The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.Version
— (String
)The version number,
$Latest
, or$Default
. To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API. If the value is$Latest
, Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is$Default
, Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is$Default
.
ProtectedFromScaleIn
— required — (Boolean
)Indicates whether the instance is protected from termination by Amazon EC2 Auto Scaling when scaling in.
WeightedCapacity
— (String
)The number of capacity units contributed by the instance based on its instance type.
Valid Range: Minimum value of 1. Maximum value of 999.
NextToken
— (String
)This string indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.
-
(AWS.Response)
—
Returns:
detachInstances(params = {}, callback) ⇒ AWS.Request
Removes one or more instances from the specified Auto Scaling group.
After the instances are detached, you can manage them independent of the Auto Scaling group.
If you do not specify the option to decrement the desired capacity, Amazon EC2 Auto Scaling launches instances to replace the ones that are detached.
If there is a Classic Load Balancer attached to the Auto Scaling group, the instances are deregistered from the load balancer. If there are target groups attached to the Auto Scaling group, the instances are deregistered from the target groups.
For more information, see Detach or attach instances in the Amazon EC2 Auto Scaling User Guide.
Service Reference:
Examples:
To detach an instance from an Auto Scaling group
/* This example detaches the specified instance from the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", InstanceIds: [ "i-93633f9b" ], ShouldDecrementDesiredCapacity: true }; autoscaling.detachInstances(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { Activities: [ { ActivityId: "5091cb52-547a-47ce-a236-c9ccbc2cb2c9", AutoScalingGroupName: "my-auto-scaling-group", Cause: "At 2015-04-12T15:02:16Z instance i-93633f9b was detached in response to a user request, shrinking the capacity from 2 to 1.", Description: "Detaching EC2 instance: i-93633f9b", Details: "details", Progress: 50, StartTime: <Date Representation>, StatusCode: "InProgress" } ] } */ });
Calling the detachInstances operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ ShouldDecrementDesiredCapacity: true || false, /* required */ InstanceIds: [ 'STRING_VALUE', /* more items */ ] }; autoscaling.detachInstances(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: {})
—
InstanceIds
— (Array<String>
)The IDs of the instances. You can specify up to 20 instances.
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
ShouldDecrementDesiredCapacity
— (Boolean
)Indicates whether the Auto Scaling group decrements the desired capacity value by the number of instances detached.
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:Activities
— (Array<map>
)The activities related to detaching the instances from the Auto Scaling group.
ActivityId
— required — (String
)The ID of the activity.
AutoScalingGroupName
— required — (String
)The name of the Auto Scaling group.
Description
— (String
)A friendly, more verbose description of the activity.
Cause
— required — (String
)The reason the activity began.
StartTime
— required — (Date
)The start time of the activity.
EndTime
— (Date
)The end time of the activity.
StatusCode
— required — (String
)The current status of the activity.
Possible values include:"PendingSpotBidPlacement"
"WaitingForSpotInstanceRequestId"
"WaitingForSpotInstanceId"
"WaitingForInstanceId"
"PreInService"
"InProgress"
"WaitingForELBConnectionDraining"
"MidLifecycleAction"
"WaitingForInstanceWarmup"
"Successful"
"Failed"
"Cancelled"
"WaitingForConnectionDraining"
StatusMessage
— (String
)A friendly, more verbose description of the activity status.
Progress
— (Integer
)A value between 0 and 100 that indicates the progress of the activity.
Details
— (String
)The details about the activity.
AutoScalingGroupState
— (String
)The state of the Auto Scaling group, which is either
InService
orDeleted
.AutoScalingGroupARN
— (String
)The Amazon Resource Name (ARN) of the Auto Scaling group.
-
(AWS.Response)
—
Returns:
detachLoadBalancers(params = {}, callback) ⇒ AWS.Request
Note: This API operation is superseded by DetachTrafficSources, which can detach multiple traffic sources types. We recommend usingDetachTrafficSources
to simplify how you manage traffic sources. However, we continue to supportDetachLoadBalancers
. You can use both the originalDetachLoadBalancers
API operation andDetachTrafficSources
on the same Auto Scaling group.Detaches one or more Classic Load Balancers from the specified Auto Scaling group.
This operation detaches only Classic Load Balancers. If you have Application Load Balancers, Network Load Balancers, or Gateway Load Balancers, use the DetachLoadBalancerTargetGroups API instead.
When you detach a load balancer, it enters the
Removing
state while deregistering the instances in the group. When all instances are deregistered, then you can no longer describe the load balancer using the DescribeLoadBalancers API call. The instances remain running.Service Reference:
Examples:
To detach a load balancer from an Auto Scaling group
/* This example detaches the specified load balancer from the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", LoadBalancerNames: [ "my-load-balancer" ] }; autoscaling.detachLoadBalancers(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { } */ });
Calling the detachLoadBalancers operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ LoadBalancerNames: [ /* required */ 'STRING_VALUE', /* more items */ ] }; autoscaling.detachLoadBalancers(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
LoadBalancerNames
— (Array<String>
)The names of the load balancers. You can specify up to 10 load balancers.
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:
detachLoadBalancerTargetGroups(params = {}, callback) ⇒ AWS.Request
Note: This API operation is superseded by DetachTrafficSources, which can detach multiple traffic sources types. We recommend usingDetachTrafficSources
to simplify how you manage traffic sources. However, we continue to supportDetachLoadBalancerTargetGroups
. You can use both the originalDetachLoadBalancerTargetGroups
API operation andDetachTrafficSources
on the same Auto Scaling group.Detaches one or more target groups from the specified Auto Scaling group.
When you detach a target group, it enters the
Removing
state while deregistering the instances in the group. When all instances are deregistered, then you can no longer describe the target group using the DescribeLoadBalancerTargetGroups API call. The instances remain running.Note: You can use this operation to detach target groups that were attached by using AttachLoadBalancerTargetGroups, but not for target groups that were attached by using AttachTrafficSources.Service Reference:
Examples:
To detach a target group from an Auto Scaling group
/* This example detaches the specified target group from the specified Auto Scaling group */ var params = { AutoScalingGroupName: "my-auto-scaling-group", TargetGroupARNs: [ "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067" ] }; autoscaling.detachLoadBalancerTargetGroups(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { } */ });
Calling the detachLoadBalancerTargetGroups operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ TargetGroupARNs: [ /* required */ 'STRING_VALUE', /* more items */ ] }; autoscaling.detachLoadBalancerTargetGroups(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
TargetGroupARNs
— (Array<String>
)The Amazon Resource Names (ARN) of the target groups. You can specify up to 10 target 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.
-
(AWS.Response)
—
Returns:
detachTrafficSources(params = {}, callback) ⇒ AWS.Request
Detaches one or more traffic sources from the specified Auto Scaling group.
When you detach a traffic source, it enters the
Removing
state while deregistering the instances in the group. When all instances are deregistered, then you can no longer describe the traffic source using the DescribeTrafficSources API call. The instances continue to run.Service Reference:
Examples:
To detach a target group from an Auto Scaling group
/* This example detaches the specified target group from the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", TrafficSources: [ { Identifier: "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067" } ] }; autoscaling.detachTrafficSources(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { } */ });
Calling the detachTrafficSources operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ TrafficSources: [ /* required */ { Identifier: 'STRING_VALUE', /* required */ Type: 'STRING_VALUE' }, /* more items */ ] }; autoscaling.detachTrafficSources(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
TrafficSources
— (Array<map>
)The unique identifiers of one or more traffic sources. You can specify up to 10 traffic sources.
Identifier
— required — (String
)Identifies the traffic source.
For Application Load Balancers, Gateway Load Balancers, Network Load Balancers, and VPC Lattice, this will be the Amazon Resource Name (ARN) for a target group in this account and Region. For Classic Load Balancers, this will be the name of the Classic Load Balancer in this account and Region.
For example:
-
Application Load Balancer ARN:
arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/1234567890123456
-
Classic Load Balancer name:
my-classic-load-balancer
-
VPC Lattice ARN:
arn:aws:vpc-lattice:us-west-2:123456789012:targetgroup/tg-1234567890123456
To get the ARN of a target group for a Application Load Balancer, Gateway Load Balancer, or Network Load Balancer, or the name of a Classic Load Balancer, use the Elastic Load Balancing DescribeTargetGroups and DescribeLoadBalancers API operations.
To get the ARN of a target group for VPC Lattice, use the VPC Lattice GetTargetGroup API operation.
-
Type
— (String
)Provides additional context for the value of
Identifier
.The following lists the valid values:
-
elb
ifIdentifier
is the name of a Classic Load Balancer. -
elbv2
ifIdentifier
is the ARN of an Application Load Balancer, Gateway Load Balancer, or Network Load Balancer target group. -
vpc-lattice
ifIdentifier
is the ARN of a VPC Lattice target group.
Required if the identifier is the name of a Classic 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.
-
(AWS.Response)
—
Returns:
disableMetricsCollection(params = {}, callback) ⇒ AWS.Request
Disables group metrics collection for the specified Auto Scaling group.
Service Reference:
Examples:
To disable metrics collection for an Auto Scaling group
/* This example disables collecting data for the GroupDesiredCapacity metric for the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", Metrics: [ "GroupDesiredCapacity" ] }; autoscaling.disableMetricsCollection(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Calling the disableMetricsCollection operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ Metrics: [ 'STRING_VALUE', /* more items */ ] }; autoscaling.disableMetricsCollection(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
Metrics
— (Array<String>
)Identifies the metrics to disable.
You can specify one or more of the following metrics:
-
GroupMinSize
-
GroupMaxSize
-
GroupDesiredCapacity
-
GroupInServiceInstances
-
GroupPendingInstances
-
GroupStandbyInstances
-
GroupTerminatingInstances
-
GroupTotalInstances
-
GroupInServiceCapacity
-
GroupPendingCapacity
-
GroupStandbyCapacity
-
GroupTerminatingCapacity
-
GroupTotalCapacity
-
WarmPoolDesiredCapacity
-
WarmPoolWarmedCapacity
-
WarmPoolPendingCapacity
-
WarmPoolTerminatingCapacity
-
WarmPoolTotalCapacity
-
GroupAndWarmPoolDesiredCapacity
-
GroupAndWarmPoolTotalCapacity
If you omit this property, all metrics are disabled.
For more information, see Amazon CloudWatch metrics for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
-
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs.
-
(AWS.Response)
—
Returns:
enableMetricsCollection(params = {}, callback) ⇒ AWS.Request
Enables group metrics collection for the specified Auto Scaling group.
You can use these metrics to track changes in an Auto Scaling group and to set alarms on threshold values. You can view group metrics using the Amazon EC2 Auto Scaling console or the CloudWatch console. For more information, see Monitor CloudWatch metrics for your Auto Scaling groups and instances in the Amazon EC2 Auto Scaling User Guide.
Service Reference:
Examples:
To enable metrics collection for an Auto Scaling group
/* This example enables data collection for the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", Granularity: "1Minute" }; autoscaling.enableMetricsCollection(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Calling the enableMetricsCollection operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ Granularity: 'STRING_VALUE', /* required */ Metrics: [ 'STRING_VALUE', /* more items */ ] }; autoscaling.enableMetricsCollection(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
Metrics
— (Array<String>
)Identifies the metrics to enable.
You can specify one or more of the following metrics:
-
GroupMinSize
-
GroupMaxSize
-
GroupDesiredCapacity
-
GroupInServiceInstances
-
GroupPendingInstances
-
GroupStandbyInstances
-
GroupTerminatingInstances
-
GroupTotalInstances
-
GroupInServiceCapacity
-
GroupPendingCapacity
-
GroupStandbyCapacity
-
GroupTerminatingCapacity
-
GroupTotalCapacity
-
WarmPoolDesiredCapacity
-
WarmPoolWarmedCapacity
-
WarmPoolPendingCapacity
-
WarmPoolTerminatingCapacity
-
WarmPoolTotalCapacity
-
GroupAndWarmPoolDesiredCapacity
-
GroupAndWarmPoolTotalCapacity
If you specify
Granularity
and don't specify any metrics, all metrics are enabled.For more information, see Amazon CloudWatch metrics for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
-
Granularity
— (String
)The frequency at which Amazon EC2 Auto Scaling sends aggregated data to CloudWatch. The only valid value is
1Minute
.
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:
enterStandby(params = {}, callback) ⇒ AWS.Request
Moves the specified instances into the standby state.
If you choose to decrement the desired capacity of the Auto Scaling group, the instances can enter standby as long as the desired capacity of the Auto Scaling group after the instances are placed into standby is equal to or greater than the minimum capacity of the group.
If you choose not to decrement the desired capacity of the Auto Scaling group, the Auto Scaling group launches new instances to replace the instances on standby.
For more information, see Temporarily removing instances from your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.
Service Reference:
Examples:
To move instances into standby mode
/* This example puts the specified instance into standby mode. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", InstanceIds: [ "i-93633f9b" ], ShouldDecrementDesiredCapacity: true }; autoscaling.enterStandby(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { Activities: [ { ActivityId: "ffa056b4-6ed3-41ba-ae7c-249dfae6eba1", AutoScalingGroupName: "my-auto-scaling-group", Cause: "At 2015-04-12T15:10:23Z instance i-93633f9b was moved to standby in response to a user request, shrinking the capacity from 2 to 1.", Description: "Moving EC2 instance to Standby: i-93633f9b", Details: "details", Progress: 50, StartTime: <Date Representation>, StatusCode: "InProgress" } ] } */ });
Calling the enterStandby operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ ShouldDecrementDesiredCapacity: true || false, /* required */ InstanceIds: [ 'STRING_VALUE', /* more items */ ] }; autoscaling.enterStandby(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: {})
—
InstanceIds
— (Array<String>
)The IDs of the instances. You can specify up to 20 instances.
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
ShouldDecrementDesiredCapacity
— (Boolean
)Indicates whether to decrement the desired capacity of the Auto Scaling group by the number of instances moved to
Standby
mode.
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:Activities
— (Array<map>
)The activities related to moving instances into
Standby
mode.ActivityId
— required — (String
)The ID of the activity.
AutoScalingGroupName
— required — (String
)The name of the Auto Scaling group.
Description
— (String
)A friendly, more verbose description of the activity.
Cause
— required — (String
)The reason the activity began.
StartTime
— required — (Date
)The start time of the activity.
EndTime
— (Date
)The end time of the activity.
StatusCode
— required — (String
)The current status of the activity.
Possible values include:"PendingSpotBidPlacement"
"WaitingForSpotInstanceRequestId"
"WaitingForSpotInstanceId"
"WaitingForInstanceId"
"PreInService"
"InProgress"
"WaitingForELBConnectionDraining"
"MidLifecycleAction"
"WaitingForInstanceWarmup"
"Successful"
"Failed"
"Cancelled"
"WaitingForConnectionDraining"
StatusMessage
— (String
)A friendly, more verbose description of the activity status.
Progress
— (Integer
)A value between 0 and 100 that indicates the progress of the activity.
Details
— (String
)The details about the activity.
AutoScalingGroupState
— (String
)The state of the Auto Scaling group, which is either
InService
orDeleted
.AutoScalingGroupARN
— (String
)The Amazon Resource Name (ARN) of the Auto Scaling group.
-
(AWS.Response)
—
Returns:
executePolicy(params = {}, callback) ⇒ AWS.Request
Executes the specified policy. This can be useful for testing the design of your scaling policy.
Service Reference:
Examples:
To execute a scaling policy
/* This example executes the specified policy. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", BreachThreshold: 50.0, MetricValue: 59.0, PolicyName: "my-step-scale-out-policy" }; autoscaling.executePolicy(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Calling the executePolicy operation
var params = { PolicyName: 'STRING_VALUE', /* required */ AutoScalingGroupName: 'STRING_VALUE', BreachThreshold: 'NUMBER_VALUE', HonorCooldown: true || false, MetricValue: 'NUMBER_VALUE' }; autoscaling.executePolicy(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
PolicyName
— (String
)The name or ARN of the policy.
HonorCooldown
— (Boolean
)Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to complete before executing the policy.
Valid only if the policy type is
SimpleScaling
. For more information, see Scaling cooldowns for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.MetricValue
— (Float
)The metric value to compare to
BreachThreshold
. This enables you to execute a policy of typeStepScaling
and determine which step adjustment to use. For example, if the breach threshold is 50 and you want to use a step adjustment with a lower bound of 0 and an upper bound of 10, you can set the metric value to 59.If you specify a metric value that doesn't correspond to a step adjustment for the policy, the call returns an error.
Required if the policy type is
StepScaling
and not supported otherwise.BreachThreshold
— (Float
)The breach threshold for the alarm.
Required if the policy type is
StepScaling
and not supported otherwise.
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:
exitStandby(params = {}, callback) ⇒ AWS.Request
Moves the specified instances out of the standby state.
After you put the instances back in service, the desired capacity is incremented.
For more information, see Temporarily removing instances from your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.
Service Reference:
Examples:
To move instances out of standby mode
/* This example moves the specified instance out of standby mode. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", InstanceIds: [ "i-93633f9b" ] }; autoscaling.exitStandby(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { Activities: [ { ActivityId: "142928e1-a2dc-453a-9b24-b85ad6735928", AutoScalingGroupName: "my-auto-scaling-group", Cause: "At 2015-04-12T15:14:29Z instance i-93633f9b was moved out of standby in response to a user request, increasing the capacity from 1 to 2.", Description: "Moving EC2 instance out of Standby: i-93633f9b", Details: "details", Progress: 30, StartTime: <Date Representation>, StatusCode: "PreInService" } ] } */ });
Calling the exitStandby operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ InstanceIds: [ 'STRING_VALUE', /* more items */ ] }; autoscaling.exitStandby(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: {})
—
InstanceIds
— (Array<String>
)The IDs of the instances. You can specify up to 20 instances.
AutoScalingGroupName
— (String
)The name of the Auto Scaling 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. Thedata
object has the following properties:Activities
— (Array<map>
)The activities related to moving instances out of
Standby
mode.ActivityId
— required — (String
)The ID of the activity.
AutoScalingGroupName
— required — (String
)The name of the Auto Scaling group.
Description
— (String
)A friendly, more verbose description of the activity.
Cause
— required — (String
)The reason the activity began.
StartTime
— required — (Date
)The start time of the activity.
EndTime
— (Date
)The end time of the activity.
StatusCode
— required — (String
)The current status of the activity.
Possible values include:"PendingSpotBidPlacement"
"WaitingForSpotInstanceRequestId"
"WaitingForSpotInstanceId"
"WaitingForInstanceId"
"PreInService"
"InProgress"
"WaitingForELBConnectionDraining"
"MidLifecycleAction"
"WaitingForInstanceWarmup"
"Successful"
"Failed"
"Cancelled"
"WaitingForConnectionDraining"
StatusMessage
— (String
)A friendly, more verbose description of the activity status.
Progress
— (Integer
)A value between 0 and 100 that indicates the progress of the activity.
Details
— (String
)The details about the activity.
AutoScalingGroupState
— (String
)The state of the Auto Scaling group, which is either
InService
orDeleted
.AutoScalingGroupARN
— (String
)The Amazon Resource Name (ARN) of the Auto Scaling group.
-
(AWS.Response)
—
Returns:
getPredictiveScalingForecast(params = {}, callback) ⇒ AWS.Request
Retrieves the forecast data for a predictive scaling policy.
Load forecasts are predictions of the hourly load values using historical load data from CloudWatch and an analysis of historical trends. Capacity forecasts are represented as predicted values for the minimum capacity that is needed on an hourly basis, based on the hourly load forecast.
A minimum of 24 hours of data is required to create the initial forecasts. However, having a full 14 days of historical data results in more accurate forecasts.
For more information, see Predictive scaling for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
Service Reference:
Examples:
Calling the getPredictiveScalingForecast operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ EndTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789, /* required */ PolicyName: 'STRING_VALUE', /* required */ StartTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789 /* required */ }; autoscaling.getPredictiveScalingForecast(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
PolicyName
— (String
)The name of the policy.
StartTime
— (Date
)The inclusive start time of the time range for the forecast data to get. At most, the date and time can be one year before the current date and time.
EndTime
— (Date
)The exclusive end time of the time range for the forecast data to get. The maximum time duration between the start and end time is 30 days.
Although this parameter can accept a date and time that is more than two days in the future, the availability of forecast data has limits. Amazon EC2 Auto Scaling only issues forecasts for periods of two days in advance.
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:LoadForecast
— (Array<map>
)The load forecast.
Timestamps
— required — (Array<Date>
)The timestamps for the data points, in UTC format.
Values
— required — (Array<Float>
)The values of the data points.
MetricSpecification
— required — (map
)The metric specification for the load forecast.
TargetValue
— required — (Float
)Specifies the target utilization.
Note: Some metrics are based on a count instead of a percentage, such as the request count for an Application Load Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these metrics, specify the target utilization as the optimal average request or message count per instance during any one-minute interval.PredefinedMetricPairSpecification
— (map
)The predefined metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate scaling metric and load metric to use.
PredefinedMetricType
— required — (String
)Indicates which metrics to use. There are two different types of metrics for each metric type: one is a load metric and one is a scaling metric. For example, if the metric type is
Possible values include:ASGCPUUtilization
, the Auto Scaling group's total CPU metric is used as the load metric, and the average CPU metric is used for the scaling metric."ASGCPUUtilization"
"ASGNetworkIn"
"ASGNetworkOut"
"ALBRequestCount"
ResourceLabel
— (String
)A label that uniquely identifies a specific Application Load Balancer target group from which to determine the total and average request count served by your Auto Scaling group. You can't specify a resource label unless the target group is attached to the Auto Scaling group.
You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is:
app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff
.Where:
-
app/<load-balancer-name>/<load-balancer-id> is the final portion of the load balancer ARN
-
targetgroup/<target-group-name>/<target-group-id> is the final portion of the target group ARN.
To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.
-
PredefinedScalingMetricSpecification
— (map
)The predefined scaling metric specification.
PredefinedMetricType
— required — (String
)The metric type.
Possible values include:"ASGAverageCPUUtilization"
"ASGAverageNetworkIn"
"ASGAverageNetworkOut"
"ALBRequestCountPerTarget"
ResourceLabel
— (String
)A label that uniquely identifies a specific Application Load Balancer target group from which to determine the average request count served by your Auto Scaling group. You can't specify a resource label unless the target group is attached to the Auto Scaling group.
You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is:
app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff
.Where:
-
app/<load-balancer-name>/<load-balancer-id> is the final portion of the load balancer ARN
-
targetgroup/<target-group-name>/<target-group-id> is the final portion of the target group ARN.
To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.
-
PredefinedLoadMetricSpecification
— (map
)The predefined load metric specification.
PredefinedMetricType
— required — (String
)The metric type.
Possible values include:"ASGTotalCPUUtilization"
"ASGTotalNetworkIn"
"ASGTotalNetworkOut"
"ALBTargetGroupRequestCount"
ResourceLabel
— (String
)A label that uniquely identifies a specific Application Load Balancer target group from which to determine the request count served by your Auto Scaling group. You can't specify a resource label unless the target group is attached to the Auto Scaling group.
You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is:
app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff
.Where:
-
app/<load-balancer-name>/<load-balancer-id> is the final portion of the load balancer ARN
-
targetgroup/<target-group-name>/<target-group-id> is the final portion of the target group ARN.
To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.
-
CustomizedScalingMetricSpecification
— (map
)The customized scaling metric specification.
MetricDataQueries
— required — (Array<map>
)One or more metric data queries to provide the data points for a scaling metric. Use multiple metric data queries only if you are performing a math expression on returned data.
Id
— required — (String
)A short name that identifies the object's results in the response. This name must be unique among all
MetricDataQuery
objects specified for a single scaling policy. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscores. The first character must be a lowercase letter.Expression
— (String
)The math expression to perform on the returned data, if this object is performing a math expression. This expression can use the
Id
of the other metrics to refer to those metrics, and can also use theId
of other expressions to use the result of those expressions.Conditional: Within each
MetricDataQuery
object, you must specify eitherExpression
orMetricStat
, but not both.MetricStat
— (map
)Information about the metric data to return.
Conditional: Within each
MetricDataQuery
object, you must specify eitherExpression
orMetricStat
, but not both.Metric
— required — (map
)The CloudWatch metric to return, including the metric name, namespace, and dimensions. To get the exact metric name, namespace, and dimensions, inspect the Metric object that is returned by a call to ListMetrics.
Namespace
— required — (String
)The namespace of the metric. For more information, see the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide.
MetricName
— required — (String
)The name of the metric.
Dimensions
— (Array<map>
)The dimensions for the metric. For the list of available dimensions, see the Amazon Web Services documentation available from the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide.
Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.
Name
— required — (String
)The name of the dimension.
Value
— required — (String
)The value of the dimension.
Stat
— required — (String
)The statistic to return. It can include any CloudWatch statistic or extended statistic. For a list of valid values, see the table in Statistics in the Amazon CloudWatch User Guide.
The most commonly used metrics for predictive scaling are
Average
andSum
.Unit
— (String
)The unit to use for the returned data points. For a complete list of the units that CloudWatch supports, see the MetricDatum data type in the Amazon CloudWatch API Reference.
Label
— (String
)A human-readable label for this metric or expression. This is especially useful if this is a math expression, so that you know what the value represents.
ReturnData
— (Boolean
)Indicates whether to return the timestamps and raw data values of this metric.
If you use any math expressions, specify
true
for this value for only the final math expression that the metric specification is based on. You must specifyfalse
forReturnData
for all the other metrics and expressions used in the metric specification.If you are only retrieving metrics and not performing any math expressions, do not specify anything for
ReturnData
. This sets it to its default (true
).
CustomizedLoadMetricSpecification
— (map
)The customized load metric specification.
MetricDataQueries
— required — (Array<map>
)One or more metric data queries to provide the data points for a load metric. Use multiple metric data queries only if you are performing a math expression on returned data.
Id
— required — (String
)A short name that identifies the object's results in the response. This name must be unique among all
MetricDataQuery
objects specified for a single scaling policy. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscores. The first character must be a lowercase letter.Expression
— (String
)The math expression to perform on the returned data, if this object is performing a math expression. This expression can use the
Id
of the other metrics to refer to those metrics, and can also use theId
of other expressions to use the result of those expressions.Conditional: Within each
MetricDataQuery
object, you must specify eitherExpression
orMetricStat
, but not both.MetricStat
— (map
)Information about the metric data to return.
Conditional: Within each
MetricDataQuery
object, you must specify eitherExpression
orMetricStat
, but not both.Metric
— required — (map
)The CloudWatch metric to return, including the metric name, namespace, and dimensions. To get the exact metric name, namespace, and dimensions, inspect the Metric object that is returned by a call to ListMetrics.
Namespace
— required — (String
)The namespace of the metric. For more information, see the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide.
MetricName
— required — (String
)The name of the metric.
Dimensions
— (Array<map>
)The dimensions for the metric. For the list of available dimensions, see the Amazon Web Services documentation available from the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide.
Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.
Name
— required — (String
)The name of the dimension.
Value
— required — (String
)The value of the dimension.
Stat
— required — (String
)The statistic to return. It can include any CloudWatch statistic or extended statistic. For a list of valid values, see the table in Statistics in the Amazon CloudWatch User Guide.
The most commonly used metrics for predictive scaling are
Average
andSum
.Unit
— (String
)The unit to use for the returned data points. For a complete list of the units that CloudWatch supports, see the MetricDatum data type in the Amazon CloudWatch API Reference.
Label
— (String
)A human-readable label for this metric or expression. This is especially useful if this is a math expression, so that you know what the value represents.
ReturnData
— (Boolean
)Indicates whether to return the timestamps and raw data values of this metric.
If you use any math expressions, specify
true
for this value for only the final math expression that the metric specification is based on. You must specifyfalse
forReturnData
for all the other metrics and expressions used in the metric specification.If you are only retrieving metrics and not performing any math expressions, do not specify anything for
ReturnData
. This sets it to its default (true
).
CustomizedCapacityMetricSpecification
— (map
)The customized capacity metric specification.
MetricDataQueries
— required — (Array<map>
)One or more metric data queries to provide the data points for a capacity metric. Use multiple metric data queries only if you are performing a math expression on returned data.
Id
— required — (String
)A short name that identifies the object's results in the response. This name must be unique among all
MetricDataQuery
objects specified for a single scaling policy. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscores. The first character must be a lowercase letter.Expression
— (String
)The math expression to perform on the returned data, if this object is performing a math expression. This expression can use the
Id
of the other metrics to refer to those metrics, and can also use theId
of other expressions to use the result of those expressions.Conditional: Within each
MetricDataQuery
object, you must specify eitherExpression
orMetricStat
, but not both.MetricStat
— (map
)Information about the metric data to return.
Conditional: Within each
MetricDataQuery
object, you must specify eitherExpression
orMetricStat
, but not both.Metric
— required — (map
)The CloudWatch metric to return, including the metric name, namespace, and dimensions. To get the exact metric name, namespace, and dimensions, inspect the Metric object that is returned by a call to ListMetrics.
Namespace
— required — (String
)The namespace of the metric. For more information, see the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide.
MetricName
— required — (String
)The name of the metric.
Dimensions
— (Array<map>
)The dimensions for the metric. For the list of available dimensions, see the Amazon Web Services documentation available from the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide.
Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.
Name
— required — (String
)The name of the dimension.
Value
— required — (String
)The value of the dimension.
Stat
— required — (String
)The statistic to return. It can include any CloudWatch statistic or extended statistic. For a list of valid values, see the table in Statistics in the Amazon CloudWatch User Guide.
The most commonly used metrics for predictive scaling are
Average
andSum
.Unit
— (String
)The unit to use for the returned data points. For a complete list of the units that CloudWatch supports, see the MetricDatum data type in the Amazon CloudWatch API Reference.
Label
— (String
)A human-readable label for this metric or expression. This is especially useful if this is a math expression, so that you know what the value represents.
ReturnData
— (Boolean
)Indicates whether to return the timestamps and raw data values of this metric.
If you use any math expressions, specify
true
for this value for only the final math expression that the metric specification is based on. You must specifyfalse
forReturnData
for all the other metrics and expressions used in the metric specification.If you are only retrieving metrics and not performing any math expressions, do not specify anything for
ReturnData
. This sets it to its default (true
).
CapacityForecast
— (map
)The capacity forecast.
Timestamps
— required — (Array<Date>
)The timestamps for the data points, in UTC format.
Values
— required — (Array<Float>
)The values of the data points.
UpdateTime
— (Date
)The time the forecast was made.
-
(AWS.Response)
—
Returns:
putLifecycleHook(params = {}, callback) ⇒ AWS.Request
Creates or updates a lifecycle hook for the specified Auto Scaling group.
Lifecycle hooks let you create solutions that are aware of events in the Auto Scaling instance lifecycle, and then perform a custom action on instances when the corresponding lifecycle event occurs.
This step is a part of the procedure for adding a lifecycle hook to an Auto Scaling group:
-
(Optional) Create a launch template or launch configuration with a user data script that runs while an instance is in a wait state due to a lifecycle hook.
-
(Optional) Create a Lambda function and a rule that allows Amazon EventBridge to invoke your Lambda function when an instance is put into a wait state due to a lifecycle hook.
-
(Optional) Create a notification target and an IAM role. The target can be either an Amazon SQS queue or an Amazon SNS topic. The role allows Amazon EC2 Auto Scaling to publish lifecycle notifications to the target.
-
Create the lifecycle hook. Specify whether the hook is used when the instances launch or terminate.
-
If you need more time, record the lifecycle action heartbeat to keep the instance in a wait state using the RecordLifecycleActionHeartbeat API call.
-
If you finish before the timeout period ends, send a callback by using the CompleteLifecycleAction API call.
For more information, see Amazon EC2 Auto Scaling lifecycle hooks in the Amazon EC2 Auto Scaling User Guide.
If you exceed your maximum limit of lifecycle hooks, which by default is 50 per Auto Scaling group, the call fails.
You can view the lifecycle hooks for an Auto Scaling group using the DescribeLifecycleHooks API call. If you are no longer using a lifecycle hook, you can delete it by calling the DeleteLifecycleHook API.
Service Reference:
Examples:
To create a launch lifecycle hook
/* This example creates a lifecycle hook for instance launch. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", DefaultResult: "CONTINUE", HeartbeatTimeout: 300, LifecycleHookName: "my-launch-lifecycle-hook", LifecycleTransition: "autoscaling:EC2_INSTANCE_LAUNCHING" }; autoscaling.putLifecycleHook(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { } */ });
Calling the putLifecycleHook operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ LifecycleHookName: 'STRING_VALUE', /* required */ DefaultResult: 'STRING_VALUE', HeartbeatTimeout: 'NUMBER_VALUE', LifecycleTransition: 'STRING_VALUE', NotificationMetadata: 'STRING_VALUE', NotificationTargetARN: 'STRING_VALUE', RoleARN: 'STRING_VALUE' }; autoscaling.putLifecycleHook(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: {})
—
LifecycleHookName
— (String
)The name of the lifecycle hook.
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
LifecycleTransition
— (String
)The lifecycle transition. For Auto Scaling groups, there are two major lifecycle transitions.
-
To create a lifecycle hook for scale-out events, specify
autoscaling:EC2_INSTANCE_LAUNCHING
. -
To create a lifecycle hook for scale-in events, specify
autoscaling:EC2_INSTANCE_TERMINATING
.
Required for new lifecycle hooks, but optional when updating existing hooks.
-
RoleARN
— (String
)The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.
Valid only if the notification target is an Amazon SNS topic or an Amazon SQS queue. Required for new lifecycle hooks, but optional when updating existing hooks.
NotificationTargetARN
— (String
)The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling uses to notify you when an instance is in a wait state for the lifecycle hook. You can specify either an Amazon SNS topic or an Amazon SQS queue.
If you specify an empty string, this overrides the current ARN.
This operation uses the JSON format when sending notifications to an Amazon SQS queue, and an email key-value pair format when sending notifications to an Amazon SNS topic.
When you specify a notification target, Amazon EC2 Auto Scaling sends it a test message. Test messages contain the following additional key-value pair:
"Event": "autoscaling:TEST_NOTIFICATION"
.NotificationMetadata
— (String
)Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.
HeartbeatTimeout
— (Integer
)The maximum time, in seconds, that can elapse before the lifecycle hook times out. The range is from
30
to7200
seconds. The default value is3600
seconds (1 hour).DefaultResult
— (String
)The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs. The default value is
ABANDON
.Valid values:
CONTINUE
|ABANDON
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:
putNotificationConfiguration(params = {}, callback) ⇒ AWS.Request
Configures an Auto Scaling group to send notifications when specified events take place. Subscribers to the specified topic can have messages delivered to an endpoint such as a web server or an email address.
This configuration overwrites any existing configuration.
For more information, see Amazon SNS notification options for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
If you exceed your maximum limit of SNS topics, which is 10 per Auto Scaling group, the call fails.
Service Reference:
Examples:
To add an Auto Scaling notification
/* This example adds the specified notification to the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", NotificationTypes: [ "autoscaling:TEST_NOTIFICATION" ], TopicARN: "arn:aws:sns:us-west-2:123456789012:my-sns-topic" }; autoscaling.putNotificationConfiguration(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Calling the putNotificationConfiguration operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ NotificationTypes: [ /* required */ 'STRING_VALUE', /* more items */ ], TopicARN: 'STRING_VALUE' /* required */ }; autoscaling.putNotificationConfiguration(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
TopicARN
— (String
)The Amazon Resource Name (ARN) of the Amazon SNS topic.
NotificationTypes
— (Array<String>
)The type of event that causes the notification to be sent. To query the notification types supported by Amazon EC2 Auto Scaling, call the DescribeAutoScalingNotificationTypes API.
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:
putScalingPolicy(params = {}, callback) ⇒ AWS.Request
Creates or updates a scaling policy for an Auto Scaling group. Scaling policies are used to scale an Auto Scaling group based on configurable metrics. If no policies are defined, the dynamic scaling and predictive scaling features are not used.
For more information about using dynamic scaling, see Target tracking scaling policies and Step and simple scaling policies in the Amazon EC2 Auto Scaling User Guide.
For more information about using predictive scaling, see Predictive scaling for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
You can view the scaling policies for an Auto Scaling group using the DescribePolicies API call. If you are no longer using a scaling policy, you can delete it by calling the DeletePolicy API.
Service Reference:
Examples:
To add a scaling policy to an Auto Scaling group
/* This example adds the specified policy to the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", PolicyName: "alb1000-target-tracking-scaling-policy", PolicyType: "TargetTrackingScaling", TargetTrackingConfiguration: { PredefinedMetricSpecification: { PredefinedMetricType: "ALBRequestCountPerTarget", ResourceLabel: "app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff" }, TargetValue: 1000.0 } }; autoscaling.putScalingPolicy(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { Alarms: [ { AlarmARN: "arn:aws:cloudwatch:us-west-2:123456789012:alarm:TargetTracking-my-asg-AlarmHigh-fc0e4183-23ac-497e-9992-691c9980c38e", AlarmName: "TargetTracking-my-asg-AlarmHigh-fc0e4183-23ac-497e-9992-691c9980c38e" }, { AlarmARN: "arn:aws:cloudwatch:us-west-2:123456789012:alarm:TargetTracking-my-asg-AlarmLow-61a39305-ed0c-47af-bd9e-471a352ee1a2", AlarmName: "TargetTracking-my-asg-AlarmLow-61a39305-ed0c-47af-bd9e-471a352ee1a2" } ], PolicyARN: "arn:aws:autoscaling:us-west-2:123456789012:scalingPolicy:228f02c2-c665-4bfd-aaac-8b04080bea3c:autoScalingGroupName/my-auto-scaling-group:policyName/alb1000-target-tracking-scaling-policy" } */ });
Calling the putScalingPolicy operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ PolicyName: 'STRING_VALUE', /* required */ AdjustmentType: 'STRING_VALUE', Cooldown: 'NUMBER_VALUE', Enabled: true || false, EstimatedInstanceWarmup: 'NUMBER_VALUE', MetricAggregationType: 'STRING_VALUE', MinAdjustmentMagnitude: 'NUMBER_VALUE', MinAdjustmentStep: 'NUMBER_VALUE', PolicyType: 'STRING_VALUE', PredictiveScalingConfiguration: { MetricSpecifications: [ /* required */ { TargetValue: 'NUMBER_VALUE', /* required */ CustomizedCapacityMetricSpecification: { MetricDataQueries: [ /* required */ { Id: 'STRING_VALUE', /* required */ Expression: 'STRING_VALUE', Label: 'STRING_VALUE', MetricStat: { Metric: { /* required */ MetricName: 'STRING_VALUE', /* required */ Namespace: 'STRING_VALUE', /* required */ Dimensions: [ { Name: 'STRING_VALUE', /* required */ Value: 'STRING_VALUE' /* required */ }, /* more items */ ] }, Stat: 'STRING_VALUE', /* required */ Unit: 'STRING_VALUE' }, ReturnData: true || false }, /* more items */ ] }, CustomizedLoadMetricSpecification: { MetricDataQueries: [ /* required */ { Id: 'STRING_VALUE', /* required */ Expression: 'STRING_VALUE', Label: 'STRING_VALUE', MetricStat: { Metric: { /* required */ MetricName: 'STRING_VALUE', /* required */ Namespace: 'STRING_VALUE', /* required */ Dimensions: [ { Name: 'STRING_VALUE', /* required */ Value: 'STRING_VALUE' /* required */ }, /* more items */ ] }, Stat: 'STRING_VALUE', /* required */ Unit: 'STRING_VALUE' }, ReturnData: true || false }, /* more items */ ] }, CustomizedScalingMetricSpecification: { MetricDataQueries: [ /* required */ { Id: 'STRING_VALUE', /* required */ Expression: 'STRING_VALUE', Label: 'STRING_VALUE', MetricStat: { Metric: { /* required */ MetricName: 'STRING_VALUE', /* required */ Namespace: 'STRING_VALUE', /* required */ Dimensions: [ { Name: 'STRING_VALUE', /* required */ Value: 'STRING_VALUE' /* required */ }, /* more items */ ] }, Stat: 'STRING_VALUE', /* required */ Unit: 'STRING_VALUE' }, ReturnData: true || false }, /* more items */ ] }, PredefinedLoadMetricSpecification: { PredefinedMetricType: ASGTotalCPUUtilization | ASGTotalNetworkIn | ASGTotalNetworkOut | ALBTargetGroupRequestCount, /* required */ ResourceLabel: 'STRING_VALUE' }, PredefinedMetricPairSpecification: { PredefinedMetricType: ASGCPUUtilization | ASGNetworkIn | ASGNetworkOut | ALBRequestCount, /* required */ ResourceLabel: 'STRING_VALUE' }, PredefinedScalingMetricSpecification: { PredefinedMetricType: ASGAverageCPUUtilization | ASGAverageNetworkIn | ASGAverageNetworkOut | ALBRequestCountPerTarget, /* required */ ResourceLabel: 'STRING_VALUE' } }, /* more items */ ], MaxCapacityBreachBehavior: HonorMaxCapacity | IncreaseMaxCapacity, MaxCapacityBuffer: 'NUMBER_VALUE', Mode: ForecastAndScale | ForecastOnly, SchedulingBufferTime: 'NUMBER_VALUE' }, ScalingAdjustment: 'NUMBER_VALUE', StepAdjustments: [ { ScalingAdjustment: 'NUMBER_VALUE', /* required */ MetricIntervalLowerBound: 'NUMBER_VALUE', MetricIntervalUpperBound: 'NUMBER_VALUE' }, /* more items */ ], TargetTrackingConfiguration: { TargetValue: 'NUMBER_VALUE', /* required */ CustomizedMetricSpecification: { Dimensions: [ { Name: 'STRING_VALUE', /* required */ Value: 'STRING_VALUE' /* required */ }, /* more items */ ], MetricName: 'STRING_VALUE', Metrics: [ { Id: 'STRING_VALUE', /* required */ Expression: 'STRING_VALUE', Label: 'STRING_VALUE', MetricStat: { Metric: { /* required */ MetricName: 'STRING_VALUE', /* required */ Namespace: 'STRING_VALUE', /* required */ Dimensions: [ { Name: 'STRING_VALUE', /* required */ Value: 'STRING_VALUE' /* required */ }, /* more items */ ] }, Stat: 'STRING_VALUE', /* required */ Unit: 'STRING_VALUE' }, ReturnData: true || false }, /* more items */ ], Namespace: 'STRING_VALUE', Statistic: Average | Minimum | Maximum | SampleCount | Sum, Unit: 'STRING_VALUE' }, DisableScaleIn: true || false, PredefinedMetricSpecification: { PredefinedMetricType: ASGAverageCPUUtilization | ASGAverageNetworkIn | ASGAverageNetworkOut | ALBRequestCountPerTarget, /* required */ ResourceLabel: 'STRING_VALUE' } } }; autoscaling.putScalingPolicy(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
PolicyName
— (String
)The name of the policy.
PolicyType
— (String
)One of the following policy types:
-
TargetTrackingScaling
-
StepScaling
-
SimpleScaling
(default) -
PredictiveScaling
-
AdjustmentType
— (String
)Specifies how the scaling adjustment is interpreted (for example, an absolute number or a percentage). The valid values are
ChangeInCapacity
,ExactCapacity
, andPercentChangeInCapacity
.Required if the policy type is
StepScaling
orSimpleScaling
. For more information, see Scaling adjustment types in the Amazon EC2 Auto Scaling User Guide.MinAdjustmentStep
— (Integer
)Available for backward compatibility. Use
MinAdjustmentMagnitude
instead.MinAdjustmentMagnitude
— (Integer
)The minimum value to scale by when the adjustment type is
PercentChangeInCapacity
. For example, suppose that you create a step scaling policy to scale out an Auto Scaling group by 25 percent and you specify aMinAdjustmentMagnitude
of 2. If the group has 4 instances and the scaling policy is performed, 25 percent of 4 is 1. However, because you specified aMinAdjustmentMagnitude
of 2, Amazon EC2 Auto Scaling scales out the group by 2 instances.Valid only if the policy type is
StepScaling
orSimpleScaling
. For more information, see Scaling adjustment types in the Amazon EC2 Auto Scaling User Guide.Note: Some Auto Scaling groups use instance weights. In this case, set theMinAdjustmentMagnitude
to a value that is at least as large as your largest instance weight.ScalingAdjustment
— (Integer
)The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity. For exact capacity, you must specify a non-negative value.
Required if the policy type is
SimpleScaling
. (Not used with any other policy type.)Cooldown
— (Integer
)A cooldown period, in seconds, that applies to a specific simple scaling policy. When a cooldown period is specified here, it overrides the default cooldown.
Valid only if the policy type is
SimpleScaling
. For more information, see Scaling cooldowns for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.Default: None
MetricAggregationType
— (String
)The aggregation type for the CloudWatch metrics. The valid values are
Minimum
,Maximum
, andAverage
. If the aggregation type is null, the value is treated asAverage
.Valid only if the policy type is
StepScaling
.StepAdjustments
— (Array<map>
)A set of adjustments that enable you to scale based on the size of the alarm breach.
Required if the policy type is
StepScaling
. (Not used with any other policy type.)MetricIntervalLowerBound
— (Float
)The lower bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is above the breach threshold, the lower bound is inclusive (the metric must be greater than or equal to the threshold plus the lower bound). Otherwise, it is exclusive (the metric must be greater than the threshold plus the lower bound). A null value indicates negative infinity.
MetricIntervalUpperBound
— (Float
)The upper bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is above the breach threshold, the upper bound is exclusive (the metric must be less than the threshold plus the upper bound). Otherwise, it is inclusive (the metric must be less than or equal to the threshold plus the upper bound). A null value indicates positive infinity.
The upper bound must be greater than the lower bound.
ScalingAdjustment
— required — (Integer
)The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity. For exact capacity, you must specify a non-negative value.
EstimatedInstanceWarmup
— (Integer
)Not needed if the default instance warmup is defined for the group.
The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics. This warm-up period applies to instances launched due to a specific target tracking or step scaling policy. When a warm-up period is specified here, it overrides the default instance warmup.
Valid only if the policy type is
TargetTrackingScaling
orStepScaling
.Note: The default is to use the value for the default instance warmup defined for the group. If default instance warmup is null, thenEstimatedInstanceWarmup
falls back to the value of default cooldown.TargetTrackingConfiguration
— (map
)A target tracking scaling policy. Provides support for predefined or custom metrics.
The following predefined metrics are available:
-
ASGAverageCPUUtilization
-
ASGAverageNetworkIn
-
ASGAverageNetworkOut
-
ALBRequestCountPerTarget
If you specify
ALBRequestCountPerTarget
for the metric, you must specify theResourceLabel
property with thePredefinedMetricSpecification
.For more information, see TargetTrackingConfiguration in the Amazon EC2 Auto Scaling API Reference.
Required if the policy type is
TargetTrackingScaling
.PredefinedMetricSpecification
— (map
)A predefined metric. You must specify either a predefined metric or a customized metric.
PredefinedMetricType
— required — (String
)The metric type. The following predefined metrics are available:
-
ASGAverageCPUUtilization
- Average CPU utilization of the Auto Scaling group. -
ASGAverageNetworkIn
- Average number of bytes received on all network interfaces by the Auto Scaling group. -
ASGAverageNetworkOut
- Average number of bytes sent out on all network interfaces by the Auto Scaling group. -
ALBRequestCountPerTarget
- Average Application Load Balancer request count per target for your Auto Scaling group.
"ASGAverageCPUUtilization"
"ASGAverageNetworkIn"
"ASGAverageNetworkOut"
"ALBRequestCountPerTarget"
-
ResourceLabel
— (String
)A label that uniquely identifies a specific Application Load Balancer target group from which to determine the average request count served by your Auto Scaling group. You can't specify a resource label unless the target group is attached to the Auto Scaling group.
You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is:
app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff
.Where:
-
app/<load-balancer-name>/<load-balancer-id> is the final portion of the load balancer ARN
-
targetgroup/<target-group-name>/<target-group-id> is the final portion of the target group ARN.
To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.
-
CustomizedMetricSpecification
— (map
)A customized metric. You must specify either a predefined metric or a customized metric.
MetricName
— (String
)The name of the metric. To get the exact metric name, namespace, and dimensions, inspect the Metric object that is returned by a call to ListMetrics.
Namespace
— (String
)The namespace of the metric.
Dimensions
— (Array<map>
)The dimensions of the metric.
Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.
Name
— required — (String
)The name of the dimension.
Value
— required — (String
)The value of the dimension.
Statistic
— (String
)The statistic of the metric.
Possible values include:"Average"
"Minimum"
"Maximum"
"SampleCount"
"Sum"
Unit
— (String
)The unit of the metric. For a complete list of the units that CloudWatch supports, see the MetricDatum data type in the Amazon CloudWatch API Reference.
Metrics
— (Array<map>
)The metrics to include in the target tracking scaling policy, as a metric data query. This can include both raw metric and metric math expressions.
Id
— required — (String
)A short name that identifies the object's results in the response. This name must be unique among all
TargetTrackingMetricDataQuery
objects specified for a single scaling policy. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscores. The first character must be a lowercase letter.Expression
— (String
)The math expression to perform on the returned data, if this object is performing a math expression. This expression can use the
Id
of the other metrics to refer to those metrics, and can also use theId
of other expressions to use the result of those expressions.Conditional: Within each
TargetTrackingMetricDataQuery
object, you must specify eitherExpression
orMetricStat
, but not both.MetricStat
— (map
)Information about the metric data to return.
Conditional: Within each
TargetTrackingMetricDataQuery
object, you must specify eitherExpression
orMetricStat
, but not both.Metric
— required — (map
)The metric to use.
Namespace
— required — (String
)The namespace of the metric. For more information, see the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide.
MetricName
— required — (String
)The name of the metric.
Dimensions
— (Array<map>
)The dimensions for the metric. For the list of available dimensions, see the Amazon Web Services documentation available from the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide.
Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.
Name
— required — (String
)The name of the dimension.
Value
— required — (String
)The value of the dimension.
Stat
— required — (String
)The statistic to return. It can include any CloudWatch statistic or extended statistic. For a list of valid values, see the table in Statistics in the Amazon CloudWatch User Guide.
The most commonly used metric for scaling is
Average
.Unit
— (String
)The unit to use for the returned data points. For a complete list of the units that CloudWatch supports, see the MetricDatum data type in the Amazon CloudWatch API Reference.
Label
— (String
)A human-readable label for this metric or expression. This is especially useful if this is a math expression, so that you know what the value represents.
ReturnData
— (Boolean
)Indicates whether to return the timestamps and raw data values of this metric.
If you use any math expressions, specify
true
for this value for only the final math expression that the metric specification is based on. You must specifyfalse
forReturnData
for all the other metrics and expressions used in the metric specification.If you are only retrieving metrics and not performing any math expressions, do not specify anything for
ReturnData
. This sets it to its default (true
).
TargetValue
— required — (Float
)The target value for the metric.
Note: Some metrics are based on a count instead of a percentage, such as the request count for an Application Load Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these metrics, specify the target utilization as the optimal average request or message count per instance during any one-minute interval.DisableScaleIn
— (Boolean
)Indicates whether scaling in by the target tracking scaling policy is disabled. If scaling in is disabled, the target tracking scaling policy doesn't remove instances from the Auto Scaling group. Otherwise, the target tracking scaling policy can remove instances from the Auto Scaling group. The default is
false
.
-
Enabled
— (Boolean
)Indicates whether the scaling policy is enabled or disabled. The default is enabled. For more information, see Disable a scaling policy for an Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.
PredictiveScalingConfiguration
— (map
)A predictive scaling policy. Provides support for predefined and custom metrics.
Predefined metrics include CPU utilization, network in/out, and the Application Load Balancer request count.
For more information, see PredictiveScalingConfiguration in the Amazon EC2 Auto Scaling API Reference.
Required if the policy type is
PredictiveScaling
.MetricSpecifications
— required — (Array<map>
)This structure includes the metrics and target utilization to use for predictive scaling.
This is an array, but we currently only support a single metric specification. That is, you can specify a target value and a single metric pair, or a target value and one scaling metric and one load metric.
TargetValue
— required — (Float
)Specifies the target utilization.
Note: Some metrics are based on a count instead of a percentage, such as the request count for an Application Load Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these metrics, specify the target utilization as the optimal average request or message count per instance during any one-minute interval.PredefinedMetricPairSpecification
— (map
)The predefined metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate scaling metric and load metric to use.
PredefinedMetricType
— required — (String
)Indicates which metrics to use. There are two different types of metrics for each metric type: one is a load metric and one is a scaling metric. For example, if the metric type is
Possible values include:ASGCPUUtilization
, the Auto Scaling group's total CPU metric is used as the load metric, and the average CPU metric is used for the scaling metric."ASGCPUUtilization"
"ASGNetworkIn"
"ASGNetworkOut"
"ALBRequestCount"
ResourceLabel
— (String
)A label that uniquely identifies a specific Application Load Balancer target group from which to determine the total and average request count served by your Auto Scaling group. You can't specify a resource label unless the target group is attached to the Auto Scaling group.
You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is:
app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff
.Where:
-
app/<load-balancer-name>/<load-balancer-id> is the final portion of the load balancer ARN
-
targetgroup/<target-group-name>/<target-group-id> is the final portion of the target group ARN.
To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.
-
PredefinedScalingMetricSpecification
— (map
)The predefined scaling metric specification.
PredefinedMetricType
— required — (String
)The metric type.
Possible values include:"ASGAverageCPUUtilization"
"ASGAverageNetworkIn"
"ASGAverageNetworkOut"
"ALBRequestCountPerTarget"
ResourceLabel
— (String
)A label that uniquely identifies a specific Application Load Balancer target group from which to determine the average request count served by your Auto Scaling group. You can't specify a resource label unless the target group is attached to the Auto Scaling group.
You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is:
app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff
.Where:
-
app/<load-balancer-name>/<load-balancer-id> is the final portion of the load balancer ARN
-
targetgroup/<target-group-name>/<target-group-id> is the final portion of the target group ARN.
To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.
-
PredefinedLoadMetricSpecification
— (map
)The predefined load metric specification.
PredefinedMetricType
— required — (String
)The metric type.
Possible values include:"ASGTotalCPUUtilization"
"ASGTotalNetworkIn"
"ASGTotalNetworkOut"
"ALBTargetGroupRequestCount"
ResourceLabel
— (String
)A label that uniquely identifies a specific Application Load Balancer target group from which to determine the request count served by your Auto Scaling group. You can't specify a resource label unless the target group is attached to the Auto Scaling group.
You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is:
app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff
.Where:
-
app/<load-balancer-name>/<load-balancer-id> is the final portion of the load balancer ARN
-
targetgroup/<target-group-name>/<target-group-id> is the final portion of the target group ARN.
To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.
-
CustomizedScalingMetricSpecification
— (map
)The customized scaling metric specification.
MetricDataQueries
— required — (Array<map>
)One or more metric data queries to provide the data points for a scaling metric. Use multiple metric data queries only if you are performing a math expression on returned data.
Id
— required — (String
)A short name that identifies the object's results in the response. This name must be unique among all
MetricDataQuery
objects specified for a single scaling policy. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscores. The first character must be a lowercase letter.Expression
— (String
)The math expression to perform on the returned data, if this object is performing a math expression. This expression can use the
Id
of the other metrics to refer to those metrics, and can also use theId
of other expressions to use the result of those expressions.Conditional: Within each
MetricDataQuery
object, you must specify eitherExpression
orMetricStat
, but not both.MetricStat
— (map
)Information about the metric data to return.
Conditional: Within each
MetricDataQuery
object, you must specify eitherExpression
orMetricStat
, but not both.Metric
— required — (map
)The CloudWatch metric to return, including the metric name, namespace, and dimensions. To get the exact metric name, namespace, and dimensions, inspect the Metric object that is returned by a call to ListMetrics.
Namespace
— required — (String
)The namespace of the metric. For more information, see the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide.
MetricName
— required — (String
)The name of the metric.
Dimensions
— (Array<map>
)The dimensions for the metric. For the list of available dimensions, see the Amazon Web Services documentation available from the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide.
Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.
Name
— required — (String
)The name of the dimension.
Value
— required — (String
)The value of the dimension.
Stat
— required — (String
)The statistic to return. It can include any CloudWatch statistic or extended statistic. For a list of valid values, see the table in Statistics in the Amazon CloudWatch User Guide.
The most commonly used metrics for predictive scaling are
Average
andSum
.Unit
— (String
)The unit to use for the returned data points. For a complete list of the units that CloudWatch supports, see the MetricDatum data type in the Amazon CloudWatch API Reference.
Label
— (String
)A human-readable label for this metric or expression. This is especially useful if this is a math expression, so that you know what the value represents.
ReturnData
— (Boolean
)Indicates whether to return the timestamps and raw data values of this metric.
If you use any math expressions, specify
true
for this value for only the final math expression that the metric specification is based on. You must specifyfalse
forReturnData
for all the other metrics and expressions used in the metric specification.If you are only retrieving metrics and not performing any math expressions, do not specify anything for
ReturnData
. This sets it to its default (true
).
CustomizedLoadMetricSpecification
— (map
)The customized load metric specification.
MetricDataQueries
— required — (Array<map>
)One or more metric data queries to provide the data points for a load metric. Use multiple metric data queries only if you are performing a math expression on returned data.
Id
— required — (String
)A short name that identifies the object's results in the response. This name must be unique among all
MetricDataQuery
objects specified for a single scaling policy. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscores. The first character must be a lowercase letter.Expression
— (String
)The math expression to perform on the returned data, if this object is performing a math expression. This expression can use the
Id
of the other metrics to refer to those metrics, and can also use theId
of other expressions to use the result of those expressions.Conditional: Within each
MetricDataQuery
object, you must specify eitherExpression
orMetricStat
, but not both.MetricStat
— (map
)Information about the metric data to return.
Conditional: Within each
MetricDataQuery
object, you must specify eitherExpression
orMetricStat
, but not both.Metric
— required — (map
)The CloudWatch metric to return, including the metric name, namespace, and dimensions. To get the exact metric name, namespace, and dimensions, inspect the Metric object that is returned by a call to ListMetrics.
Namespace
— required — (String
)The namespace of the metric. For more information, see the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide.
MetricName
— required — (String
)The name of the metric.
Dimensions
— (Array<map>
)The dimensions for the metric. For the list of available dimensions, see the Amazon Web Services documentation available from the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide.
Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.
Name
— required — (String
)The name of the dimension.
Value
— required — (String
)The value of the dimension.
Stat
— required — (String
)The statistic to return. It can include any CloudWatch statistic or extended statistic. For a list of valid values, see the table in Statistics in the Amazon CloudWatch User Guide.
The most commonly used metrics for predictive scaling are
Average
andSum
.Unit
— (String
)The unit to use for the returned data points. For a complete list of the units that CloudWatch supports, see the MetricDatum data type in the Amazon CloudWatch API Reference.
Label
— (String
)A human-readable label for this metric or expression. This is especially useful if this is a math expression, so that you know what the value represents.
ReturnData
— (Boolean
)Indicates whether to return the timestamps and raw data values of this metric.
If you use any math expressions, specify
true
for this value for only the final math expression that the metric specification is based on. You must specifyfalse
forReturnData
for all the other metrics and expressions used in the metric specification.If you are only retrieving metrics and not performing any math expressions, do not specify anything for
ReturnData
. This sets it to its default (true
).
CustomizedCapacityMetricSpecification
— (map
)The customized capacity metric specification.
MetricDataQueries
— required — (Array<map>
)One or more metric data queries to provide the data points for a capacity metric. Use multiple metric data queries only if you are performing a math expression on returned data.
Id
— required — (String
)A short name that identifies the object's results in the response. This name must be unique among all
MetricDataQuery
objects specified for a single scaling policy. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscores. The first character must be a lowercase letter.Expression
— (String
)The math expression to perform on the returned data, if this object is performing a math expression. This expression can use the
Id
of the other metrics to refer to those metrics, and can also use theId
of other expressions to use the result of those expressions.Conditional: Within each
MetricDataQuery
object, you must specify eitherExpression
orMetricStat
, but not both.MetricStat
— (map
)Information about the metric data to return.
Conditional: Within each
MetricDataQuery
object, you must specify eitherExpression
orMetricStat
, but not both.Metric
— required — (map
)The CloudWatch metric to return, including the metric name, namespace, and dimensions. To get the exact metric name, namespace, and dimensions, inspect the Metric object that is returned by a call to ListMetrics.
Namespace
— required — (String
)The namespace of the metric. For more information, see the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide.
MetricName
— required — (String
)The name of the metric.
Dimensions
— (Array<map>
)The dimensions for the metric. For the list of available dimensions, see the Amazon Web Services documentation available from the table in Amazon Web Services services that publish CloudWatch metrics in the Amazon CloudWatch User Guide.
Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.
Name
— required — (String
)The name of the dimension.
Value
— required — (String
)The value of the dimension.
Stat
— required — (String
)The statistic to return. It can include any CloudWatch statistic or extended statistic. For a list of valid values, see the table in Statistics in the Amazon CloudWatch User Guide.
The most commonly used metrics for predictive scaling are
Average
andSum
.Unit
— (String
)The unit to use for the returned data points. For a complete list of the units that CloudWatch supports, see the MetricDatum data type in the Amazon CloudWatch API Reference.
Label
— (String
)A human-readable label for this metric or expression. This is especially useful if this is a math expression, so that you know what the value represents.
ReturnData
— (Boolean
)Indicates whether to return the timestamps and raw data values of this metric.
If you use any math expressions, specify
true
for this value for only the final math expression that the metric specification is based on. You must specifyfalse
forReturnData
for all the other metrics and expressions used in the metric specification.If you are only retrieving metrics and not performing any math expressions, do not specify anything for
ReturnData
. This sets it to its default (true
).
Mode
— (String
)The predictive scaling mode. Defaults to
Possible values include:ForecastOnly
if not specified."ForecastAndScale"
"ForecastOnly"
SchedulingBufferTime
— (Integer
)The amount of time, in seconds, by which the instance launch time can be advanced. For example, the forecast says to add capacity at 10:00 AM, and you choose to pre-launch instances by 5 minutes. In that case, the instances will be launched at 9:55 AM. The intention is to give resources time to be provisioned. It can take a few minutes to launch an EC2 instance. The actual amount of time required depends on several factors, such as the size of the instance and whether there are startup scripts to complete.
The value must be less than the forecast interval duration of 3600 seconds (60 minutes). Defaults to 300 seconds if not specified.
MaxCapacityBreachBehavior
— (String
)Defines the behavior that should be applied if the forecast capacity approaches or exceeds the maximum capacity of the Auto Scaling group. Defaults to
HonorMaxCapacity
if not specified.The following are possible values:
-
HonorMaxCapacity
- Amazon EC2 Auto Scaling can't increase the maximum capacity of the group when the forecast capacity is close to or exceeds the maximum capacity. -
IncreaseMaxCapacity
- Amazon EC2 Auto Scaling can increase the maximum capacity of the group when the forecast capacity is close to or exceeds the maximum capacity. The upper limit is determined by the forecasted capacity and the value forMaxCapacityBuffer
.
Use caution when allowing the maximum capacity to be automatically increased. This can lead to more instances being launched than intended if the increased maximum capacity is not monitored and managed. The increased maximum capacity then becomes the new normal maximum capacity for the Auto Scaling group until you manually update it. The maximum capacity does not automatically decrease back to the original maximum.
"HonorMaxCapacity"
"IncreaseMaxCapacity"
-
MaxCapacityBuffer
— (Integer
)The size of the capacity buffer to use when the forecast capacity is close to or exceeds the maximum capacity. The value is specified as a percentage relative to the forecast capacity. For example, if the buffer is 10, this means a 10 percent buffer, such that if the forecast capacity is 50, and the maximum capacity is 40, then the effective maximum capacity is 55.
If set to 0, Amazon EC2 Auto Scaling may scale capacity higher than the maximum capacity to equal but not exceed forecast capacity.
Required if the
MaxCapacityBreachBehavior
property is set toIncreaseMaxCapacity
, and cannot be used otherwise.
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:PolicyARN
— (String
)The Amazon Resource Name (ARN) of the policy.
Alarms
— (Array<map>
)The CloudWatch alarms created for the target tracking scaling policy.
AlarmName
— (String
)The name of the alarm.
AlarmARN
— (String
)The Amazon Resource Name (ARN) of the alarm.
-
(AWS.Response)
—
Returns:
putScheduledUpdateGroupAction(params = {}, callback) ⇒ AWS.Request
Creates or updates a scheduled scaling action for an Auto Scaling group.
For more information, see Scheduled scaling in the Amazon EC2 Auto Scaling User Guide.
You can view the scheduled actions for an Auto Scaling group using the DescribeScheduledActions API call. If you are no longer using a scheduled action, you can delete it by calling the DeleteScheduledAction API.
If you try to schedule your action in the past, Amazon EC2 Auto Scaling returns an error message.
Service Reference:
Examples:
To add a scheduled action to an Auto Scaling group
/* This example adds the specified scheduled action to the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", DesiredCapacity: 4, EndTime: <Date Representation>, MaxSize: 6, MinSize: 2, ScheduledActionName: "my-scheduled-action", StartTime: <Date Representation> }; autoscaling.putScheduledUpdateGroupAction(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Calling the putScheduledUpdateGroupAction operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ ScheduledActionName: 'STRING_VALUE', /* required */ DesiredCapacity: 'NUMBER_VALUE', EndTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789, MaxSize: 'NUMBER_VALUE', MinSize: 'NUMBER_VALUE', Recurrence: 'STRING_VALUE', StartTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789, Time: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789, TimeZone: 'STRING_VALUE' }; autoscaling.putScheduledUpdateGroupAction(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
ScheduledActionName
— (String
)The name of this scaling action.
Time
— (Date
)This property is no longer used.
StartTime
— (Date
)The date and time for this action to start, in YYYY-MM-DDThh:mm:ssZ format in UTC/GMT only and in quotes (for example,
"2021-06-01T00:00:00Z"
).If you specify
Recurrence
andStartTime
, Amazon EC2 Auto Scaling performs the action at this time, and then performs the action based on the specified recurrence.EndTime
— (Date
)The date and time for the recurring schedule to end, in UTC. For example,
"2021-06-01T00:00:00Z"
.Recurrence
— (String
)The recurring schedule for this action. This format consists of five fields separated by white spaces: [Minute] [Hour] [Day_of_Month] [Month_of_Year] [Day_of_Week]. The value must be in quotes (for example,
"30 0 1 1,6,12 *"
). For more information about this format, see Crontab.When
StartTime
andEndTime
are specified withRecurrence
, they form the boundaries of when the recurring action starts and stops.Cron expressions use Universal Coordinated Time (UTC) by default.
MinSize
— (Integer
)The minimum size of the Auto Scaling group.
MaxSize
— (Integer
)The maximum size of the Auto Scaling group.
DesiredCapacity
— (Integer
)The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain. It can scale beyond this capacity if you add more scaling conditions.
Note: You must specify at least one of the following properties:MaxSize
,MinSize
, orDesiredCapacity
.TimeZone
— (String
)Specifies the time zone for a cron expression. If a time zone is not provided, UTC is used by default.
Valid values are the canonical names of the IANA time zones, derived from the IANA Time Zone Database (such as
Etc/GMT+9
orPacific/Tahiti
). For more information, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.
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:
putWarmPool(params = {}, callback) ⇒ AWS.Request
Creates or updates a warm pool for the specified Auto Scaling group. A warm pool is a pool of pre-initialized EC2 instances that sits alongside the Auto Scaling group. Whenever your application needs to scale out, the Auto Scaling group can draw on the warm pool to meet its new desired capacity.
This operation must be called from the Region in which the Auto Scaling group was created.
You can view the instances in the warm pool using the DescribeWarmPool API call. If you are no longer using a warm pool, you can delete it by calling the DeleteWarmPool API.
For more information, see Warm pools for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
Service Reference:
Examples:
To create a warm pool for an Auto Scaling group
/* This example creates a warm pool for the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", InstanceReusePolicy: { ReuseOnScaleIn: true }, MinSize: 30, PoolState: "Hibernated" }; autoscaling.putWarmPool(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { } */ });
Calling the putWarmPool operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ InstanceReusePolicy: { ReuseOnScaleIn: true || false }, MaxGroupPreparedCapacity: 'NUMBER_VALUE', MinSize: 'NUMBER_VALUE', PoolState: Stopped | Running | Hibernated }; autoscaling.putWarmPool(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
MaxGroupPreparedCapacity
— (Integer
)Specifies the maximum number of instances that are allowed to be in the warm pool or in any state except
Terminated
for the Auto Scaling group. This is an optional property. Specify it only if you do not want the warm pool size to be determined by the difference between the group's maximum capacity and its desired capacity.If a value for
MaxGroupPreparedCapacity
is not specified, Amazon EC2 Auto Scaling launches and maintains the difference between the group's maximum capacity and its desired capacity. If you specify a value forMaxGroupPreparedCapacity
, Amazon EC2 Auto Scaling uses the difference between theMaxGroupPreparedCapacity
and the desired capacity instead.The size of the warm pool is dynamic. Only when
MaxGroupPreparedCapacity
andMinSize
are set to the same value does the warm pool have an absolute size.If the desired capacity of the Auto Scaling group is higher than the
MaxGroupPreparedCapacity
, the capacity of the warm pool is 0, unless you specify a value forMinSize
. To remove a value that you previously set, include the property but specify -1 for the value.MinSize
— (Integer
)Specifies the minimum number of instances to maintain in the warm pool. This helps you to ensure that there is always a certain number of warmed instances available to handle traffic spikes. Defaults to 0 if not specified.
PoolState
— (String
)Sets the instance state to transition to after the lifecycle actions are complete. Default is
Possible values include:Stopped
."Stopped"
"Running"
"Hibernated"
InstanceReusePolicy
— (map
)Indicates whether instances in the Auto Scaling group can be returned to the warm pool on scale in. The default is to terminate instances in the Auto Scaling group when the group scales in.
ReuseOnScaleIn
— (Boolean
)Specifies whether instances in the Auto Scaling group can be returned to the warm pool on scale in.
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:
recordLifecycleActionHeartbeat(params = {}, callback) ⇒ AWS.Request
Records a heartbeat for the lifecycle action associated with the specified token or instance. This extends the timeout by the length of time defined using the PutLifecycleHook API call.
This step is a part of the procedure for adding a lifecycle hook to an Auto Scaling group:
-
(Optional) Create a launch template or launch configuration with a user data script that runs while an instance is in a wait state due to a lifecycle hook.
-
(Optional) Create a Lambda function and a rule that allows Amazon EventBridge to invoke your Lambda function when an instance is put into a wait state due to a lifecycle hook.
-
(Optional) Create a notification target and an IAM role. The target can be either an Amazon SQS queue or an Amazon SNS topic. The role allows Amazon EC2 Auto Scaling to publish lifecycle notifications to the target.
-
Create the lifecycle hook. Specify whether the hook is used when the instances launch or terminate.
-
If you need more time, record the lifecycle action heartbeat to keep the instance in a wait state.
-
If you finish before the timeout period ends, send a callback by using the CompleteLifecycleAction API call.
For more information, see Amazon EC2 Auto Scaling lifecycle hooks in the Amazon EC2 Auto Scaling User Guide.
Service Reference:
Examples:
To record a lifecycle action heartbeat
/* This example records a lifecycle action heartbeat to keep the instance in a pending state. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", LifecycleActionToken: "bcd2f1b8-9a78-44d3-8a7a-4dd07d7cf635", LifecycleHookName: "my-lifecycle-hook" }; autoscaling.recordLifecycleActionHeartbeat(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { } */ });
Calling the recordLifecycleActionHeartbeat operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ LifecycleHookName: 'STRING_VALUE', /* required */ InstanceId: 'STRING_VALUE', LifecycleActionToken: 'STRING_VALUE' }; autoscaling.recordLifecycleActionHeartbeat(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: {})
—
LifecycleHookName
— (String
)The name of the lifecycle hook.
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
LifecycleActionToken
— (String
)A token that uniquely identifies a specific lifecycle action associated with an instance. Amazon EC2 Auto Scaling sends this token to the notification target that you specified when you created the lifecycle hook.
InstanceId
— (String
)The ID of the instance.
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:
resumeProcesses(params = {}, callback) ⇒ AWS.Request
Resumes the specified suspended auto scaling processes, or all suspended process, for the specified Auto Scaling group.
For more information, see Suspend and resume Amazon EC2 Auto Scaling processes in the Amazon EC2 Auto Scaling User Guide.
Service Reference:
Examples:
To resume Auto Scaling processes
/* This example resumes the specified suspended scaling process for the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", ScalingProcesses: [ "AlarmNotification" ] }; autoscaling.resumeProcesses(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Calling the resumeProcesses operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ ScalingProcesses: [ 'STRING_VALUE', /* more items */ ] }; autoscaling.resumeProcesses(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
ScalingProcesses
— (Array<String>
)One or more of the following processes:
-
Launch
-
Terminate
-
AddToLoadBalancer
-
AlarmNotification
-
AZRebalance
-
HealthCheck
-
InstanceRefresh
-
ReplaceUnhealthy
-
ScheduledActions
If you omit this property, all processes are specified.
-
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:
rollbackInstanceRefresh(params = {}, callback) ⇒ AWS.Request
Cancels an instance refresh that is in progress and rolls back any changes that it made. Amazon EC2 Auto Scaling replaces any instances that were replaced during the instance refresh. This restores your Auto Scaling group to the configuration that it was using before the start of the instance refresh.
This operation is part of the instance refresh feature in Amazon EC2 Auto Scaling, which helps you update instances in your Auto Scaling group after you make configuration changes.
A rollback is not supported in the following situations:
-
There is no desired configuration specified for the instance refresh.
-
The Auto Scaling group has a launch template that uses an Amazon Web Services Systems Manager parameter instead of an AMI ID for the
ImageId
property. -
The Auto Scaling group uses the launch template's
$Latest
or$Default
version.
When you receive a successful response from this operation, Amazon EC2 Auto Scaling immediately begins replacing instances. You can check the status of this operation through the DescribeInstanceRefreshes API operation.
Service Reference:
Examples:
Calling the rollbackInstanceRefresh operation
var params = { AutoScalingGroupName: 'STRING_VALUE' /* required */ }; autoscaling.rollbackInstanceRefresh(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling 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. Thedata
object has the following properties:InstanceRefreshId
— (String
)The instance refresh ID associated with the request. This is the unique ID assigned to the instance refresh when it was started.
-
(AWS.Response)
—
Returns:
setDesiredCapacity(params = {}, callback) ⇒ AWS.Request
Sets the size of the specified Auto Scaling group.
If a scale-in activity occurs as a result of a new
DesiredCapacity
value that is lower than the current size of the group, the Auto Scaling group uses its termination policy to determine which instances to terminate.For more information, see Manual scaling in the Amazon EC2 Auto Scaling User Guide.
Service Reference:
Examples:
To set the desired capacity for an Auto Scaling group
/* This example sets the desired capacity for the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", DesiredCapacity: 2, HonorCooldown: true }; autoscaling.setDesiredCapacity(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Calling the setDesiredCapacity operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ DesiredCapacity: 'NUMBER_VALUE', /* required */ HonorCooldown: true || false }; autoscaling.setDesiredCapacity(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
DesiredCapacity
— (Integer
)The desired capacity is the initial capacity of the Auto Scaling group after this operation completes and the capacity it attempts to maintain.
HonorCooldown
— (Boolean
)Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to complete before initiating a scaling activity to set your Auto Scaling group to its new capacity. By default, Amazon EC2 Auto Scaling does not honor the cooldown period during manual scaling activities.
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:
setInstanceHealth(params = {}, callback) ⇒ AWS.Request
Sets the health status of the specified instance.
For more information, see Set up a custom health check for your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.
Service Reference:
Examples:
To set the health status of an instance
/* This example sets the health status of the specified instance to Unhealthy. */ var params = { HealthStatus: "Unhealthy", InstanceId: "i-93633f9b" }; autoscaling.setInstanceHealth(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Calling the setInstanceHealth operation
var params = { HealthStatus: 'STRING_VALUE', /* required */ InstanceId: 'STRING_VALUE', /* required */ ShouldRespectGracePeriod: true || false }; autoscaling.setInstanceHealth(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: {})
—
InstanceId
— (String
)The ID of the instance.
HealthStatus
— (String
)The health status of the instance. Set to
Healthy
to have the instance remain in service. Set toUnhealthy
to have the instance be out of service. Amazon EC2 Auto Scaling terminates and replaces the unhealthy instance.ShouldRespectGracePeriod
— (Boolean
)If the Auto Scaling group of the specified instance has a
HealthCheckGracePeriod
specified for the group, by default, this call respects the grace period. Set this toFalse
, to have the call not respect the grace period associated with the group.For more information about the health check grace period, see Set the health check grace period for an Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.
Callback (callback):
-
function(err, data) { ... }
Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.
Context (this):
-
(AWS.Response)
—
the response object containing error, data properties, and the original request object.
Parameters:
-
err
(Error)
—
the error object returned from the request. Set to
null
if the request is successful. -
data
(Object)
—
the de-serialized data returned from the request. Set to
null
if a request error occurs.
-
(AWS.Response)
—
Returns:
setInstanceProtection(params = {}, callback) ⇒ AWS.Request
Updates the instance protection settings of the specified instances. This operation cannot be called on instances in a warm pool.
For more information, see Use instance scale-in protection in the Amazon EC2 Auto Scaling User Guide.
If you exceed your maximum limit of instance IDs, which is 50 per Auto Scaling group, the call fails.
Service Reference:
Examples:
To enable instance protection for an instance
/* This example enables instance protection for the specified instance. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", InstanceIds: [ "i-93633f9b" ], ProtectedFromScaleIn: true }; autoscaling.setInstanceProtection(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { } */ });
To disable instance protection for an instance
/* This example disables instance protection for the specified instance. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", InstanceIds: [ "i-93633f9b" ], ProtectedFromScaleIn: false }; autoscaling.setInstanceProtection(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { } */ });
Calling the setInstanceProtection operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ InstanceIds: [ /* required */ 'STRING_VALUE', /* more items */ ], ProtectedFromScaleIn: true || false /* required */ }; autoscaling.setInstanceProtection(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: {})
—
InstanceIds
— (Array<String>
)One or more instance IDs. You can specify up to 50 instances.
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
ProtectedFromScaleIn
— (Boolean
)Indicates whether the instance is protected from termination by Amazon EC2 Auto Scaling when scaling in.
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:
startInstanceRefresh(params = {}, callback) ⇒ AWS.Request
Starts an instance refresh.
This operation is part of the instance refresh feature in Amazon EC2 Auto Scaling, which helps you update instances in your Auto Scaling group. This feature is helpful, for example, when you have a new AMI or a new user data script. You just need to create a new launch template that specifies the new AMI or user data script. Then start an instance refresh to immediately begin the process of updating instances in the group.
If successful, the request's response contains a unique ID that you can use to track the progress of the instance refresh. To query its status, call the DescribeInstanceRefreshes API. To describe the instance refreshes that have already run, call the DescribeInstanceRefreshes API. To cancel an instance refresh that is in progress, use the CancelInstanceRefresh API.
An instance refresh might fail for several reasons, such as EC2 launch failures, misconfigured health checks, or not ignoring or allowing the termination of instances that are in
Standby
state or protected from scale in. You can monitor for failed EC2 launches using the scaling activities. To find the scaling activities, call the DescribeScalingActivities API.If you enable auto rollback, your Auto Scaling group will be rolled back automatically when the instance refresh fails. You can enable this feature before starting an instance refresh by specifying the
AutoRollback
property in the instance refresh preferences. Otherwise, to roll back an instance refresh before it finishes, use the RollbackInstanceRefresh API.Service Reference:
Examples:
To start an instance refresh
/* This example starts an instance refresh for the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", DesiredConfiguration: { LaunchTemplate: { LaunchTemplateName: "my-template-for-auto-scaling", Version: "$Latest" } }, Preferences: { AlarmSpecification: { Alarms: [ "my-alarm" ] }, AutoRollback: true, InstanceWarmup: 200, MaxHealthyPercentage: 120, MinHealthyPercentage: 90 } }; autoscaling.startInstanceRefresh(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { InstanceRefreshId: "08b91cf7-8fa6-48af-b6a6-d227f40f1b9b" } */ });
Calling the startInstanceRefresh operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ DesiredConfiguration: { LaunchTemplate: { LaunchTemplateId: 'STRING_VALUE', LaunchTemplateName: 'STRING_VALUE', Version: 'STRING_VALUE' }, MixedInstancesPolicy: { InstancesDistribution: { OnDemandAllocationStrategy: 'STRING_VALUE', OnDemandBaseCapacity: 'NUMBER_VALUE', OnDemandPercentageAboveBaseCapacity: 'NUMBER_VALUE', SpotAllocationStrategy: 'STRING_VALUE', SpotInstancePools: 'NUMBER_VALUE', SpotMaxPrice: 'STRING_VALUE' }, LaunchTemplate: { LaunchTemplateSpecification: { LaunchTemplateId: 'STRING_VALUE', LaunchTemplateName: 'STRING_VALUE', Version: 'STRING_VALUE' }, Overrides: [ { InstanceRequirements: { MemoryMiB: { /* required */ Min: 'NUMBER_VALUE', /* required */ Max: 'NUMBER_VALUE' }, VCpuCount: { /* required */ Min: 'NUMBER_VALUE', /* required */ Max: 'NUMBER_VALUE' }, AcceleratorCount: { Max: 'NUMBER_VALUE', Min: 'NUMBER_VALUE' }, AcceleratorManufacturers: [ nvidia | amd | amazon-web-services | xilinx, /* more items */ ], AcceleratorNames: [ a100 | v100 | k80 | t4 | m60 | radeon-pro-v520 | vu9p, /* more items */ ], AcceleratorTotalMemoryMiB: { Max: 'NUMBER_VALUE', Min: 'NUMBER_VALUE' }, AcceleratorTypes: [ gpu | fpga | inference, /* more items */ ], AllowedInstanceTypes: [ 'STRING_VALUE', /* more items */ ], BareMetal: included | excluded | required, BaselineEbsBandwidthMbps: { Max: 'NUMBER_VALUE', Min: 'NUMBER_VALUE' }, BurstablePerformance: included | excluded | required, CpuManufacturers: [ intel | amd | amazon-web-services, /* more items */ ], ExcludedInstanceTypes: [ 'STRING_VALUE', /* more items */ ], InstanceGenerations: [ current | previous, /* more items */ ], LocalStorage: included | excluded | required, LocalStorageTypes: [ hdd | ssd, /* more items */ ], MaxSpotPriceAsPercentageOfOptimalOnDemandPrice: 'NUMBER_VALUE', MemoryGiBPerVCpu: { Max: 'NUMBER_VALUE', Min: 'NUMBER_VALUE' }, NetworkBandwidthGbps: { Max: 'NUMBER_VALUE', Min: 'NUMBER_VALUE' }, NetworkInterfaceCount: { Max: 'NUMBER_VALUE', Min: 'NUMBER_VALUE' }, OnDemandMaxPricePercentageOverLowestPrice: 'NUMBER_VALUE', RequireHibernateSupport: true || false, SpotMaxPricePercentageOverLowestPrice: 'NUMBER_VALUE', TotalLocalStorageGB: { Max: 'NUMBER_VALUE', Min: 'NUMBER_VALUE' } }, InstanceType: 'STRING_VALUE', LaunchTemplateSpecification: { LaunchTemplateId: 'STRING_VALUE', LaunchTemplateName: 'STRING_VALUE', Version: 'STRING_VALUE' }, WeightedCapacity: 'STRING_VALUE' }, /* more items */ ] } } }, Preferences: { AlarmSpecification: { Alarms: [ 'STRING_VALUE', /* more items */ ] }, AutoRollback: true || false, CheckpointDelay: 'NUMBER_VALUE', CheckpointPercentages: [ 'NUMBER_VALUE', /* more items */ ], InstanceWarmup: 'NUMBER_VALUE', MaxHealthyPercentage: 'NUMBER_VALUE', MinHealthyPercentage: 'NUMBER_VALUE', ScaleInProtectedInstances: Refresh | Ignore | Wait, SkipMatching: true || false, StandbyInstances: Terminate | Ignore | Wait }, Strategy: Rolling }; autoscaling.startInstanceRefresh(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
Strategy
— (String
)The strategy to use for the instance refresh. The only valid value is
Possible values include:Rolling
."Rolling"
DesiredConfiguration
— (map
)The desired configuration. For example, the desired configuration can specify a new launch template or a new version of the current launch template.
Once the instance refresh succeeds, Amazon EC2 Auto Scaling updates the settings of the Auto Scaling group to reflect the new desired configuration.
Note: When you specify a new launch template or a new version of the current launch template for your desired configuration, consider enabling theSkipMatching
property in preferences. If it's enabled, Amazon EC2 Auto Scaling skips replacing instances that already use the specified launch template and instance types. This can help you reduce the number of replacements that are required to apply updates.LaunchTemplate
— (map
)Describes the launch template and the version of the launch template that Amazon EC2 Auto Scaling uses to launch Amazon EC2 instances. For more information about launch templates, see Launch templates in the Amazon EC2 Auto Scaling User Guide.
LaunchTemplateId
— (String
)The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.LaunchTemplateName
— (String
)The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.Version
— (String
)The version number,
$Latest
, or$Default
. To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API. If the value is$Latest
, Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is$Default
, Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is$Default
.
MixedInstancesPolicy
— (map
)Use this structure to launch multiple instance types and On-Demand Instances and Spot Instances within a single Auto Scaling group.
A mixed instances policy contains information that Amazon EC2 Auto Scaling can use to launch instances and help optimize your costs. For more information, see Auto Scaling groups with multiple instance types and purchase options in the Amazon EC2 Auto Scaling User Guide.
LaunchTemplate
— (map
)One or more launch templates and the instance types (overrides) that are used to launch EC2 instances to fulfill On-Demand and Spot capacities.
LaunchTemplateSpecification
— (map
)The launch template.
LaunchTemplateId
— (String
)The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.LaunchTemplateName
— (String
)The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.Version
— (String
)The version number,
$Latest
, or$Default
. To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API. If the value is$Latest
, Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is$Default
, Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is$Default
.
Overrides
— (Array<map>
)Any properties that you specify override the same properties in the launch template.
InstanceType
— (String
)The instance type, such as
m3.xlarge
. You must specify an instance type that is supported in your requested Region and Availability Zones. For more information, see Instance types in the Amazon EC2 User Guide for Linux Instances.You can specify up to 40 instance types per Auto Scaling group.
WeightedCapacity
— (String
)If you provide a list of instance types to use, you can specify the number of capacity units provided by each instance type in terms of virtual CPUs, memory, storage, throughput, or other relative performance characteristic. When a Spot or On-Demand Instance is launched, the capacity units count toward the desired capacity. Amazon EC2 Auto Scaling launches instances until the desired capacity is totally fulfilled, even if this results in an overage. For example, if there are two units remaining to fulfill capacity, and Amazon EC2 Auto Scaling can only launch an instance with a
WeightedCapacity
of five units, the instance is launched, and the desired capacity is exceeded by three units. For more information, see Configure an Auto Scaling group to use instance weights in the Amazon EC2 Auto Scaling User Guide. Value must be in the range of 1–999.If you specify a value for
WeightedCapacity
for one instance type, you must specify a value forWeightedCapacity
for all of them.Every Auto Scaling group has three size parameters (
DesiredCapacity
,MaxSize
, andMinSize
). Usually, you set these sizes based on a specific number of instances. However, if you configure a mixed instances policy that defines weights for the instance types, you must specify these sizes with the same units that you use for weighting instances.LaunchTemplateSpecification
— (map
)Provides a launch template for the specified instance type or set of instance requirements. For example, some instance types might require a launch template with a different AMI. If not provided, Amazon EC2 Auto Scaling uses the launch template that's specified in the
LaunchTemplate
definition. For more information, see Specifying a different launch template for an instance type in the Amazon EC2 Auto Scaling User Guide.You can specify up to 20 launch templates per Auto Scaling group. The launch templates specified in the overrides and in the
LaunchTemplate
definition count towards this limit.LaunchTemplateId
— (String
)The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.LaunchTemplateName
— (String
)The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.Version
— (String
)The version number,
$Latest
, or$Default
. To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API. If the value is$Latest
, Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is$Default
, Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is$Default
.
InstanceRequirements
— (map
)The instance requirements. Amazon EC2 Auto Scaling uses your specified requirements to identify instance types. Then, it uses your On-Demand and Spot allocation strategies to launch instances from these instance types.
You can specify up to four separate sets of instance requirements per Auto Scaling group. This is useful for provisioning instances from different Amazon Machine Images (AMIs) in the same Auto Scaling group. To do this, create the AMIs and create a new launch template for each AMI. Then, create a compatible set of instance requirements for each launch template.
Note: If you specifyInstanceRequirements
, you can't specifyInstanceType
.VCpuCount
— required — (map
)The minimum and maximum number of vCPUs for an instance type.
Min
— required — (Integer
)The minimum number of vCPUs.
Max
— (Integer
)The maximum number of vCPUs.
MemoryMiB
— required — (map
)The minimum and maximum instance memory size for an instance type, in MiB.
Min
— required — (Integer
)The memory minimum in MiB.
Max
— (Integer
)The memory maximum in MiB.
CpuManufacturers
— (Array<String>
)Lists which specific CPU manufacturers to include.
-
For instance types with Intel CPUs, specify
intel
. -
For instance types with AMD CPUs, specify
amd
. -
For instance types with Amazon Web Services CPUs, specify
amazon-web-services
.
Note: Don't confuse the CPU hardware manufacturer with the CPU hardware architecture. Instances will be launched with a compatible CPU architecture based on the Amazon Machine Image (AMI) that you specify in your launch template.Default: Any manufacturer
-
MemoryGiBPerVCpu
— (map
)The minimum and maximum amount of memory per vCPU for an instance type, in GiB.
Default: No minimum or maximum limits
Min
— (Float
)The memory minimum in GiB.
Max
— (Float
)The memory maximum in GiB.
ExcludedInstanceTypes
— (Array<String>
)The instance types to exclude. You can use strings with one or more wild cards, represented by an asterisk (
*
), to exclude an instance family, type, size, or generation. The following are examples:m5.8xlarge
,c5*.*
,m5a.*
,r*
,*3*
.For example, if you specify
c5*
, you are excluding the entire C5 instance family, which includes all C5a and C5n instance types. If you specifym5a.*
, Amazon EC2 Auto Scaling will exclude all the M5a instance types, but not the M5n instance types.Note: If you specifyExcludedInstanceTypes
, you can't specifyAllowedInstanceTypes
.Default: No excluded instance types
InstanceGenerations
— (Array<String>
)Indicates whether current or previous generation instance types are included.
-
For current generation instance types, specify
current
. The current generation includes EC2 instance types currently recommended for use. This typically includes the latest two to three generations in each instance family. For more information, see Instance types in the Amazon EC2 User Guide for Linux Instances. -
For previous generation instance types, specify
previous
.
Default: Any current or previous generation
-
SpotMaxPricePercentageOverLowestPrice
— (Integer
)[Price protection] The price protection threshold for Spot Instances, as a percentage higher than an identified Spot price. The identified Spot price is the price of the lowest priced current generation C, M, or R instance type with your specified attributes. If no current generation C, M, or R instance type matches your attributes, then the identified price is from either the lowest priced current generation instance types or, failing that, the lowest priced previous generation instance types that match your attributes. When Amazon EC2 Auto Scaling selects instance types with your attributes, we will exclude instance types whose price exceeds your specified threshold.
The parameter accepts an integer, which Amazon EC2 Auto Scaling interprets as a percentage.
If you set
DesiredCapacityType
tovcpu
ormemory-mib
, the price protection threshold is based on the per-vCPU or per-memory price instead of the per instance price.Note: Only one ofSpotMaxPricePercentageOverLowestPrice
orMaxSpotPriceAsPercentageOfOptimalOnDemandPrice
can be specified. If you don't specify either, Amazon EC2 Auto Scaling will automatically apply optimal price protection to consistently select from a wide range of instance types. To indicate no price protection threshold for Spot Instances, meaning you want to consider all instance types that match your attributes, include one of these parameters and specify a high value, such as999999
.MaxSpotPriceAsPercentageOfOptimalOnDemandPrice
— (Integer
)[Price protection] The price protection threshold for Spot Instances, as a percentage of an identified On-Demand price. The identified On-Demand price is the price of the lowest priced current generation C, M, or R instance type with your specified attributes. If no current generation C, M, or R instance type matches your attributes, then the identified price is from either the lowest priced current generation instance types or, failing that, the lowest priced previous generation instance types that match your attributes. When Amazon EC2 Auto Scaling selects instance types with your attributes, we will exclude instance types whose price exceeds your specified threshold.
The parameter accepts an integer, which Amazon EC2 Auto Scaling interprets as a percentage.
If you set
DesiredCapacityType
tovcpu
ormemory-mib
, the price protection threshold is based on the per-vCPU or per-memory price instead of the per instance price.Note: Only one ofSpotMaxPricePercentageOverLowestPrice
orMaxSpotPriceAsPercentageOfOptimalOnDemandPrice
can be specified. If you don't specify either, Amazon EC2 Auto Scaling will automatically apply optimal price protection to consistently select from a wide range of instance types. To indicate no price protection threshold for Spot Instances, meaning you want to consider all instance types that match your attributes, include one of these parameters and specify a high value, such as999999
.OnDemandMaxPricePercentageOverLowestPrice
— (Integer
)[Price protection] The price protection threshold for On-Demand Instances, as a percentage higher than an identified On-Demand price. The identified On-Demand price is the price of the lowest priced current generation C, M, or R instance type with your specified attributes. If no current generation C, M, or R instance type matches your attributes, then the identified price is from either the lowest priced current generation instance types or, failing that, the lowest priced previous generation instance types that match your attributes. When Amazon EC2 Auto Scaling selects instance types with your attributes, we will exclude instance types whose price exceeds your specified threshold.
The parameter accepts an integer, which Amazon EC2 Auto Scaling interprets as a percentage.
To turn off price protection, specify a high value, such as
999999
.If you set
DesiredCapacityType
tovcpu
ormemory-mib
, the price protection threshold is applied based on the per-vCPU or per-memory price instead of the per instance price.Default:
20
BareMetal
— (String
)Indicates whether bare metal instance types are included, excluded, or required.
Default:
Possible values include:excluded
"included"
"excluded"
"required"
BurstablePerformance
— (String
)Indicates whether burstable performance instance types are included, excluded, or required. For more information, see Burstable performance instances in the Amazon EC2 User Guide for Linux Instances.
Default:
Possible values include:excluded
"included"
"excluded"
"required"
RequireHibernateSupport
— (Boolean
)Indicates whether instance types must provide On-Demand Instance hibernation support.
Default:
false
NetworkInterfaceCount
— (map
)The minimum and maximum number of network interfaces for an instance type.
Default: No minimum or maximum limits
Min
— (Integer
)The minimum number of network interfaces.
Max
— (Integer
)The maximum number of network interfaces.
LocalStorage
— (String
)Indicates whether instance types with instance store volumes are included, excluded, or required. For more information, see Amazon EC2 instance store in the Amazon EC2 User Guide for Linux Instances.
Default:
Possible values include:included
"included"
"excluded"
"required"
LocalStorageTypes
— (Array<String>
)Indicates the type of local storage that is required.
-
For instance types with hard disk drive (HDD) storage, specify
hdd
. -
For instance types with solid state drive (SSD) storage, specify
ssd
.
Default: Any local storage type
-
TotalLocalStorageGB
— (map
)The minimum and maximum total local storage size for an instance type, in GB.
Default: No minimum or maximum limits
Min
— (Float
)The storage minimum in GB.
Max
— (Float
)The storage maximum in GB.
BaselineEbsBandwidthMbps
— (map
)The minimum and maximum baseline bandwidth performance for an instance type, in Mbps. For more information, see Amazon EBS–optimized instances in the Amazon EC2 User Guide for Linux Instances.
Default: No minimum or maximum limits
Min
— (Integer
)The minimum value in Mbps.
Max
— (Integer
)The maximum value in Mbps.
AcceleratorTypes
— (Array<String>
)Lists the accelerator types that must be on an instance type.
-
For instance types with GPU accelerators, specify
gpu
. -
For instance types with FPGA accelerators, specify
fpga
. -
For instance types with inference accelerators, specify
inference
.
Default: Any accelerator type
-
AcceleratorCount
— (map
)The minimum and maximum number of accelerators (GPUs, FPGAs, or Amazon Web Services Inferentia chips) for an instance type.
To exclude accelerator-enabled instance types, set
Max
to0
.Default: No minimum or maximum limits
Min
— (Integer
)The minimum value.
Max
— (Integer
)The maximum value.
AcceleratorManufacturers
— (Array<String>
)Indicates whether instance types must have accelerators by specific manufacturers.
-
For instance types with NVIDIA devices, specify
nvidia
. -
For instance types with AMD devices, specify
amd
. -
For instance types with Amazon Web Services devices, specify
amazon-web-services
. -
For instance types with Xilinx devices, specify
xilinx
.
Default: Any manufacturer
-
AcceleratorNames
— (Array<String>
)Lists the accelerators that must be on an instance type.
-
For instance types with NVIDIA A100 GPUs, specify
a100
. -
For instance types with NVIDIA V100 GPUs, specify
v100
. -
For instance types with NVIDIA K80 GPUs, specify
k80
. -
For instance types with NVIDIA T4 GPUs, specify
t4
. -
For instance types with NVIDIA M60 GPUs, specify
m60
. -
For instance types with AMD Radeon Pro V520 GPUs, specify
radeon-pro-v520
. -
For instance types with Xilinx VU9P FPGAs, specify
vu9p
.
Default: Any accelerator
-
AcceleratorTotalMemoryMiB
— (map
)The minimum and maximum total memory size for the accelerators on an instance type, in MiB.
Default: No minimum or maximum limits
Min
— (Integer
)The memory minimum in MiB.
Max
— (Integer
)The memory maximum in MiB.
NetworkBandwidthGbps
— (map
)The minimum and maximum amount of network bandwidth, in gigabits per second (Gbps).
Default: No minimum or maximum limits
Min
— (Float
)The minimum amount of network bandwidth, in gigabits per second (Gbps).
Max
— (Float
)The maximum amount of network bandwidth, in gigabits per second (Gbps).
AllowedInstanceTypes
— (Array<String>
)The instance types to apply your specified attributes against. All other instance types are ignored, even if they match your specified attributes.
You can use strings with one or more wild cards, represented by an asterisk (
*
), to allow an instance type, size, or generation. The following are examples:m5.8xlarge
,c5*.*
,m5a.*
,r*
,*3*
.For example, if you specify
c5*
, Amazon EC2 Auto Scaling will allow the entire C5 instance family, which includes all C5a and C5n instance types. If you specifym5a.*
, Amazon EC2 Auto Scaling will allow all the M5a instance types, but not the M5n instance types.Note: If you specifyAllowedInstanceTypes
, you can't specifyExcludedInstanceTypes
.Default: All instance types
InstancesDistribution
— (map
)The instances distribution.
OnDemandAllocationStrategy
— (String
)The allocation strategy to apply to your On-Demand Instances when they are launched. Possible instance types are determined by the launch template overrides that you specify.
The following lists the valid values:
- lowest-price
-
Uses price to determine which instance types are the highest priority, launching the lowest priced instance types within an Availability Zone first. This is the default value for Auto Scaling groups that specify InstanceRequirements.
- prioritized
-
You set the order of instance types for the launch template overrides from highest to lowest priority (from first to last in the list). Amazon EC2 Auto Scaling launches your highest priority instance types first. If all your On-Demand capacity cannot be fulfilled using your highest priority instance type, then Amazon EC2 Auto Scaling launches the remaining capacity using the second priority instance type, and so on. This is the default value for Auto Scaling groups that don't specify InstanceRequirements and cannot be used for groups that do.
OnDemandBaseCapacity
— (Integer
)The minimum amount of the Auto Scaling group's capacity that must be fulfilled by On-Demand Instances. This base portion is launched first as your group scales.
This number has the same unit of measurement as the group's desired capacity. If you change the default unit of measurement (number of instances) by specifying weighted capacity values in your launch template overrides list, or by changing the default desired capacity type setting of the group, you must specify this number using the same unit of measurement.
Default: 0
OnDemandPercentageAboveBaseCapacity
— (Integer
)Controls the percentages of On-Demand Instances and Spot Instances for your additional capacity beyond
OnDemandBaseCapacity
. Expressed as a number (for example, 20 specifies 20% On-Demand Instances, 80% Spot Instances). If set to 100, only On-Demand Instances are used.Default: 100
SpotAllocationStrategy
— (String
)The allocation strategy to apply to your Spot Instances when they are launched. Possible instance types are determined by the launch template overrides that you specify.
The following lists the valid values:
- capacity-optimized
-
Requests Spot Instances using pools that are optimally chosen based on the available Spot capacity. This strategy has the lowest risk of interruption. To give certain instance types a higher chance of launching first, use
capacity-optimized-prioritized
. - capacity-optimized-prioritized
-
You set the order of instance types for the launch template overrides from highest to lowest priority (from first to last in the list). Amazon EC2 Auto Scaling honors the instance type priorities on a best effort basis but optimizes for capacity first. Note that if the On-Demand allocation strategy is set to
prioritized
, the same priority is applied when fulfilling On-Demand capacity. This is not a valid value for Auto Scaling groups that specify InstanceRequirements. - lowest-price
-
Requests Spot Instances using the lowest priced pools within an Availability Zone, across the number of Spot pools that you specify for the
SpotInstancePools
property. To ensure that your desired capacity is met, you might receive Spot Instances from several pools. This is the default value, but it might lead to high interruption rates because this strategy only considers instance price and not available capacity. - price-capacity-optimized (recommended)
-
The price and capacity optimized allocation strategy looks at both price and capacity to select the Spot Instance pools that are the least likely to be interrupted and have the lowest possible price.
SpotInstancePools
— (Integer
)The number of Spot Instance pools across which to allocate your Spot Instances. The Spot pools are determined from the different instance types in the overrides. Valid only when the
SpotAllocationStrategy
islowest-price
. Value must be in the range of 1–20.Default: 2
SpotMaxPrice
— (String
)The maximum price per unit hour that you are willing to pay for a Spot Instance. If your maximum price is lower than the Spot price for the instance types that you selected, your Spot Instances are not launched. We do not recommend specifying a maximum price because it can lead to increased interruptions. When Spot Instances launch, you pay the current Spot price. To remove a maximum price that you previously set, include the property but specify an empty string ("") for the value.
If you specify a maximum price, your instances will be interrupted more frequently than if you do not specify one.
Valid Range: Minimum value of 0.001
Preferences
— (map
)Sets your preferences for the instance refresh so that it performs as expected when you start it. Includes the instance warmup time, the minimum and maximum healthy percentages, and the behaviors that you want Amazon EC2 Auto Scaling to use if instances that are in
Standby
state or protected from scale in are found. You can also choose to enable additional features, such as the following:-
Auto rollback
-
Checkpoints
-
CloudWatch alarms
-
Skip matching
MinHealthyPercentage
— (Integer
)Specifies the minimum percentage of the group to keep in service, healthy, and ready to use to support your workload to allow the operation to continue. The value is expressed as a percentage of the desired capacity of the Auto Scaling group. Value range is 0 to 100.
If you do not specify this property, the default is 90 percent, or the percentage set in the instance maintenance policy for the Auto Scaling group, if defined.
InstanceWarmup
— (Integer
)A time period, in seconds, during which an instance refresh waits before moving on to replacing the next instance after a new instance enters the
InService
state.This property is not required for normal usage. Instead, use the
DefaultInstanceWarmup
property of the Auto Scaling group. TheInstanceWarmup
andDefaultInstanceWarmup
properties work the same way. Only specify this property if you must override theDefaultInstanceWarmup
property.If you do not specify this property, the instance warmup by default is the value of the
DefaultInstanceWarmup
property, if defined (which is recommended in all cases), or theHealthCheckGracePeriod
property otherwise.CheckpointPercentages
— (Array<Integer>
)(Optional) Threshold values for each checkpoint in ascending order. Each number must be unique. To replace all instances in the Auto Scaling group, the last number in the array must be
100
.For usage examples, see Add checkpoints to an instance refresh in the Amazon EC2 Auto Scaling User Guide.
CheckpointDelay
— (Integer
)(Optional) The amount of time, in seconds, to wait after a checkpoint before continuing. This property is optional, but if you specify a value for it, you must also specify a value for
CheckpointPercentages
. If you specify a value forCheckpointPercentages
and not forCheckpointDelay
, theCheckpointDelay
defaults to3600
(1 hour).SkipMatching
— (Boolean
)(Optional) Indicates whether skip matching is enabled. If enabled (
true
), then Amazon EC2 Auto Scaling skips replacing instances that match the desired configuration. If no desired configuration is specified, then it skips replacing instances that have the same launch template and instance types that the Auto Scaling group was using before the start of the instance refresh. The default isfalse
.For more information, see Use an instance refresh with skip matching in the Amazon EC2 Auto Scaling User Guide.
AutoRollback
— (Boolean
)(Optional) Indicates whether to roll back the Auto Scaling group to its previous configuration if the instance refresh fails or a CloudWatch alarm threshold is met. The default is
false
.A rollback is not supported in the following situations:
-
There is no desired configuration specified for the instance refresh.
-
The Auto Scaling group has a launch template that uses an Amazon Web Services Systems Manager parameter instead of an AMI ID for the
ImageId
property. -
The Auto Scaling group uses the launch template's
$Latest
or$Default
version.
For more information, see Undo changes with a rollback in the Amazon EC2 Auto Scaling User Guide.
-
ScaleInProtectedInstances
— (String
)Choose the behavior that you want Amazon EC2 Auto Scaling to use if instances protected from scale in are found.
The following lists the valid values:
- Refresh
-
Amazon EC2 Auto Scaling replaces instances that are protected from scale in.
- Ignore
-
Amazon EC2 Auto Scaling ignores instances that are protected from scale in and continues to replace instances that are not protected.
- Wait (default)
-
Amazon EC2 Auto Scaling waits one hour for you to remove scale-in protection. Otherwise, the instance refresh will fail.
"Refresh"
"Ignore"
"Wait"
StandbyInstances
— (String
)Choose the behavior that you want Amazon EC2 Auto Scaling to use if instances in
Standby
state are found.The following lists the valid values:
- Terminate
-
Amazon EC2 Auto Scaling terminates instances that are in
Standby
. - Ignore
-
Amazon EC2 Auto Scaling ignores instances that are in
Standby
and continues to replace instances that are in theInService
state. - Wait (default)
-
Amazon EC2 Auto Scaling waits one hour for you to return the instances to service. Otherwise, the instance refresh will fail.
"Terminate"
"Ignore"
"Wait"
AlarmSpecification
— (map
)(Optional) The CloudWatch alarm specification. CloudWatch alarms can be used to identify any issues and fail the operation if an alarm threshold is met.
Alarms
— (Array<String>
)The names of one or more CloudWatch alarms to monitor for the instance refresh. You can specify up to 10 alarms.
MaxHealthyPercentage
— (Integer
)Specifies the maximum percentage of the group that can be in service and healthy, or pending, to support your workload when replacing instances. The value is expressed as a percentage of the desired capacity of the Auto Scaling group. Value range is 100 to 200.
If you specify
MaxHealthyPercentage
, you must also specifyMinHealthyPercentage
, and the difference between them cannot be greater than 100. A larger range increases the number of instances that can be replaced at the same time.If you do not specify this property, the default is 100 percent, or the percentage set in the instance maintenance policy for the Auto Scaling group, if defined.
-
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:InstanceRefreshId
— (String
)A unique ID for tracking the progress of the instance refresh.
-
(AWS.Response)
—
Returns:
suspendProcesses(params = {}, callback) ⇒ AWS.Request
Suspends the specified auto scaling processes, or all processes, for the specified Auto Scaling group.
If you suspend either the
Launch
orTerminate
process types, it can prevent other process types from functioning properly. For more information, see Suspend and resume Amazon EC2 Auto Scaling processes in the Amazon EC2 Auto Scaling User Guide.To resume processes that have been suspended, call the ResumeProcesses API.
Service Reference:
Examples:
To suspend Auto Scaling processes
/* This example suspends the specified scaling process for the specified Auto Scaling group. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", ScalingProcesses: [ "AlarmNotification" ] }; autoscaling.suspendProcesses(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Calling the suspendProcesses operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ ScalingProcesses: [ 'STRING_VALUE', /* more items */ ] }; autoscaling.suspendProcesses(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
ScalingProcesses
— (Array<String>
)One or more of the following processes:
-
Launch
-
Terminate
-
AddToLoadBalancer
-
AlarmNotification
-
AZRebalance
-
HealthCheck
-
InstanceRefresh
-
ReplaceUnhealthy
-
ScheduledActions
If you omit this property, all processes are specified.
-
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:
terminateInstanceInAutoScalingGroup(params = {}, callback) ⇒ AWS.Request
Terminates the specified instance and optionally adjusts the desired group size. This operation cannot be called on instances in a warm pool.
This call simply makes a termination request. The instance is not terminated immediately. When an instance is terminated, the instance status changes to
terminated
. You can't connect to or start an instance after you've terminated it.If you do not specify the option to decrement the desired capacity, Amazon EC2 Auto Scaling launches instances to replace the ones that are terminated.
By default, Amazon EC2 Auto Scaling balances instances across all Availability Zones. If you decrement the desired capacity, your Auto Scaling group can become unbalanced between Availability Zones. Amazon EC2 Auto Scaling tries to rebalance the group, and rebalancing might terminate instances in other zones. For more information, see Manual scaling in the Amazon EC2 Auto Scaling User Guide.
Service Reference:
Examples:
To terminate an instance in an Auto Scaling group
/* This example terminates the specified instance from the specified Auto Scaling group without updating the size of the group. Auto Scaling launches a replacement instance after the specified instance terminates. */ var params = { InstanceId: "i-93633f9b", ShouldDecrementDesiredCapacity: false }; autoscaling.terminateInstanceInAutoScalingGroup(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response /* data = { } */ });
Calling the terminateInstanceInAutoScalingGroup operation
var params = { InstanceId: 'STRING_VALUE', /* required */ ShouldDecrementDesiredCapacity: true || false /* required */ }; autoscaling.terminateInstanceInAutoScalingGroup(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: {})
—
InstanceId
— (String
)The ID of the instance.
ShouldDecrementDesiredCapacity
— (Boolean
)Indicates whether terminating the instance also decrements the size of the Auto Scaling 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. Thedata
object has the following properties:Activity
— (map
)A scaling activity.
ActivityId
— required — (String
)The ID of the activity.
AutoScalingGroupName
— required — (String
)The name of the Auto Scaling group.
Description
— (String
)A friendly, more verbose description of the activity.
Cause
— required — (String
)The reason the activity began.
StartTime
— required — (Date
)The start time of the activity.
EndTime
— (Date
)The end time of the activity.
StatusCode
— required — (String
)The current status of the activity.
Possible values include:"PendingSpotBidPlacement"
"WaitingForSpotInstanceRequestId"
"WaitingForSpotInstanceId"
"WaitingForInstanceId"
"PreInService"
"InProgress"
"WaitingForELBConnectionDraining"
"MidLifecycleAction"
"WaitingForInstanceWarmup"
"Successful"
"Failed"
"Cancelled"
"WaitingForConnectionDraining"
StatusMessage
— (String
)A friendly, more verbose description of the activity status.
Progress
— (Integer
)A value between 0 and 100 that indicates the progress of the activity.
Details
— (String
)The details about the activity.
AutoScalingGroupState
— (String
)The state of the Auto Scaling group, which is either
InService
orDeleted
.AutoScalingGroupARN
— (String
)The Amazon Resource Name (ARN) of the Auto Scaling group.
-
(AWS.Response)
—
Returns:
updateAutoScalingGroup(params = {}, callback) ⇒ AWS.Request
We strongly recommend that all Auto Scaling groups use launch templates to ensure full functionality for Amazon EC2 Auto Scaling and Amazon EC2.
Updates the configuration for the specified Auto Scaling group.
To update an Auto Scaling group, specify the name of the group and the property that you want to change. Any properties that you don't specify are not changed by this update request. The new settings take effect on any scaling activities after this call returns.
If you associate a new launch configuration or template with an Auto Scaling group, all new instances will get the updated configuration. Existing instances continue to run with the configuration that they were originally launched with. When you update a group to specify a mixed instances policy instead of a launch configuration or template, existing instances may be replaced to match the new purchasing options that you specified in the policy. For example, if the group currently has 100% On-Demand capacity and the policy specifies 50% Spot capacity, this means that half of your instances will be gradually terminated and relaunched as Spot Instances. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the old ones, so that updating your group does not compromise the performance or availability of your application.
Note the following about changing
DesiredCapacity
,MaxSize
, orMinSize
:-
If a scale-in activity occurs as a result of a new
DesiredCapacity
value that is lower than the current size of the group, the Auto Scaling group uses its termination policy to determine which instances to terminate. -
If you specify a new value for
MinSize
without specifying a value forDesiredCapacity
, and the newMinSize
is larger than the current size of the group, this sets the group'sDesiredCapacity
to the newMinSize
value. -
If you specify a new value for
MaxSize
without specifying a value forDesiredCapacity
, and the newMaxSize
is smaller than the current size of the group, this sets the group'sDesiredCapacity
to the newMaxSize
value.
To see which properties have been set, call the DescribeAutoScalingGroups API. To view the scaling policies for an Auto Scaling group, call the DescribePolicies API. If the group has scaling policies, you can update them by calling the PutScalingPolicy API.
Service Reference:
Examples:
To update an Auto Scaling group
/* This example updates multiple properties at the same time. */ var params = { AutoScalingGroupName: "my-auto-scaling-group", LaunchTemplate: { LaunchTemplateName: "my-template-for-auto-scaling", Version: "2" }, MaxSize: 5, MinSize: 1, NewInstancesProtectedFromScaleIn: true }; autoscaling.updateAutoScalingGroup(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
Calling the updateAutoScalingGroup operation
var params = { AutoScalingGroupName: 'STRING_VALUE', /* required */ AvailabilityZones: [ 'STRING_VALUE', /* more items */ ], CapacityRebalance: true || false, Context: 'STRING_VALUE', DefaultCooldown: 'NUMBER_VALUE', DefaultInstanceWarmup: 'NUMBER_VALUE', DesiredCapacity: 'NUMBER_VALUE', DesiredCapacityType: 'STRING_VALUE', HealthCheckGracePeriod: 'NUMBER_VALUE', HealthCheckType: 'STRING_VALUE', InstanceMaintenancePolicy: { MaxHealthyPercentage: 'NUMBER_VALUE', MinHealthyPercentage: 'NUMBER_VALUE' }, LaunchConfigurationName: 'STRING_VALUE', LaunchTemplate: { LaunchTemplateId: 'STRING_VALUE', LaunchTemplateName: 'STRING_VALUE', Version: 'STRING_VALUE' }, MaxInstanceLifetime: 'NUMBER_VALUE', MaxSize: 'NUMBER_VALUE', MinSize: 'NUMBER_VALUE', MixedInstancesPolicy: { InstancesDistribution: { OnDemandAllocationStrategy: 'STRING_VALUE', OnDemandBaseCapacity: 'NUMBER_VALUE', OnDemandPercentageAboveBaseCapacity: 'NUMBER_VALUE', SpotAllocationStrategy: 'STRING_VALUE', SpotInstancePools: 'NUMBER_VALUE', SpotMaxPrice: 'STRING_VALUE' }, LaunchTemplate: { LaunchTemplateSpecification: { LaunchTemplateId: 'STRING_VALUE', LaunchTemplateName: 'STRING_VALUE', Version: 'STRING_VALUE' }, Overrides: [ { InstanceRequirements: { MemoryMiB: { /* required */ Min: 'NUMBER_VALUE', /* required */ Max: 'NUMBER_VALUE' }, VCpuCount: { /* required */ Min: 'NUMBER_VALUE', /* required */ Max: 'NUMBER_VALUE' }, AcceleratorCount: { Max: 'NUMBER_VALUE', Min: 'NUMBER_VALUE' }, AcceleratorManufacturers: [ nvidia | amd | amazon-web-services | xilinx, /* more items */ ], AcceleratorNames: [ a100 | v100 | k80 | t4 | m60 | radeon-pro-v520 | vu9p, /* more items */ ], AcceleratorTotalMemoryMiB: { Max: 'NUMBER_VALUE', Min: 'NUMBER_VALUE' }, AcceleratorTypes: [ gpu | fpga | inference, /* more items */ ], AllowedInstanceTypes: [ 'STRING_VALUE', /* more items */ ], BareMetal: included | excluded | required, BaselineEbsBandwidthMbps: { Max: 'NUMBER_VALUE', Min: 'NUMBER_VALUE' }, BurstablePerformance: included | excluded | required, CpuManufacturers: [ intel | amd | amazon-web-services, /* more items */ ], ExcludedInstanceTypes: [ 'STRING_VALUE', /* more items */ ], InstanceGenerations: [ current | previous, /* more items */ ], LocalStorage: included | excluded | required, LocalStorageTypes: [ hdd | ssd, /* more items */ ], MaxSpotPriceAsPercentageOfOptimalOnDemandPrice: 'NUMBER_VALUE', MemoryGiBPerVCpu: { Max: 'NUMBER_VALUE', Min: 'NUMBER_VALUE' }, NetworkBandwidthGbps: { Max: 'NUMBER_VALUE', Min: 'NUMBER_VALUE' }, NetworkInterfaceCount: { Max: 'NUMBER_VALUE', Min: 'NUMBER_VALUE' }, OnDemandMaxPricePercentageOverLowestPrice: 'NUMBER_VALUE', RequireHibernateSupport: true || false, SpotMaxPricePercentageOverLowestPrice: 'NUMBER_VALUE', TotalLocalStorageGB: { Max: 'NUMBER_VALUE', Min: 'NUMBER_VALUE' } }, InstanceType: 'STRING_VALUE', LaunchTemplateSpecification: { LaunchTemplateId: 'STRING_VALUE', LaunchTemplateName: 'STRING_VALUE', Version: 'STRING_VALUE' }, WeightedCapacity: 'STRING_VALUE' }, /* more items */ ] } }, NewInstancesProtectedFromScaleIn: true || false, PlacementGroup: 'STRING_VALUE', ServiceLinkedRoleARN: 'STRING_VALUE', TerminationPolicies: [ 'STRING_VALUE', /* more items */ ], VPCZoneIdentifier: 'STRING_VALUE' }; autoscaling.updateAutoScalingGroup(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: {})
—
AutoScalingGroupName
— (String
)The name of the Auto Scaling group.
LaunchConfigurationName
— (String
)The name of the launch configuration. If you specify
LaunchConfigurationName
in your update request, you can't specifyLaunchTemplate
orMixedInstancesPolicy
.LaunchTemplate
— (map
)The launch template and version to use to specify the updates. If you specify
LaunchTemplate
in your update request, you can't specifyLaunchConfigurationName
orMixedInstancesPolicy
.LaunchTemplateId
— (String
)The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.LaunchTemplateName
— (String
)The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.Version
— (String
)The version number,
$Latest
, or$Default
. To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API. If the value is$Latest
, Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is$Default
, Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is$Default
.
MixedInstancesPolicy
— (map
)The mixed instances policy. For more information, see Auto Scaling groups with multiple instance types and purchase options in the Amazon EC2 Auto Scaling User Guide.
LaunchTemplate
— (map
)One or more launch templates and the instance types (overrides) that are used to launch EC2 instances to fulfill On-Demand and Spot capacities.
LaunchTemplateSpecification
— (map
)The launch template.
LaunchTemplateId
— (String
)The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.LaunchTemplateName
— (String
)The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.Version
— (String
)The version number,
$Latest
, or$Default
. To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API. If the value is$Latest
, Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is$Default
, Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is$Default
.
Overrides
— (Array<map>
)Any properties that you specify override the same properties in the launch template.
InstanceType
— (String
)The instance type, such as
m3.xlarge
. You must specify an instance type that is supported in your requested Region and Availability Zones. For more information, see Instance types in the Amazon EC2 User Guide for Linux Instances.You can specify up to 40 instance types per Auto Scaling group.
WeightedCapacity
— (String
)If you provide a list of instance types to use, you can specify the number of capacity units provided by each instance type in terms of virtual CPUs, memory, storage, throughput, or other relative performance characteristic. When a Spot or On-Demand Instance is launched, the capacity units count toward the desired capacity. Amazon EC2 Auto Scaling launches instances until the desired capacity is totally fulfilled, even if this results in an overage. For example, if there are two units remaining to fulfill capacity, and Amazon EC2 Auto Scaling can only launch an instance with a
WeightedCapacity
of five units, the instance is launched, and the desired capacity is exceeded by three units. For more information, see Configure an Auto Scaling group to use instance weights in the Amazon EC2 Auto Scaling User Guide. Value must be in the range of 1–999.If you specify a value for
WeightedCapacity
for one instance type, you must specify a value forWeightedCapacity
for all of them.Every Auto Scaling group has three size parameters (
DesiredCapacity
,MaxSize
, andMinSize
). Usually, you set these sizes based on a specific number of instances. However, if you configure a mixed instances policy that defines weights for the instance types, you must specify these sizes with the same units that you use for weighting instances.LaunchTemplateSpecification
— (map
)Provides a launch template for the specified instance type or set of instance requirements. For example, some instance types might require a launch template with a different AMI. If not provided, Amazon EC2 Auto Scaling uses the launch template that's specified in the
LaunchTemplate
definition. For more information, see Specifying a different launch template for an instance type in the Amazon EC2 Auto Scaling User Guide.You can specify up to 20 launch templates per Auto Scaling group. The launch templates specified in the overrides and in the
LaunchTemplate
definition count towards this limit.LaunchTemplateId
— (String
)The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.LaunchTemplateName
— (String
)The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API.
Conditional: You must specify either a
LaunchTemplateId
or aLaunchTemplateName
.Version
— (String
)The version number,
$Latest
, or$Default
. To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API. If the value is$Latest
, Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is$Default
, Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is$Default
.
InstanceRequirements
— (map
)The instance requirements. Amazon EC2 Auto Scaling uses your specified requirements to identify instance types. Then, it uses your On-Demand and Spot allocation strategies to launch instances from these instance types.
You can specify up to four separate sets of instance requirements per Auto Scaling group. This is useful for provisioning instances from different Amazon Machine Images (AMIs) in the same Auto Scaling group. To do this, create the AMIs and create a new launch template for each AMI. Then, create a compatible set of instance requirements for each launch template.
Note: If you specifyInstanceRequirements
, you can't specifyInstanceType
.VCpuCount
— required — (map
)The minimum and maximum number of vCPUs for an instance type.
Min
— required — (Integer
)The minimum number of vCPUs.
Max
— (Integer
)The maximum number of vCPUs.
MemoryMiB
— required — (map
)The minimum and maximum instance memory size for an instance type, in MiB.
Min
— required — (Integer
)The memory minimum in MiB.
Max
— (Integer
)The memory maximum in MiB.
CpuManufacturers
— (Array<String>
)Lists which specific CPU manufacturers to include.
-
For instance types with Intel CPUs, specify
intel
. -
For instance types with AMD CPUs, specify
amd
. -
For instance types with Amazon Web Services CPUs, specify
amazon-web-services
.
Note: Don't confuse the CPU hardware manufacturer with the CPU hardware architecture. Instances will be launched with a compatible CPU architecture based on the Amazon Machine Image (AMI) that you specify in your launch template.Default: Any manufacturer
-
MemoryGiBPerVCpu
— (map
)The minimum and maximum amount of memory per vCPU for an instance type, in GiB.
Default: No minimum or maximum limits
Min
— (Float
)The memory minimum in GiB.
Max
— (Float
)The memory maximum in GiB.
ExcludedInstanceTypes
— (Array<String>
)The instance types to exclude. You can use strings with one or more wild cards, represented by an asterisk (
*
), to exclude an instance family, type, size, or generation. The following are examples:m5.8xlarge
,c5*.*
,m5a.*
,r*
,*3*
.For example, if you specify
c5*
, you are excluding the entire C5 instance family, which includes all C5a and C5n instance types. If you specifym5a.*
, Amazon EC2 Auto Scaling will exclude all the M5a instance types, but not the M5n instance types.Note: If you specifyExcludedInstanceTypes
, you can't specifyAllowedInstanceTypes
.Default: No excluded instance types
InstanceGenerations
— (Array<String>
)Indicates whether current or previous generation instance types are included.
-
For current generation instance types, specify
current
. The current generation includes EC2 instance types currently recommended for use. This typically includes the latest two to three generations in each instance family. For more information, see Instance types in the Amazon EC2 User Guide for Linux Instances. -
For previous generation instance types, specify
previous
.
Default: Any current or previous generation
-
SpotMaxPricePercentageOverLowestPrice
— (Integer
)[Price protection] The price protection threshold for Spot Instances, as a percentage higher than an identified Spot price. The identified Spot price is the price of the lowest priced current generation C, M, or R instance type with your specified attributes. If no current generation C, M, or R instance type matches your attributes, then the identified price is from either the lowest priced current generation instance types or, failing that, the lowest priced previous generation instance types that match your attributes. When Amazon EC2 Auto Scaling selects instance types with your attributes, we will exclude instance types whose price exceeds your specified threshold.
The parameter accepts an integer, which Amazon EC2 Auto Scaling interprets as a percentage.
If you set
DesiredCapacityType
tovcpu
ormemory-mib
, the price protection threshold is based on the per-vCPU or per-memory price instead of the per instance price.Note: Only one ofSpotMaxPricePercentageOverLowestPrice
orMaxSpotPriceAsPercentageOfOptimalOnDemandPrice
can be specified. If you don't specify either, Amazon EC2 Auto Scaling will automatically apply optimal price protection to consistently select from a wide range of instance types. To indicate no price protection threshold for Spot Instances, meaning you want to consider all instance types that match your attributes, include one of these parameters and specify a high value, such as999999
.MaxSpotPriceAsPercentageOfOptimalOnDemandPrice
— (Integer
)[Price protection] The price protection threshold for Spot Instances, as a percentage of an identified On-Demand price. The identified On-Demand price is the price of the lowest priced current generation C, M, or R instance type with your specified attributes. If no current generation C, M, or R instance type matches your attributes, then the identified price is from either the lowest priced current generation instance types or, failing that, the lowest priced previous generation instance types that match your attributes. When Amazon EC2 Auto Scaling selects instance types with your attributes, we will exclude instance types whose price exceeds your specified threshold.
The parameter accepts an integer, which Amazon EC2 Auto Scaling interprets as a percentage.
If you set
DesiredCapacityType
tovcpu
ormemory-mib
, the price protection threshold is based on the per-vCPU or per-memory price instead of the per instance price.Note: Only one ofSpotMaxPricePercentageOverLowestPrice
orMaxSpotPriceAsPercentageOfOptimalOnDemandPrice
can be specified. If you don't specify either, Amazon EC2 Auto Scaling will automatically apply optimal price protection to consistently select from a wide range of instance types. To indicate no price protection threshold for Spot Instances, meaning you want to consider all instance types that match your attributes, include one of these parameters and specify a high value, such as999999
.OnDemandMaxPricePercentageOverLowestPrice
— (Integer
)[Price protection] The price protection threshold for On-Demand Instances, as a percentage higher than an identified On-Demand price. The identified On-Demand price is the price of the lowest priced current generation C, M, or R instance type with your specified attributes. If no current generation C, M, or R instance type matches your attributes, then the identified price is from either the lowest priced current generation instance types or, failing that, the lowest priced previous generation instance types that match your attributes. When Amazon EC2 Auto Scaling selects instance types with your attributes, we will exclude instance types whose price exceeds your specified threshold.
The parameter accepts an integer, which Amazon EC2 Auto Scaling interprets as a percentage.
To turn off price protection, specify a high value, such as
999999
.If you set
DesiredCapacityType
tovcpu
ormemory-mib
, the price protection threshold is applied based on the per-vCPU or per-memory price instead of the per instance price.Default:
20
BareMetal
— (String
)Indicates whether bare metal instance types are included, excluded, or required.
Default:
Possible values include:excluded
"included"
"excluded"
"required"
BurstablePerformance
— (String
)Indicates whether burstable performance instance types are included, excluded, or required. For more information, see Burstable performance instances in the Amazon EC2 User Guide for Linux Instances.
Default:
Possible values include:excluded
"included"
"excluded"
"required"
RequireHibernateSupport
— (Boolean
)Indicates whether instance types must provide On-Demand Instance hibernation support.
Default:
false
NetworkInterfaceCount
— (map
)The minimum and maximum number of network interfaces for an instance type.
Default: No minimum or maximum limits
Min
— (Integer
)The minimum number of network interfaces.
Max
— (Integer
)The maximum number of network interfaces.
LocalStorage
— (String
)Indicates whether instance types with instance store volumes are included, excluded, or required. For more information, see Amazon EC2 instance store in the Amazon EC2 User Guide for Linux Instances.
Default:
Possible values include:included
"included"
"excluded"
"required"
LocalStorageTypes
— (Array<String>
)Indicates the type of local storage that is required.
-
For instance types with hard disk drive (HDD) storage, specify
hdd
. -
For instance types with solid state drive (SSD) storage, specify
ssd
.
Default: Any local storage type
-
TotalLocalStorageGB
— (map
)The minimum and maximum total local storage size for an instance type, in GB.
Default: No minimum or maximum limits
Min
— (Float
)The storage minimum in GB.
Max
— (Float
)The storage maximum in GB.
BaselineEbsBandwidthMbps
— (map
)The minimum and maximum baseline bandwidth performance for an instance type, in Mbps. For more information, see Amazon EBS–optimized instances in the Amazon EC2 User Guide for Linux Instances.
Default: No minimum or maximum limits
Min
— (Integer
)The minimum value in Mbps.
Max
— (Integer
)The maximum value in Mbps.
AcceleratorTypes
— (Array<String>
)Lists the accelerator types that must be on an instance type.
-
For instance types with GPU accelerators, specify
gpu
. -
For instance types with FPGA accelerators, specify
fpga
. -
For instance types with inference accelerators, specify
inference
.
Default: Any accelerator type
-
AcceleratorCount
— (map
)The minimum and maximum number of accelerators (GPUs, FPGAs, or Amazon Web Services Inferentia chips) for an instance type.
To exclude accelerator-enabled instance types, set
Max
to0
.Default: No minimum or maximum limits
Min
— (Integer
)The minimum value.
Max
— (Integer
)The maximum value.
AcceleratorManufacturers
— (Array<String>
)Indicates whether instance types must have accelerators by specific manufacturers.
-
For instance types with NVIDIA devices, specify
nvidia
. -
For instance types with AMD devices, specify
amd
. -
For instance types with Amazon Web Services devices, specify
amazon-web-services
. -
For instance types with Xilinx devices, specify
xilinx
.
Default: Any manufacturer
-
AcceleratorNames
— (Array<String>
)Lists the accelerators that must be on an instance type.
-
For instance types with NVIDIA A100 GPUs, specify
a100
. -
For instance types with NVIDIA V100 GPUs, specify
v100
. -
For instance types with NVIDIA K80 GPUs, specify
k80
. -
For instance types with NVIDIA T4 GPUs, specify
t4
. -
For instance types with NVIDIA M60 GPUs, specify
m60
. -
For instance types with AMD Radeon Pro V520 GPUs, specify
radeon-pro-v520
. -
For instance types with Xilinx VU9P FPGAs, specify
vu9p
.
Default: Any accelerator
-
AcceleratorTotalMemoryMiB
— (map
)The minimum and maximum total memory size for the accelerators on an instance type, in MiB.
Default: No minimum or maximum limits
Min
— (Integer
)The memory minimum in MiB.
Max
— (Integer
)The memory maximum in MiB.
NetworkBandwidthGbps
— (map
)The minimum and maximum amount of network bandwidth, in gigabits per second (Gbps).
Default: No minimum or maximum limits
Min
— (Float
)The minimum amount of network bandwidth, in gigabits per second (Gbps).
Max
— (Float
)The maximum amount of network bandwidth, in gigabits per second (Gbps).
AllowedInstanceTypes
— (Array<String>
)The instance types to apply your specified attributes against. All other instance types are ignored, even if they match your specified attributes.
You can use strings with one or more wild cards, represented by an asterisk (
*
), to allow an instance type, size, or generation. The following are examples:m5.8xlarge
,c5*.*
,m5a.*
,r*
,*3*
.For example, if you specify
c5*
, Amazon EC2 Auto Scaling will allow the entire C5 instance family, which includes all C5a and C5n instance types. If you specifym5a.*
, Amazon EC2 Auto Scaling will allow all the M5a instance types, but not the M5n instance types.Note: If you specifyAllowedInstanceTypes
, you can't specifyExcludedInstanceTypes
.Default: All instance types
InstancesDistribution
— (map
)The instances distribution.
OnDemandAllocationStrategy
— (String
)The allocation strategy to apply to your On-Demand Instances when they are launched. Possible instance types are determined by the launch template overrides that you specify.
The following lists the valid values:
- lowest-price
-
Uses price to determine which instance types are the highest priority, launching the lowest priced instance types within an Availability Zone first. This is the default value for Auto Scaling groups that specify InstanceRequirements.
- prioritized
-
You set the order of instance types for the launch template overrides from highest to lowest priority (from first to last in the list). Amazon EC2 Auto Scaling launches your highest priority instance types first. If all your On-Demand capacity cannot be fulfilled using your highest priority instance type, then Amazon EC2 Auto Scaling launches the remaining capacity using the second priority instance type, and so on. This is the default value for Auto Scaling groups that don't specify InstanceRequirements and cannot be used for groups that do.
OnDemandBaseCapacity
— (Integer
)The minimum amount of the Auto Scaling group's capacity that must be fulfilled by On-Demand Instances. This base portion is launched first as your group scales.
This number has the same unit of measurement as the group's desired capacity. If you change the default unit of measurement (number of instances) by specifying weighted capacity values in your launch template overrides list, or by changing the default desired capacity type setting of the group, you must specify this number using the same unit of measurement.
Default: 0
OnDemandPercentageAboveBaseCapacity
— (Integer
)Controls the percentages of On-Demand Instances and Spot Instances for your additional capacity beyond
OnDemandBaseCapacity
. Expressed as a number (for example, 20 specifies 20% On-Demand Instances, 80% Spot Instances). If set to 100, only On-Demand Instances are used.Default: 100
SpotAllocationStrategy
— (String
)The allocation strategy to apply to your Spot Instances when they are launched. Possible instance types are determined by the launch template overrides that you specify.
The following lists the valid values:
- capacity-optimized
-
Requests Spot Instances using pools that are optimally chosen based on the available Spot capacity. This strategy has the lowest risk of interruption. To give certain instance types a higher chance of launching first, use
capacity-optimized-prioritized
. - capacity-optimized-prioritized
-
You set the order of instance types for the launch template overrides from highest to lowest priority (from first to last in the list). Amazon EC2 Auto Scaling honors the instance type priorities on a best effort basis but optimizes for capacity first. Note that if the On-Demand allocation strategy is set to
prioritized
, the same priority is applied when fulfilling On-Demand capacity. This is not a valid value for Auto Scaling groups that specify InstanceRequirements. - lowest-price
-
Requests Spot Instances using the lowest priced pools within an Availability Zone, across the number of Spot pools that you specify for the
SpotInstancePools
property. To ensure that your desired capacity is met, you might receive Spot Instances from several pools. This is the default value, but it might lead to high interruption rates because this strategy only considers instance price and not available capacity. - price-capacity-optimized (recommended)
-
The price and capacity optimized allocation strategy looks at both price and capacity to select the Spot Instance pools that are the least likely to be interrupted and have the lowest possible price.
SpotInstancePools
— (Integer
)The number of Spot Instance pools across which to allocate your Spot Instances. The Spot pools are determined from the different instance types in the overrides. Valid only when the
SpotAllocationStrategy
islowest-price
. Value must be in the range of 1–20.Default: 2
SpotMaxPrice
— (String
)The maximum price per unit hour that you are willing to pay for a Spot Instance. If your maximum price is lower than the Spot price for the instance types that you selected, your Spot Instances are not launched. We do not recommend specifying a maximum price because it can lead to increased interruptions. When Spot Instances launch, you pay the current Spot price. To remove a maximum price that you previously set, include the property but specify an empty string ("") for the value.
If you specify a maximum price, your instances will be interrupted more frequently than if you do not specify one.
Valid Range: Minimum value of 0.001
MinSize
— (Integer
)The minimum size of the Auto Scaling group.
MaxSize
— (Integer
)The maximum size of the Auto Scaling group.
Note: With a mixed instances policy that uses instance weighting, Amazon EC2 Auto Scaling may need to go aboveMaxSize
to meet your capacity requirements. In this event, Amazon EC2 Auto Scaling will never go aboveMaxSize
by more than your largest instance weight (weights that define how many units each instance contributes to the desired capacity of the group).DesiredCapacity
— (Integer
)The desired capacity is the initial capacity of the Auto Scaling group after this operation completes and the capacity it attempts to maintain. This number must be greater than or equal to the minimum size of the group and less than or equal to the maximum size of the group.
DefaultCooldown
— (Integer
)Only needed if you use simple scaling policies.
The amount of time, in seconds, between one scaling activity ending and another one starting due to simple scaling policies. For more information, see Scaling cooldowns for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
AvailabilityZones
— (Array<String>
)One or more Availability Zones for the group.
HealthCheckType
— (String
)A comma-separated value string of one or more health check types.
The valid values are
EC2
,EBS
,ELB
, andVPC_LATTICE
.EC2
is the default health check and cannot be disabled. For more information, see Health checks for instances in an Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.Only specify
EC2
if you must clear a value that was previously set.HealthCheckGracePeriod
— (Integer
)The amount of time, in seconds, that Amazon EC2 Auto Scaling waits before checking the health status of an EC2 instance that has come into service and marking it unhealthy due to a failed health check. This is useful if your instances do not immediately pass their health checks after they enter the
InService
state. For more information, see Set the health check grace period for an Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.PlacementGroup
— (String
)The name of an existing placement group into which to launch your instances. For more information, see Placement groups in the Amazon EC2 User Guide for Linux Instances.
Note: A cluster placement group is a logical grouping of instances within a single Availability Zone. You cannot specify multiple Availability Zones and a cluster placement group.VPCZoneIdentifier
— (String
)A comma-separated list of subnet IDs for a virtual private cloud (VPC). If you specify
VPCZoneIdentifier
withAvailabilityZones
, the subnets that you specify must reside in those Availability Zones.TerminationPolicies
— (Array<String>
)A policy or a list of policies that are used to select the instances to terminate. The policies are executed in the order that you list them. For more information, see Configure termination policies for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
Valid values:
Default
|AllocationStrategy
|ClosestToNextInstanceHour
|NewestInstance
|OldestInstance
|OldestLaunchConfiguration
|OldestLaunchTemplate
|arn:aws:lambda:region:account-id:function:my-function:my-alias
NewInstancesProtectedFromScaleIn
— (Boolean
)Indicates whether newly launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in. For more information about preventing instances from terminating on scale in, see Use instance scale-in protection in the Amazon EC2 Auto Scaling User Guide.
ServiceLinkedRoleARN
— (String
)The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other Amazon Web Services on your behalf. For more information, see Service-linked roles in the Amazon EC2 Auto Scaling User Guide.
MaxInstanceLifetime
— (Integer
)The maximum amount of time, in seconds, that an instance can be in service. The default is null. If specified, the value must be either 0 or a number equal to or greater than 86,400 seconds (1 day). To clear a previously set value, specify a new value of 0. For more information, see Replacing Auto Scaling instances based on maximum instance lifetime in the Amazon EC2 Auto Scaling User Guide.
CapacityRebalance
— (Boolean
)Enables or disables Capacity Rebalancing. For more information, see Use Capacity Rebalancing to handle Amazon EC2 Spot Interruptions in the Amazon EC2 Auto Scaling User Guide.
Context
— (String
)Reserved.
DesiredCapacityType
— (String
)The unit of measurement for the value specified for desired capacity. Amazon EC2 Auto Scaling supports
DesiredCapacityType
for attribute-based instance type selection only. For more information, see Create a mixed instances group using attribute-based instance type selection in the Amazon EC2 Auto Scaling User Guide.By default, Amazon EC2 Auto Scaling specifies
units
, which translates into number of instances.Valid values:
units
|vcpu
|memory-mib
DefaultInstanceWarmup
— (Integer
)The amount of time, in seconds, until a new instance is considered to have finished initializing and resource consumption to become stable after it enters the
InService
state.During an instance refresh, Amazon EC2 Auto Scaling waits for the warm-up period after it replaces an instance before it moves on to replacing the next instance. Amazon EC2 Auto Scaling also waits for the warm-up period before aggregating the metrics for new instances with existing instances in the Amazon CloudWatch metrics that are used for scaling, resulting in more reliable usage data. For more information, see Set the default instance warmup for an Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.
To manage various warm-up settings at the group level, we recommend that you set the default instance warmup, even if it is set to 0 seconds. To remove a value that you previously set, include the property but specify
-1
for the value. However, we strongly recommend keeping the default instance warmup enabled by specifying a value of0
or other nominal value.InstanceMaintenancePolicy
— (map
)An instance maintenance policy. For more information, see Set instance maintenance policy in the Amazon EC2 Auto Scaling User Guide.
MinHealthyPercentage
— (Integer
)Specifies the lower threshold as a percentage of the desired capacity of the Auto Scaling group. It represents the minimum percentage of the group to keep in service, healthy, and ready to use to support your workload when replacing instances. Value range is 0 to 100. To clear a previously set value, specify a value of
-1
.MaxHealthyPercentage
— (Integer
)Specifies the upper threshold as a percentage of the desired capacity of the Auto Scaling group. It represents the maximum percentage of the group that can be in service and healthy, or pending, to support your workload when replacing instances. Value range is 100 to 200. To clear a previously set value, specify a value of
-1
.Both
MinHealthyPercentage
andMaxHealthyPercentage
must be specified, and the difference between them cannot be greater than 100. A large range increases the number of instances that can be replaced at the same time.
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:
Generated on Fri Sep 6 18:21:46 2024 by yard 0.9.36 (ruby-2.5.1). - attachLoadBalancerTargetGroups(params = {}, callback) ⇒ AWS.Request