Auto Scaling
Developer Guide (API Version 2011-01-01)
Print this pageEmail this pageGo to the ForumsView the PDFShare this page on TwitterShare this page on FacebookBookmark this page on DeliciousSubmit this page to RedditSubmit this page to DiggDid this page help you?  Yes  No   Tell us about it...

Merge into a Single Multi-Zone Group

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]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.

API Example

To merge separate single-zone Auto Scaling groups into a single multi-zone group

  1. 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

  2. Call SetDesiredCapacity with the following parameters to increase the capacity of myGroupA to six:

    • AutoScalingGroupName = myGroupA

    • DesiredCapacity = 6

  3. 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

  4. Delete myGroupB:

    1. Call UpdateAutoScalingGroup with the following parameters:

      • AutoScalingGroupName = myGroupB

      • MinSize = 0

      • MaxSize = 0

    2. Verify that your changes to myGroupB have taken effect by doing the following:

      1. Call DescribeAutoScalingGroup myGroupB to verify that no instances are left in the group.

      2. Call DescribeScalingActivites myGroupB to verify that all scaling activities have completed.

    3. Call DeleteAutoScalingGroup with the following parameter:

      • AutoScalingGroupName = myGroupB

Command Line Tools Example

To merge separate single-zone Auto Scaling groups into a single multi-zone group:

  1. 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 4

    Auto Scaling returns the following:

    OK-AutoScaling Group updated
  2. Call the as-set-desired-capacity command to increase the capacity of myGroupA to six.

    PROMPT>as-set-desired-capacity myGroupA --desired-capacity 6
  3. 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 myGroupA
  4. Delete myGroupB:

    1. Use the Auto Scaling as-update-auto-scaling-group command.

      PROMPT>as-update-auto-scaling-group myGroupB --min-size 0 --max-size 0

      Auto Scaling returns the following:

      OK-AutoScaling Group updated
    2. Verify that no instances remain in your Auto Scaling group by using the Auto Scaling as-describe-auto-scaling-groups command.

      [Note]Note

      Call this command until no more instances remain in the Auto Scaling group.

      PROMPT>as-describe-auto-scaling-groups myGroupB --headers

      Auto 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
    3. Verify that your scaling activities are successful by using the Auto Scaling as-describe-scaling-activities command.

      PROMPT>as-describe-scaling-activities myGroupB

      Auto 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."
    4. Use the Auto Scaling as-delete-auto-scaling-group command.

      PROMPT>as-delete-auto-scaling-group myGroupB

      Auto Scaling returns the following:

      Are you sure you want to delete this AutoScalingGroup?  [Ny]y
      1. Enter y to delete the trigger.

      Auto Scaling returns the following:

      OK-Deleted AutoScalingGroup