Expand description
Amazon EC2 Auto Scaling is designed to automatically launch or terminate EC2 instances based on user-defined scaling policies, scheduled actions, and health checks.
For more information about Amazon EC2 Auto Scaling, see the Amazon EC2 Auto Scaling User Guide. For information about granting IAM users required permissions for calls to Amazon EC2 Auto Scaling, see Granting IAM users required permissions for Amazon EC2 Auto Scaling resources in the Amazon EC2 Auto Scaling API Reference.
If you’re using the service, you’re probably looking for AutoscalingClient and Autoscaling.
Structs§
- Activities
Type - Activity
Describes scaling activity, which is a long-running process that represents a change to your Auto Scaling group, such as changing its size or replacing an instance.
- Activity
Type - Adjustment
Type Describes a policy adjustment type.
- Alarm
Describes an alarm.
- Attach
Instances Query - Attach
Load Balancer Target Groups Result Type - Attach
Load Balancer Target Groups Type - Attach
Load Balancers Result Type - Attach
Load Balancers Type - Auto
Scaling Group Describes an Auto Scaling group.
- Auto
Scaling Group Names Type - Auto
Scaling Groups Type - Auto
Scaling Instance Details Describes an EC2 instance associated with an Auto Scaling group.
- Auto
Scaling Instances Type - Autoscaling
Client - A client for the Auto Scaling API.
- Batch
Delete Scheduled Action Answer - Batch
Delete Scheduled Action Type - Batch
PutScheduled Update Group Action Answer - Batch
PutScheduled Update Group Action Type - Block
Device Mapping Describes a block device mapping.
- Cancel
Instance Refresh Answer - Cancel
Instance Refresh Type - Capacity
Forecast A
GetPredictiveScalingForecast
call returns the capacity forecast for a predictive scaling policy. This structure includes the data points for that capacity forecast, along with the timestamps of those data points.- Complete
Lifecycle Action Answer - Complete
Lifecycle Action Type - Create
Auto Scaling Group Type - Create
Launch Configuration Type - Create
OrUpdate Tags Type - Customized
Metric Specification Represents a CloudWatch metric of your choosing for a target tracking scaling policy to use with Amazon EC2 Auto Scaling.
To create your customized metric specification:
-
Add values for each required parameter from CloudWatch. You can use an existing metric, or a new metric that you create. To use your own metric, you must first publish the metric to CloudWatch. For more information, see Publish Custom Metrics in the Amazon CloudWatch User Guide.
-
Choose a metric that changes proportionally with capacity. The value of the metric should increase or decrease in inverse proportion to the number of capacity units. That is, the value of the metric should decrease when capacity increases.
For more information about CloudWatch, see Amazon CloudWatch Concepts.
-
- Delete
Auto Scaling Group Type - Delete
Lifecycle Hook Answer - Delete
Lifecycle Hook Type - Delete
Notification Configuration Type - Delete
Policy Type - Delete
Scheduled Action Type - Delete
Tags Type - Delete
Warm Pool Answer - Delete
Warm Pool Type - Describe
Account Limits Answer - Describe
Adjustment Types Answer - Describe
Auto Scaling Instances Type - Describe
Auto Scaling Notification Types Answer - Describe
Instance Refreshes Answer - Describe
Instance Refreshes Type - Describe
Lifecycle Hook Types Answer - Describe
Lifecycle Hooks Answer - Describe
Lifecycle Hooks Type - Describe
Load Balancer Target Groups Request - Describe
Load Balancer Target Groups Response - Describe
Load Balancers Request - Describe
Load Balancers Response - Describe
Metric Collection Types Answer - Describe
Notification Configurations Answer - Describe
Notification Configurations Type - Describe
Policies Type - Describe
Scaling Activities Type - Describe
Scheduled Actions Type - Describe
Tags Type - Describe
Termination Policy Types Answer - Describe
Warm Pool Answer - Describe
Warm Pool Type - Detach
Instances Answer - Detach
Instances Query - Detach
Load Balancer Target Groups Result Type - Detach
Load Balancer Target Groups Type - Detach
Load Balancers Result Type - Detach
Load Balancers Type - Disable
Metrics Collection Query - Ebs
Describes information used to set up an Amazon EBS volume specified in a block device mapping.
- Enable
Metrics Collection Query - Enabled
Metric Describes an enabled metric.
- Enter
Standby Answer - Enter
Standby Query - Execute
Policy Type - Exit
Standby Answer - Exit
Standby Query - Failed
Scheduled Update Group Action Request Describes a scheduled action that could not be created, updated, or deleted.
- Filter
Describes a filter that is used to return a more specific list of results when describing tags.
For more information, see Tagging Auto Scaling groups and instances in the Amazon EC2 Auto Scaling User Guide.
- GetPredictive
Scaling Forecast Answer - GetPredictive
Scaling Forecast Type - Instance
Describes an EC2 instance.
- Instance
Metadata Options The metadata options for the instances. For more information, see Configuring the Instance Metadata Options in the Amazon EC2 Auto Scaling User Guide.
- Instance
Monitoring Describes whether detailed monitoring is enabled for the Auto Scaling instances.
- Instance
Refresh Describes an instance refresh for an Auto Scaling group.
- Instance
Refresh Live Pool Progress Reports the progress of an instance refresh on instances that are in the Auto Scaling group.
- Instance
Refresh Progress Details Reports the progress of an instance refresh on 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).
- Instance
Refresh Warm Pool Progress Reports the progress of an instance refresh on instances that are in the warm pool.
- Instances
Distribution Describes an instances distribution for an Auto Scaling group with a MixedInstancesPolicy.
The instances distribution specifies the distribution of On-Demand Instances and Spot Instances, the maximum price to pay for Spot Instances, and how the Auto Scaling group allocates instance types to fulfill On-Demand and Spot capacities.
When you update
SpotAllocationStrategy
,SpotInstancePools
, orSpotMaxPrice
, this update action does not deploy any changes across the running Amazon EC2 instances in the group. Your existing Spot Instances continue to run as long as the maximum price for those instances is higher than the current Spot price. When scale out occurs, Amazon EC2 Auto Scaling launches instances based on the new settings. When scale in occurs, Amazon EC2 Auto Scaling terminates instances according to the group's termination policies.- Launch
Configuration Describes a launch configuration.
- Launch
Configuration Name Type - Launch
Configuration Names Type - Launch
Configurations Type - Launch
Template Describes a launch template and overrides.
You specify these properties as part of a mixed instances policy.
When you update the launch template or overrides, existing Amazon EC2 instances continue to run. When scale out occurs, Amazon EC2 Auto Scaling launches instances to match the new settings. When scale in occurs, Amazon EC2 Auto Scaling terminates instances according to the group's termination policies.
- Launch
Template Overrides Describes an override for a launch template. The maximum number of instance types that can be associated with an Auto Scaling group is 40. The maximum number of distinct launch templates you can define for an Auto Scaling group is 20. For more information about configuring overrides, see Configuring overrides in the Amazon EC2 Auto Scaling User Guide.
- Launch
Template Specification Describes the Amazon EC2 launch template and the launch template version that can be used by an Auto Scaling group to configure Amazon EC2 instances.
The launch template that is specified must be configured for use with an Auto Scaling group. For more information, see Creating a launch template for an Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.
- Lifecycle
Hook Describes a lifecycle hook, which tells Amazon EC2 Auto Scaling that you want to perform an action whenever it launches instances or terminates instances.
- Lifecycle
Hook Specification Describes information used to specify a lifecycle hook for an Auto Scaling group.
A lifecycle hook tells Amazon EC2 Auto Scaling to perform an action on an instance when the instance launches (before it is put into service) or as the instance terminates (before it is fully terminated).
This step is a part of the procedure for creating a lifecycle hook for an Auto Scaling group:
-
(Optional) Create a Lambda function and a rule that allows CloudWatch Events to invoke your Lambda function when Amazon EC2 Auto Scaling launches or terminates instances.
-
(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 pending state.
-
If you finish before the timeout period ends, complete the lifecycle action.
For more information, see Amazon EC2 Auto Scaling lifecycle hooks in the Amazon EC2 Auto Scaling User Guide.
-
- Load
Balancer State Describes the state of a Classic Load Balancer.
- Load
Balancer Target Group State Describes the state of a target group.
- Load
Forecast A
GetPredictiveScalingForecast
call returns the load forecast for a predictive scaling policy. This structure includes the data points for that load forecast, along with the timestamps of those data points and the metric specification.- Metric
Collection Type Describes a metric.
- Metric
Dimension Describes the dimension of a metric.
- Metric
Granularity Type Describes a granularity of a metric.
- Mixed
Instances Policy Describes a mixed instances policy for an Auto Scaling group. With mixed instances, your Auto Scaling group can provision a combination of On-Demand Instances and Spot Instances across multiple instance types. For more information, see Auto Scaling groups with multiple instance types and purchase options in the Amazon EC2 Auto Scaling User Guide.
You can create a mixed instances policy for a new Auto Scaling group, or you can create it for an existing group by updating the group to specify
MixedInstancesPolicy
as the top-level property instead of a launch configuration or launch template.- Notification
Configuration Describes a notification.
- Policies
Type - PolicyARN
Type Contains the output of PutScalingPolicy.
- Predefined
Metric Specification Represents a predefined metric for a target tracking scaling policy to use with Amazon EC2 Auto Scaling.
- Predictive
Scaling Configuration Represents a predictive scaling policy configuration to use with Amazon EC2 Auto Scaling.
- Predictive
Scaling Metric Specification This structure specifies the metrics and target utilization settings for a predictive scaling policy.
You must specify either a metric pair, or a load metric and a scaling metric individually. Specifying a metric pair instead of individual metrics provides a simpler way to configure metrics for a scaling policy. You choose the metric pair, and the policy automatically knows the correct sum and average statistics to use for the load metric and the scaling metric.
Example
-
You create a predictive scaling policy and specify
ALBRequestCount
as the value for the metric pair and1000.0
as the target value. For this type of metric, you must provide the metric dimension for the corresponding target group, so you also provide a resource label for the Application Load Balancer target group that is attached to your Auto Scaling group. -
The number of requests the target group receives per minute provides the load metric, and the request count averaged between the members of the target group provides the scaling metric. In CloudWatch, this refers to the
RequestCount
andRequestCountPerTarget
metrics, respectively. -
For optimal use of predictive scaling, you adhere to the best practice of using a dynamic scaling policy to automatically scale between the minimum capacity and maximum capacity in response to real-time changes in resource utilization.
-
Amazon EC2 Auto Scaling consumes data points for the load metric over the last 14 days and creates an hourly load forecast for predictive scaling. (A minimum of 24 hours of data is required.)
-
After creating the load forecast, Amazon EC2 Auto Scaling determines when to reduce or increase the capacity of your Auto Scaling group in each hour of the forecast period so that the average number of requests received by each instance is as close to 1000 requests per minute as possible at all times.
-
- Predictive
Scaling Predefined Load Metric Describes a load metric for a predictive scaling policy.
When returned in the output of
DescribePolicies
, it indicates that a predictive scaling policy uses individually specified load and scaling metrics instead of a metric pair.- Predictive
Scaling Predefined Metric Pair Represents a metric pair for a predictive scaling policy.
- Predictive
Scaling Predefined Scaling Metric Describes a scaling metric for a predictive scaling policy.
When returned in the output of
DescribePolicies
, it indicates that a predictive scaling policy uses individually specified load and scaling metrics instead of a metric pair.- Process
Type Describes a process type.
For more information, see Scaling processes in the Amazon EC2 Auto Scaling User Guide.
- Processes
Type - PutLifecycle
Hook Answer - PutLifecycle
Hook Type - PutNotification
Configuration Type - PutScaling
Policy Type - PutScheduled
Update Group Action Type - PutWarm
Pool Answer - PutWarm
Pool Type - Record
Lifecycle Action Heartbeat Answer - Record
Lifecycle Action Heartbeat Type - Refresh
Preferences Describes information used to start an instance refresh.
All properties are optional. However, if you specify a value for
CheckpointDelay
, you must also provide a value forCheckpointPercentages
.- Scaling
Policy Describes a scaling policy.
- Scaling
Process Query - Scheduled
Actions Type - Scheduled
Update Group Action Describes a scheduled scaling action.
- Scheduled
Update Group Action Request Describes information used for one or more scheduled scaling action updates in a BatchPutScheduledUpdateGroupAction operation.
- SetDesired
Capacity Type - SetInstance
Health Query - SetInstance
Protection Answer - SetInstance
Protection Query - Start
Instance Refresh Answer - Start
Instance Refresh Type - Step
Adjustment Describes information used to create a step adjustment for a step scaling policy.
For the following examples, suppose that you have an alarm with a breach threshold of 50:
-
To trigger the adjustment when the metric is greater than or equal to 50 and less than 60, specify a lower bound of 0 and an upper bound of 10.
-
To trigger the adjustment when the metric is greater than 40 and less than or equal to 50, specify a lower bound of -10 and an upper bound of 0.
There are a few rules for the step adjustments for your step policy:
-
The ranges of your step adjustments can't overlap or have a gap.
-
At most, one step adjustment can have a null lower bound. If one step adjustment has a negative lower bound, then there must be a step adjustment with a null lower bound.
-
At most, one step adjustment can have a null upper bound. If one step adjustment has a positive upper bound, then there must be a step adjustment with a null upper bound.
-
The upper and lower bound can't be null in the same step adjustment.
For more information, see Step adjustments in the Amazon EC2 Auto Scaling User Guide.
-
- Suspended
Process Describes an auto scaling process that has been suspended.
For more information, see Scaling processes in the Amazon EC2 Auto Scaling User Guide.
- Tag
Describes a tag for an Auto Scaling group.
- TagDescription
Describes a tag for an Auto Scaling group.
- Tags
Type - Target
Tracking Configuration Represents a target tracking scaling policy configuration to use with Amazon EC2 Auto Scaling.
- Terminate
Instance InAuto Scaling Group Type - Update
Auto Scaling Group Type - Warm
Pool Configuration Describes a warm pool configuration.
Enums§
- Attach
Instances Error - Errors returned by AttachInstances
- Attach
Load Balancer Target Groups Error - Errors returned by AttachLoadBalancerTargetGroups
- Attach
Load Balancers Error - Errors returned by AttachLoadBalancers
- Batch
Delete Scheduled Action Error - Errors returned by BatchDeleteScheduledAction
- Batch
PutScheduled Update Group Action Error - Errors returned by BatchPutScheduledUpdateGroupAction
- Cancel
Instance Refresh Error - Errors returned by CancelInstanceRefresh
- Complete
Lifecycle Action Error - Errors returned by CompleteLifecycleAction
- Create
Auto Scaling Group Error - Errors returned by CreateAutoScalingGroup
- Create
Launch Configuration Error - Errors returned by CreateLaunchConfiguration
- Create
OrUpdate Tags Error - Errors returned by CreateOrUpdateTags
- Delete
Auto Scaling Group Error - Errors returned by DeleteAutoScalingGroup
- Delete
Launch Configuration Error - Errors returned by DeleteLaunchConfiguration
- Delete
Lifecycle Hook Error - Errors returned by DeleteLifecycleHook
- Delete
Notification Configuration Error - Errors returned by DeleteNotificationConfiguration
- Delete
Policy Error - Errors returned by DeletePolicy
- Delete
Scheduled Action Error - Errors returned by DeleteScheduledAction
- Delete
Tags Error - Errors returned by DeleteTags
- Delete
Warm Pool Error - Errors returned by DeleteWarmPool
- Describe
Account Limits Error - Errors returned by DescribeAccountLimits
- Describe
Adjustment Types Error - Errors returned by DescribeAdjustmentTypes
- Describe
Auto Scaling Groups Error - Errors returned by DescribeAutoScalingGroups
- Describe
Auto Scaling Instances Error - Errors returned by DescribeAutoScalingInstances
- Describe
Auto Scaling Notification Types Error - Errors returned by DescribeAutoScalingNotificationTypes
- Describe
Instance Refreshes Error - Errors returned by DescribeInstanceRefreshes
- Describe
Launch Configurations Error - Errors returned by DescribeLaunchConfigurations
- Describe
Lifecycle Hook Types Error - Errors returned by DescribeLifecycleHookTypes
- Describe
Lifecycle Hooks Error - Errors returned by DescribeLifecycleHooks
- Describe
Load Balancer Target Groups Error - Errors returned by DescribeLoadBalancerTargetGroups
- Describe
Load Balancers Error - Errors returned by DescribeLoadBalancers
- Describe
Metric Collection Types Error - Errors returned by DescribeMetricCollectionTypes
- Describe
Notification Configurations Error - Errors returned by DescribeNotificationConfigurations
- Describe
Policies Error - Errors returned by DescribePolicies
- Describe
Scaling Activities Error - Errors returned by DescribeScalingActivities
- Describe
Scaling Process Types Error - Errors returned by DescribeScalingProcessTypes
- Describe
Scheduled Actions Error - Errors returned by DescribeScheduledActions
- Describe
Tags Error - Errors returned by DescribeTags
- Describe
Termination Policy Types Error - Errors returned by DescribeTerminationPolicyTypes
- Describe
Warm Pool Error - Errors returned by DescribeWarmPool
- Detach
Instances Error - Errors returned by DetachInstances
- Detach
Load Balancer Target Groups Error - Errors returned by DetachLoadBalancerTargetGroups
- Detach
Load Balancers Error - Errors returned by DetachLoadBalancers
- Disable
Metrics Collection Error - Errors returned by DisableMetricsCollection
- Enable
Metrics Collection Error - Errors returned by EnableMetricsCollection
- Enter
Standby Error - Errors returned by EnterStandby
- Execute
Policy Error - Errors returned by ExecutePolicy
- Exit
Standby Error - Errors returned by ExitStandby
- GetPredictive
Scaling Forecast Error - Errors returned by GetPredictiveScalingForecast
- PutLifecycle
Hook Error - Errors returned by PutLifecycleHook
- PutNotification
Configuration Error - Errors returned by PutNotificationConfiguration
- PutScaling
Policy Error - Errors returned by PutScalingPolicy
- PutScheduled
Update Group Action Error - Errors returned by PutScheduledUpdateGroupAction
- PutWarm
Pool Error - Errors returned by PutWarmPool
- Record
Lifecycle Action Heartbeat Error - Errors returned by RecordLifecycleActionHeartbeat
- Resume
Processes Error - Errors returned by ResumeProcesses
- SetDesired
Capacity Error - Errors returned by SetDesiredCapacity
- SetInstance
Health Error - Errors returned by SetInstanceHealth
- SetInstance
Protection Error - Errors returned by SetInstanceProtection
- Start
Instance Refresh Error - Errors returned by StartInstanceRefresh
- Suspend
Processes Error - Errors returned by SuspendProcesses
- Terminate
Instance InAuto Scaling Group Error - Errors returned by TerminateInstanceInAutoScalingGroup
- Update
Auto Scaling Group Error - Errors returned by UpdateAutoScalingGroup
Traits§
- Autoscaling
- Trait representing the capabilities of the Auto Scaling API. Auto Scaling clients implement this trait.