| Did this page help you? Yes No Tell us about it... |
To merge separate single-zone Auto Scaling groups into a single Auto Scaling group spanning multiple Availability Zones, rezone one of the single-zone groups into a multi-zone Auto Scaling group, and then delete the other Auto Scaling groups.
The following examples assume that you have two identical groups: myGroupA in Availability Zone us-east-1a, and myGroupB
in Availability Zone us-east-1c. Each group is defined with two minimum instances, five maximum instances, and a desired capacity of three.
![]() | Note |
|---|---|
This example works for groups with or without a LoadBalancer, provided that the new multi-zone group will be in one of the same zones as the original single-zone groups. |
To merge separate single-zone Auto Scaling groups into a single multi-zone group
Call UpdateAutoScalingGroup with the following parameters to add myGroupA
to additional Availability Zones:
AvailabilityZones = us-east-1a, us-east-1c
AutoScalingGroupName = myGroupA
MinSize = 4
MaxSize = 10
Call SetDesiredCapacity with the following parameters to increase the capacity of
myGroupA to six:
AutoScalingGroupName = myGroupA
DesiredCapacity = 6
Call DescribeAutoScalingGroups with the following parameter to check that myGroupA
has been successfully added to the additional zones and is at the required capacity:
AutoScalingGroupName = myGroupA
Delete myGroupB:
Call UpdateAutoScalingGroup with the following
parameters:
AutoScalingGroupName =
myGroupB
MinSize = 0
MaxSize = 0
Verify that your changes to myGroupB have
taken effect by doing the following:
Call DescribeAutoScalingGroup
myGroupB to verify that
no instances are left in the group.
Call DescribeScalingActivites
myGroupB to verify that all
scaling activities have completed.
Call DeleteAutoScalingGroup with the following
parameter:
AutoScalingGroupName =
myGroupB
To merge separate single-zone Auto Scaling groups into a single multi-zone group:
Call the Auto Scaling as-update-auto-scaling-group command to add myGroupA to additional Availability Zones.
PROMPT>as-update-auto-scaling-group myGroupA --availability-zones us-east-1a, us-east-1c –-max-size 10 –-min-size 4Auto Scaling returns the following:
OK-AutoScaling Group updated
Call the as-set-desired-capacity command to increase the capacity of myGroupA to six.
PROMPT>as-set-desired-capacity myGroupA --desired-capacity 6
Call the as-describe-auto-scaling-groups command
to check that myGroupA has been successfully
added to the additional zones and is at the required capacity:
PROMPT>as-describe-auto-scaling-groups myGroupADelete myGroupB:
Use the Auto Scaling
as-update-auto-scaling-group command.
PROMPT>as-update-auto-scaling-group myGroupB --min-size 0 --max-size 0Auto Scaling returns the following:
OK-AutoScaling Group updated
Verify that no instances remain in your Auto Scaling group by
using the Auto Scaling
as-describe-auto-scaling-groups
command.
![]() | Note |
|---|---|
Call this command until no more instances remain in the Auto Scaling group. |
PROMPT>as-describe-auto-scaling-groups myGroupB --headersAuto Scaling returns the following:
AUTO-SCALING-GROUP GROUP-NAME LAUNCH-CONFIG AVAILABILITY-ZONES MIN-SIZE MAX-SIZE DESIRED-CAPACITY AUTO-SCALING-GROUP myGroupB MyLC us-east-1c 0 0 0
Verify that your scaling activities are successful by using the Auto
Scaling as-describe-scaling-activities
command.
PROMPT>as-describe-scaling-activities myGroupBAuto Scaling returns the following:
ACTIVITY ACTIVITY-ID END-TIME CODE CAUSE ACTIVITY 74758a33-bfd5-4df... 2009-05-11T16:27:36Z Successful "At 2009-05-21 10:00:00Z an instance was shutdown." ACTIVITY 74958a77-bfd5-4df... 2009-05-11T16:27:36Z Successful "At 2009-05-21 10:00:00Z an instance was shutdown."
Use the Auto Scaling
as-delete-auto-scaling-group command.
PROMPT>as-delete-auto-scaling-group myGroupBAuto Scaling returns the following:
Are you sure you want to delete this AutoScalingGroup? [Ny]y
Enter y to delete the trigger.
Auto Scaling returns the following:
OK-Deleted AutoScalingGroup