Introduction to Auto Scaling

Hands-On Lab

 

Photo of Christophe Limpalair

Christophe Limpalair

VP of Growth in Marketing

Length

00:45:00

Difficulty

Beginner

AWS Auto Scaling monitors your applications and automatically adjusts capacity to maintain steady, predictable performance at the lowest possible cost. Using AWS Auto Scaling, it’s easy to setup application scaling for multiple resources across multiple services in minutes. In this activity, we are going to cover the following objectives: - Set up an Auto Scaling launch configuration - Set up an Auto Scaling group - Launch instances across multiple subnets - Attach a load balancer to an Auto Scaling group - Launch a fixed number of instances

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Introduction

In this lab, we are going to cover the following objectives:

  • Set up an Auto Scaling Launch Configuration
  • Set up an Auto Scaling group
  • Launch instances across multiple subnets
  • Attach a load balancer to an Auto Scaling group
  • Launch a fixed number of instances

Creating a Launch Configuration

Navigate to the EC2 dashboard from the AWS Console and select Launch Configurations, located in the left bar under Auto Scaling.

Click Create Auto Scaling group. AWS will present a page with an overview of Auto Scaling group creation. Click Create launch configuration to move forward.

From here, you will need to select an Amazon Machine Image (AMI). On the left menu, ensure the Quick Start tab is selected. There is an AMI titled Amazon Linux AMI at the top of the list. Select this AMI by clicking the Select button to the right of the listing.

Use the default selection of t2.micro and press Next: Configure details.

Set the Name to first-launch-configuration for this lab. Do not check request Spot Instances and leave the IAM role setting unchanged and the Monitoring option unchecked.

Expand the Advanced Details section. Take note of the User data setting. This can be used to run commands that run when the instance launches (installing software, etc). We won't utilize it for this lab, however. Also take note of the different options for the IP Address Type setting. For this lab, we will leave the default selection of "Only assign a public IP address to instances in the default VPC and subnet."

Press Next: Add Storage. Take note of the options but leave everything with the default settings for now. Click the Next: Configure Security Group button.

We want to Create a new security group. You should already be familiar with security groups and could utilize these configurations when necessary. The defaults are fine for this lab, however, so click the Review button to view and confirm the configuration of our new launch configuration. If everything is configured correctly, click the Create launch configuration button.

You will be prompted to select an existing key pair or to create a new one. Use this prompt to create and download a new key pair, then click the Create launch configuration button.

Create an Auto Scaling Group

To match our naming convention so far, we will call our Auto Scaling group first-group. We want to set a Group size of 4 instances for high-availability purposes (this number is not final; it may be changed later on if the need arises). Select the available VPC under Network and add both subnets to the subnet area (we are using multiple for high availability).

Below the subnet area is an Advanced Details section. Expand it so we can configure the load balancing portion of the application. Check Recieve traffic from Elastic Load Balancer(s) and choose the available load balancer in the Classic Load Balancer setting below. Set the Health Check Type to EC2. You can leave the Health Check Grace Period at its default value of 300.

We are done configuring the Auto Scaling group for now. Click the Next: Configure scaling properties button. This page allows you to configure rules to scale up and down, but we will reserve this topic for a future lab. Ensure the Keep this group at its initial size option is selected, then click the Next: Configure Notifications button in the bottom right.

We won't configure any notifications for this lab, but this page can be used to create notifications for different events (when an instance successfully launches, if one fails to launch, etc). Click the Next: Configure Tags button to move on. You could use this page to configure tags, but we'll leave it alone for now and click the Review button.

Verify the settings on the review page, then click Create Auto Scaling Group. You will see a "Successfully create Auto Scaling group" page. Click the View you Auto Scaling groups link under the View section on this page.

You will see our new Auto Scaling group listed on this page. Notice the Desired, Min, and Max columns. You'll see that they're all set to 4 (based on the configurations we defined in this lab). The Instances column shows 0, but checking the Instances page (you can find the link in the navigation pane to the left of the page) shows that our instances are starting up. You can find the launch configuration we created by clicking on the Launch Configurations link in the navigation pane on the left of the page.