Suspending and resuming scaling processes
This topic explains how to suspend and then resume one or more of the scaling processes for your Auto Scaling group. It also describes the issues to consider when choosing to use the suspend-resume feature of Amazon EC2 Auto Scaling.
Use the standby feature instead of the suspend-resume feature if you need to troubleshoot or reboot an instance. For more information, see Temporarily removing instances from your Auto Scaling group. Use the instance scale-in protection feature to prevent specific instances from being terminated during automatic scale in. For more information, see Instance scale-in protection.
In addition to suspensions that you initiate, Amazon EC2 Auto Scaling can also suspend processes for Auto Scaling groups that repeatedly fail to launch instances. This is known as an administrative suspension. An administrative suspension most commonly applies to Auto Scaling groups that have been trying to launch instances for over 24 hours but have not succeeded in launching any instances. You can resume processes that were suspended by Amazon EC2 Auto Scaling for administrative reasons.
Contents
Scaling processes
For Amazon EC2 Auto Scaling, there are two primary process types: Launch
and
Terminate
. The Launch
process adds a new Amazon EC2
instance to an Auto Scaling group, increasing its capacity. The Terminate
process removes an Amazon EC2 instance from the group, decreasing its capacity.
The other process types for Amazon EC2 Auto Scaling relate to specific scaling features:
-
AddToLoadBalancer
—Adds instances to the attached load balancer or target group when they are launched. -
AlarmNotification
—Accepts notifications from CloudWatch alarms that are associated with the group's scaling policies. -
AZRebalance
—Balances the number of EC2 instances in the group evenly across all of the specified Availability Zones when the group becomes unbalanced, for example, a previously unavailable Availability Zone returns to a healthy state. For more information, see Rebalancing activities. -
HealthCheck
—Checks the health of the instances and marks an instance as unhealthy if Amazon EC2 or Elastic Load Balancing tells Amazon EC2 Auto Scaling that the instance is unhealthy. This process can override the health status of an instance that you set manually. For more information, see Health checks for Auto Scaling instances. -
ReplaceUnhealthy
—Terminates instances that are marked as unhealthy and then creates new instances to replace them. -
ScheduledActions
—Performs the scheduled scaling actions that you create or that are created by the predictive scaling feature of AWS Auto Scaling.
Choosing to suspend
Each process type can be suspended and resumed independently. This section provides some guidance and behavior to take into account before deciding to suspend a scaling process. Keep in mind that suspending individual processes might interfere with other processes. Depending on the reason for suspending a process, you might need to suspend multiple processes together.
The following descriptions explain what happens when individual process types are suspended.
If you suspend either the Launch
or Terminate
process types, it can prevent other process types from functioning
properly.
Terminate
-
Your Auto Scaling group does not scale in for alarms or scheduled actions that occur while the process is suspended. In addition, the following processes are disrupted:
-
AZRebalance
is still active but does not function properly. It can launch new instances without terminating the old ones. This could cause your Auto Scaling group to grow up to 10 percent larger than its maximum size, because this is allowed temporarily during rebalancing activities. Your Auto Scaling group could remain above its maximum size until you resume theTerminate
process. WhenTerminate
resumes,AZRebalance
gradually rebalances the Auto Scaling group if the group is no longer balanced between Availability Zones or if different Availability Zones are specified. -
ReplaceUnhealthy
is inactive but notHealthCheck
. WhenTerminate
resumes, theReplaceUnhealthy
process immediately starts running. If any instances were marked as unhealthy whileTerminate
was suspended, they are immediately replaced.
-
Launch
-
Your Auto Scaling group does not scale out for alarms or scheduled actions that occur while the process is suspended.
AZRebalance
stops rebalancing the group.ReplaceUnhealthy
continues to terminate unhealthy instances, but does not launch replacements. When you resumeLaunch
, rebalancing activities and health check replacements are handled in the following way:-
AZRebalance
gradually rebalances the Auto Scaling group if the group is no longer balanced between Availability Zones or if different Availability Zones are specified. -
ReplaceUnhealthy
immediately replaces any instances that it terminated during the time thatLaunch
was suspended.
-
AddToLoadBalancer
-
Amazon EC2 Auto Scaling launches the instances but does not add them to the load balancer or target group. When you resume the
AddToLoadBalancer
process, it resumes adding instances to the load balancer or target group when they are launched. However, it does not add the instances that were launched while this process was suspended. You must register those instances manually.
AlarmNotification
-
Amazon EC2 Auto Scaling does not execute scaling policies when a CloudWatch alarm threshold is in breach. Suspending
AlarmNotification
allows you to temporarily stop scaling events triggered by the group's scaling policies without deleting the scaling policies or their associated CloudWatch alarms. When you resumeAlarmNotification
, Amazon EC2 Auto Scaling considers policies with alarm thresholds that are currently in breach.
AZRebalance
-
Your Auto Scaling group does not attempt to redistribute instances after certain events. However, if a scale-out or scale-in event occurs, the scaling process still tries to balance the Availability Zones. For example, during scale out, it launches the instance in the Availability Zone with the fewest instances. If the group becomes unbalanced while
AZRebalance
is suspended and you resume it, Amazon EC2 Auto Scaling attempts to rebalance the group. It first callsLaunch
and thenTerminate
.
HealthCheck
-
Amazon EC2 Auto Scaling stops marking instances unhealthy as a result of EC2 and Elastic Load Balancing health checks. Your custom health checks continue to function properly, however. After you suspend
HealthCheck
, if you need to, you can manually set the health state of instances in your group and haveReplaceUnhealthy
replace them.
ReplaceUnhealthy
-
Amazon EC2 Auto Scaling stops replacing instances that are marked as unhealthy. Instances that fail EC2 or Elastic Load Balancing health checks are still marked as unhealthy. As soon as you resume the
ReplaceUnhealthly
process, Amazon EC2 Auto Scaling replaces instances that were marked unhealthy while this process was suspended. TheReplaceUnhealthy
process calls both of the primary process types—firstTerminate
and thenLaunch
.
ScheduledActions
-
Amazon EC2 Auto Scaling does not execute scaling actions that are scheduled to run during the suspension period. When you resume
ScheduledActions
, Amazon EC2 Auto Scaling only considers scheduled actions whose execution time has not yet passed.
Suspending both launch and terminate
When you suspend the Launch
and Terminate
process
types together, the following happens:
-
Your Auto Scaling group cannot initiate scaling activities or maintain its desired capacity.
-
If the group becomes unbalanced between Availability Zones, Amazon EC2 Auto Scaling does not attempt to redistribute instances evenly between the Availability Zones that are specified for your Auto Scaling group.
-
Your Auto Scaling group cannot replace instances that are marked unhealthy.
When you resume the Launch
and Terminate
process
types, Amazon EC2 Auto Scaling replaces instances that were marked unhealthy while
the
processes were suspended and might attempt to rebalance the group. Scaling
activities also resume.
Additional considerations
There are some outside operations that might be affected while
Launch
and Terminate
are suspended.
-
Spot Instance Interruptions—If
Terminate
is suspended and your Auto Scaling group has Spot Instances, they can still terminate in the event that Spot capacity is no longer available. WhileLaunch
is suspended, Amazon EC2 Auto Scaling cannot launch replacement instances from another Spot Instance pool or from the same Spot Instance pool when it is available again. -
Attaching and Detaching Instances —When
Launch
andTerminate
are suspended, you can detach instances that are attached to your Auto Scaling group, but you can't attach new instances to the group. To attach instances, you must first resumeLaunch
.Note If detaching an instance will immediately be followed by manually terminating it, you can call the terminate-instance-in-auto-scaling-group CLI command instead. This terminates the specified instance and optionally adjusts the group's desired capacity. In addition, if the Auto Scaling group is being used with lifecycle hooks, the custom actions that you specified for instance termination will run before the instance is fully terminated.
-
Standby Instances—While
Launch
is suspended, you cannot return an instance in theStandby
state to service. To return the instance to service, you must first resumeLaunch
.
Suspend and resume scaling processes (console)
You can suspend and resume individual processes or all processes.
To suspend and resume processes
-
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/
. -
On the navigation pane, under AUTO SCALING, choose Auto Scaling Groups.
-
Select the check box next to the Auto Scaling group.
A split pane opens up in the bottom part of the Auto Scaling groups page, showing information about the group that's selected.
-
On the Details tab, choose Advanced configurations, Edit.
-
For Suspended processes, choose the process to suspend.
To resume a suspended process, remove it from Suspended processes.
-
Choose Update.
Suspend and resume scaling processes (AWS CLI)
You can suspend and resume individual processes or all processes.
To suspend a process
Use the suspend-processes command with the
--scaling-processes
option as follows.
aws autoscaling suspend-processes --auto-scaling-group-name
my-asg
--scaling-processesAlarmNotification
To suspend all processes
Use the suspend-processes command as follows
(omitting the --scaling-processes
option).
aws autoscaling suspend-processes --auto-scaling-group-name
my-asg
To resume a suspended process
Use the resume-processes command as follows.
aws autoscaling resume-processes --auto-scaling-group-name
my-asg
--scaling-processesAlarmNotification
To resume all suspended processes
Use the resume-processes command as follows
(omitting the --scaling-processes
option).
aws autoscaling resume-processes --auto-scaling-group-name
my-asg