| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
In this section you will first remove the Amazon EC2 instance, then delete the Auto Scaling group, and finally delete the launch configuration.
You must terminate all Amazon EC2 instances in an Auto Scaling group before you can delete the group. A simple way to terminate all instances in a group is to update the group so that both the minimum size and maximum size are set to zero.
To remove the Amazon EC2 instance from the Auto Scaling group
Open a command prompt window: From a Windows computer, click Start. In
the Search box, type cmd, and then press Enter.
You'll use the as-update-auto-scaling-group command to update the Auto Scaling group that we created earlier. At the command prompt, type the following, and then press Enter:
PROMPT>as-update-auto-scaling-group MyAutoScalingGroup --min-size 0 --max-size 0
Auto Scaling returns the following:
OK-Updated AutoScalingGroup
Now you'll use the as-describe-auto-scaling-groups command to verify
that Auto Scaling has removed the instance from MyAutoScalingGroup.
It can take a few minutes for the instance to terminate, so you might have to check the status more than once. At the command prompt, type the following, and then press Enter:
PROMPT>as-describe-auto-scaling-groups MyAutoScalingGroup --headers
If the instance termination is still in progress, Auto Scaling returns information similar to the
following. (Your value for INSTANCE-ID will differ):
AUTO-SCALING-GROUP GROUP-NAME LAUNCH-CONFIG AVAILABILITY-ZONES LOAD-BALANCERS MIN-SIZE MAX-SIZE DESIRED-CAPACITY AUTO-SCALING-GROUP MyAutoScalingGroup MyLC us-east-1b,us-east-1c MyLB 0 0 0 INSTANCE INSTANCE-ID AVAILABILITY-ZONE STATE STATUS LAUNCH-CONFIG INSTANCE i-xxxxxxxx us-east-1c InService Healthy MyLC
Note
You can also click Instances in the Amazon EC2 console to view the status of your instances.
When no instances exist in MyAutoScalingGroup, you can delete the group.
To delete the Auto Scaling group
At the command prompt, type the following, and then press Enter:
PROMPT>as-delete-auto-scaling-group MyAutoScalingGroup
To confirm the deletion, type Y, and then press Enter.
Are you sure you want to delete this MyAutoScalingGroup? [Ny]
Auto Scaling returns the following:
OK-Deleted MyAutoScalingGroup
All that remains now is to delete the launch configuration you created for this Auto Scaling group.
To delete the launch configuration
At the command prompt,type the following, and then press Enter:
PROMPT>as-delete-launch-config MyLC
To confirm the deletion, type Y and then press Enter.
Are you sure you want to delete this launch configuration? [Ny]
Auto Scaling returns the following:
OK-Deleted launch configuration