AWS How-To: Auto Scaling your AWS Workloads

Dynamically adjusting the workload to ensure the right number of instances is one of the challenges in managing a large workload. Performance will suffer if there are too many instances. Overuse of instances will result in unnecessary costs.
Amazon Web Services (AWS), which includes an autoscaler, allows you to automatically run a workload across the best number of instances.
A load balancer is the first step to auto-scaling a workload. I already wrote about load balancers in the previous column. I won’t repeat it here. To use auto scaling, you will need to know the region of your load balancer. Logging into the EC2 console and clicking on the Load Balancer container will reveal the region. Note the availability zone. Figure 1 shows how this looks.
[Click on the image to see a larger version.] Figure 1: Take note of the availability zones for your load balancer. Click on the Auto Scaling Groups box in the EC2 console’s navigation pane. The console will now display the Auto Scaling welcome screen. Figure 2 shows the screen listing the benefits of auto scaling. After reviewing these benefits click on the Create Auto Scaling Group link.
[Click on the image to see a larger version.] Figure 2: Click on the Create Auto Scaling Group button. The screen below shows that there are two steps required to create an auto scaling group. The first step is to create an auto scaling group. You will need to create a template that can be used for launching instances. AWS allows you to modify this template later if needed.
The second step is to create an actual auto scaling group. This involves giving a name to the group, and specifying the number of instances the group should use.
Click on the Create Launch Config button to begin the configuration process.
You will be prompted to choose the AIM Template that you would like to use for the auto-scaling group. This screen looks exactly the same as when you manually create an instance, as shown in Figure 3. The process of creating a launch configuration is almost identical to the one used for setting up a new instance.
[Click on the image to see a larger view.] Figure 3: Select the instance you wish to use. After you’ve created your launch configuration click on the Create Launch Config button. After you have completed the launch configuration, you will be prompted either to select an existing key pairing or to create a brand new key pair. This is just like if you were creating an EC2 instance. Click the Create Launch Configuration button to make your selection.
You will now be taken to Figure 4’s Create Auto Scaling group screen. This screen will prompt you to give a group name and specify how many instances you wish to start with. You can also choose the network or subnet you want to use for the auto-scaling group.
[Click on the image to see a larger view.] Figure 4: Enter a name for the group and indicate how many instances you would like to use initially. After making your selections click Next. A prompt will appear asking you whether you want to keep the group the same size as it was when you created it or if scaling policies are used to increase its capacity. If you are unsure if dynamic scaling is necessary in the future, the option to keep the group the same size as it was before is helpful. You would normally choose to use scaling policies to adjust group capacity. Figure 5 shows that you have the option to specify the minimum and maximum numbers.