Working with Auto Scaling in AWS

By John Paul Mueller

Autoscaling is a built-in feature that automatically adjusts how your AWS setup reacts to loads. Autoscaling is the service you use to make your RDS setup autoscale within limits that you specify.

When you see the term autoscaling, think of the generic use of a feature (not necessarily a service) to make applications, services, and other AWS features add and remove resources as needed to make applications scale better and provide a consistent user experience. When you see Auto Scaling, think about the service that you specifically use to make autoscaling feasible with certain AWS services. The Auto Scaling feature enables your EC2 instances to handle loads without a lot of human intervention.

Applying Auto Scaling

You have several options for applying Auto Scaling to your running EC2 instance (instances that have an Instance State other than Running won’t allow you to apply Auto Scaling), but the easiest method is to select one or more EC2 instances in the Instances page and then choose Actions →   Instance Settings →   Attach to Auto Scaling Group. You see the Attach to Auto Scaling Group dialog box.

Auto Scaling Group AWS
Create a new Auto Scaling Group or use an existing one.

If you haven’t created an Auto Scaling group, you need to choose the A New Auto Scaling Group option, as shown. Type a name for the group in the Auto Scaling Group Name field, such as MyAutoScaleGroup, and then click Attach. AWS then automatically creates an Auto Scaling group for you that uses precisely the same settings as the selected EC2 instances.

Removing Auto Scaling

Unfortunately, you can’t remove an EC2 instance from an Auto Scaling Group in the Instances page. Use the following steps to remove an EC2 instance from an Auto Scaling Group.

  1. Choose Auto Scaling →  Auto Scaling Groups in the Navigation pane.

    You see the Auto Scaling Group page. You may need to click an Auto Scaling Groups link to see the list of groups.

  2. Select the Auto Scaling Group for the EC2 instance.
  3. Select the Instances tab of that group.

    You see a listing of EC2 instances attached to that group.

  4. Select the EC2 instance that you want to remove and then choose Actions →   Detach in the Instances Panel.

    Make sure that you choose the lower of the two Actions buttons. You see a Detach Instance dialog box.

  5. Click Detach Instance.

    AWS removes the EC2 instance from the Auto Scaling Group.

    remove EC2 instance
    Locate the EC2 instance that you want to remove.

 

Simply deleting the Auto Scaling Group terminates the attached EC2 instance. After an EC2 instance is terminated, you can’t recover it and must recreate the instance from scratch. The best way to avoid this problem is to provide your EC2 instance with termination protection by choosing Instance Settings →   Change Termination Protection on the Instances page for the selected EC2 instance. You see a dialog box in which you confirm that you want to enable termination protection.