You can manually adjust the number of EC2 instances in your Auto Scaling group at any time. This process of changing the instance count manually is referred to as manual scaling. Manual scaling is an alternative to auto scaling, especially if you want to make one-time capacity changes.
After you manually scale your group, Amazon EC2 Auto Scaling resumes normal auto scaling activities based on the scaling policies and scheduled actions that you defined. For groups with default instance warmup enabled, any new instances go through a warmup period before they start contributing to the metrics used for auto scaling. This warmup period assists in stabilizing the group at the new capacity. For more information, see Set the default instance warmup for an Auto Scaling group.
Sometimes, you may want to temporarily disable scaling policies and scheduled actions before manually scaling a group. Doing so prevents conflicts from arising between manual scaling actions and automated scaling activities. For more information, see Turn off scaling activities.
Contents
Change the desired capacity of an existing
Auto Scaling group
When you change the desired capacity of your Auto Scaling group, Amazon EC2 Auto Scaling manages the process of launching and terminating instances to reach the new desired size.
To change the size of your Auto Scaling group
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/
, and choose Auto Scaling Groups from the navigation pane. -
Select the check box next to your Auto Scaling group.
A split pane displays at the bottom of the page.
-
On the Details tab, choose Group details, Edit.
-
For Desired capacity, increase or decrease the desired capacity. For example, to increase the size of the group by one, if the current value is
1
, enter2
.If your new value for Desired capacity is greater than Min desired capacity and Max desired capacity, the Max desired capacity is automatically increased to the new desired capacity value.
-
When you are finished, choose Update.
Verify that the group size that you specified resulted in the same amount of instances being launched. For example, if you increased the size of the group by one, verify that your Auto Scaling group has launched one additional instance.
To verify that the size of your Auto Scaling group has changed
-
On the Activity tab, in Activity history, you can view the progress of activities that are associated with the Auto Scaling group. The Status column shows the current status of your instance. While your instance is launching, the status column shows
Not yet in service
. The status changes toSuccessful
after the instance is launched. You can also use the refresh icon to see the current status of your instance. For more information, see Verify a scaling activity for an Auto Scaling group. -
On the Instance management tab, in Instances, you can view the status of the instance. It takes a short time for an instance to launch.
-
The Lifecycle column shows the state of your instance. Initially, your instance is in the
Pending
state. After an instance is ready to receive traffic, its state isInService
. -
The Health status column shows the result of the Amazon EC2 Auto Scaling health checks on your instance.
-
Terminate an instance in your Auto Scaling
group (AWS CLI)
There are times when you might want to manually scale in your Auto Scaling group but want
to terminate a specific instance. You can manually scale in your Auto Scaling group by using
the terminate-instance-in-auto-scaling-group--should-decrement-desired-capacity
option as shown in the
following example.
aws autoscaling terminate-instance-in-auto-scaling-group \ --instance-id
i-026e4c9f62c3e448c
--should-decrement-desired-capacity
The following is example output, which provides details about the scaling activity.
{
"Activities": [
{
"ActivityId": "b8d62b03-10d8-9df4-7377-e464ab6bd0cb",
"AutoScalingGroupName": "my-asg",
"Description": "Terminating EC2 instance: i-026e4c9f62c3e448c",
"Cause": "At 2023-09-23T06:39:59Z instance i-026e4c9f62c3e448c was taken out of service in response to a user request, shrinking the capacity from 1 to 0.",
"StartTime": "2023-09-23T06:39:59.015000+00:00",
"StatusCode": "InProgress",
"Progress": 0,
"Details": "{\"Subnet ID\":\"subnet-6194ea3b\",\"Availability Zone\":\"us-west-2c\"}"
}
]
}
This option is not available in the console. However, you can use the Instances page of the Amazon EC2 console to terminate an instance in your Auto Scaling group. When you do so, Amazon EC2 Auto Scaling detects that the instance is no longer running and replaces it automatically as part of the health check process. It takes a minute or two after you terminate the instance before a new instance launches. For information about how to terminate an instance, see Terminate an instance in the Amazon EC2 User Guide.
If you terminate instances in your group and that causes uneven distribution
across Availability Zones, Amazon EC2 Auto Scaling rebalances the group to re-establish an even
distribution unless you suspend the AZRebalance
process. For more
information, see Suspend and resume Amazon EC2 Auto Scaling
processes.