Creating Auto Scaling Groups for EC2

It is relatively common for workloads to require more hardware resources than what a single EC2 instance can provide. In these types of situations, organizations often create scaling groups. A scaling group can create and delete instances in response to a workload's demands.

To get started, open the EC2 console and click on Auto Scaling Groups. When the Auto Scaling Groups page appears, click the Create Auto Scaling Group button. This will take you to a wizard that will walk you through the process of creating an auto scaling group.

The first screen, which you can see in Figure 1, requires you to enter a name for the group that you are creating. You will also need to choose a launch template. A launch template simply instructs AWS on how to create new VMs within the auto scaling group. For example, this template would specify the AMI to be used, your preferred key pair, the instance type that you want to use, and other information that would ordinarily be provided when manually creating an instance. If you have an existing template, you can select it from the drop-down. Otherwise, just click the Create a Launch Template link and follow the prompts to build your first template.

[Click on image for larger view.] Figure 1 You Will Need To Enter Name for The Auto Scaling Group that You Are Creating and Select a Launch Template.

Click next, and you will be take to the Choose Instance Launch Options, shown in Figure 2. Here you need only to select the VPC, availability zones and subnets that you want to use for the instances created within your auto scaling group. When you are done, click Next.

[Click on image for larger view.] Figure 2 Select The VPC and Subnets that You Want to Use

The next screen that you will see is used for configuring advanced options, as shown in Figure 3. All of the settings found on this screen are optional, but you can use the advanced options screen to integrate your auto scaling group with other services that you might be using. For example, you can select a load balancer, use lattice integration, enable group metric collections, or enforce health checks. When you have made your selection click Next.

[Click on image for larger view.] Figure 3 All of the Advanced Options Are Optional

Click Next, and you will be taken to the Group Size and Scaling Policies screen, shown in Figure 4. Once again, the settings found on this screen are optional. Even so, they are worth paying attention to.

As you can see in Figure 4, the Configure Group Size and Scaling Policies screen contains group size options that allow you to set capacity thresholds for the group. You can specify the groups minimum capacity, maximum capacity and desired capacity.

[Click on image for larger view.] Figure 4 This Screen Allows You to Set the Group Size and Scaling Policy

As you look at the screen shown above, you will notice a section called Scaling Policies. Although these policies are disabled by default, they are something that you will typically want to use with your scaling group. Selecting the Target Tracking Scaling Policy option reveals sub-options that allow you to create a policy that will scale by group based on CPU usage, network throughput or application load balancer requests. For example, you could create a rule to scale the group if the average CPU utilization is more than 50 percent. Incidentally, this section contains a check box that you can use to prevent scale in. Selecting this check box means that the policy can cause the group to scale out, but will never trigger a scale in.

Click Next, and you will be taken to the Add Notifications screen. Like many of the other options that have been discussed, notifications are completely optional. As you can see in Figure 5 however, the notifications option allows you to send notifications to SNS topics pertaining to launches, terminations, and failures that occur within the group.

[Click on image for larger view.] Figure 5 You Can Choose to Be Notified of Launch, Terminate, and Failure Events

Click Next, and you will be taken to the Tags screen. Although tags are used throughout the AWS ecosystem, tagging within auto scaling groups requires a bit of caution. If you duplicate any of the tags used within your launch template, those tags will be overridden.

Click Next and you will be taken to the Review screen. Take a moment and review all of the settings that you have entered. Assuming that the settings appear to be correct, click the Create Auto Scaling Group button to complete the process.

About the Author

Brien Posey is a 22-time Microsoft MVP with decades of IT experience. As a freelance writer, Posey has written thousands of articles and contributed to several dozen books on a wide variety of IT topics. Prior to going freelance, Posey was a CIO for a national chain of hospitals and health care facilities. He has also served as a network administrator for some of the country's largest insurance companies and for the Department of Defense at Fort Knox. In addition to his continued work in IT, Posey has spent the last several years actively training as a commercial scientist-astronaut candidate in preparation to fly on a mission to study polar mesospheric clouds from space. You can follow his spaceflight training on his Web site.


Subscribe on YouTube