Skip to main content
Launch this lab in the IP Lab Portal, then follow the steps below in the AWS console. Open IP Lab Portal

Overview

Lab details

  1. AWS Auto Scaling is a service that automatically adjusts the number of Amazon EC2 instances in a group based on specified conditions and policies. The lab aims to guide users through the process of creating a Launch Template, setting up an Auto Scaling group, and testing the scaling behavior.
  2. Duration: 55 minutes
  3. AWS Region: US East (N. Virginia) us-east-1.

Introduction

What is Amazon EC2 Auto Scaling

  • Amazon EC2 autoscaling is designed as a fully managed service that controls the number of running instances, in case your workload is higher, it will match by launching more instances instantaneously.
  • Unlike load balancer, you don’t provision EC2 Instances in advance and register as a target but you define the whole configuration in the Launch template which will scale out or scale in based on the traffic.
  • In auto-scaling, you also define what will be minimum capacity, desired capacity, and maximum capacity. Autoscaling makes sure that the number of instances specified in desired capacity is always running when traffic is normal, it will scale in when traffic is lowest and scale-out when running there is a spike.
  • While creating auto-scaling, it requires a Launch template where you specify which AMI to choose, what will be instance type, security group associated, and all other options required to launch an EC2 Instance including key pair.

#### What is the difference between Launch Templates (LTs) and Launch Configuration (LCs)

  • AWS Recommends using Launch Templates (LTs) over Launch Configurations (LCs) because LTs provide the latest features.
  • Launch configurations are immutable in nature, once you create, you can’t edit them, so replacement is the only option. Where Launch template provides versioning, at a time you can create multiple versions and make one of them as default for use.
  • Using Launch templates, you can use the T2 Unlimited burst feature.
  • Launch templates allow provisioning both On-demand and Spot Instances.
  • Launch templates are compatible to use with AWS Management Console, AWS SDK, and AWS CLI.

Architecture diagram

Task details

  1. Sign in to AWS Management Console.
  2. Creating Launch Template
  3. Create an Auto Scaling group
  4. Test the Auto Scaling Group.
  5. Validation of the lab

Launching the lab environment

  1. To launch the lab environment, click on the Launch lab button.
  2. Please wait until the cloud environment is provisioned. It will take less than a minute to provision.
  3. Once the Lab is started, you will be provided with IAM username, Password, Access Key, and Secret Access Key.
You can only start one lab at any given time

Lab guide

Lab steps

Task 1: Sign in to AWS Management Console

  1. Click on the Open console button, and you will get redirected to AWS Console in a new browser tab.
  2. On the AWS sign-in page,
  • Leave the Account ID as default. Never edit/remove the 12-digit Account ID present in the AWS Console. Otherwise, you cannot proceed with the lab.
  • Now copy your Username and Password in the Lab Console to the IAM Username and Password in AWS Console and click on the Sign-in button.
  1. Once Signed In to the AWS Management Console, make the default AWS Region as US East (N. Virginia) us-east-1.
If you face any issues, please go through FAQs and Troubleshooting.

Task 2: Provision Default VPC

  1. Navigate to VPC by clicking on the Services menu in the top, then click on VPC or Open the Amazon VPC console via https://console.aws.amazon.com/vpc/.
  2. Delete the default VPC by following the below steps:
    • In the navigation pane, choose Your VPCs.
    • Select the VPC with value as yes in default VPC column.
    • Go to Actions button and click on delete VPC button
    • Check I acknowledge that I want to delete my default VPC option.
    • Type delete default VPC and click on Delete button
  3. Now to provision Default VPC again
    • Refresh your console go to Actions and click Create default VPC
    • Click Create default VPC button and your default VPC will be created
If you are unable to delete the default VPC, please visit our FAQs and Troubleshooting for step-by-step instructions.

Task 3: Creating Launch Template

In this task, we are going to create Launch Templates, which are a recommended approach for creating instances in Auto Scaling groups. By creating a Launch Template, we define the configuration settings for their EC2 instances, including the Amazon Machine Image (AMI), instance type, network settings, and security groups.
  1. Make sure you are in the US East (N. Virginia) us-east-1 Region before proceeding with the Lab.
  2. Navigate to EC2 by clicking on the Services menu in the top, then click on EC2 in the Compute section.
  3. In the left navigation menu, scroll down to Launch Templates and click on Create launch template button.
  1. Launch template name: Enter whizlabsLT
  2. Template version description: Enter Launch template version 1
  3. Launch template contents:
    • Amazon machine image (AMI): Select Amazon Linux 2023 kernel-6.1 AMI
    • Instance type: Select t2.micro
  • Key pair (login):
    • Key pair name: Don’t include in the launch template
  1. Network settings:
    • Security groups: Select the Default security group of Default VPC
  2. Keep all the settings as default.
  3. Now, click on the Create launch template button
  4. The launch template is now created.
  5. Click on the View Launch template button.
  6. The launch template is now listed.

Task 4: Create an Auto Scaling Group

In this task, we are going to create an Auto Scaling group, which is a collection of EC2 instances that can automatically scale based on predefined policies and conditions.
  1. An Auto Scaling group is a scalable collection of EC2 instances. When you create an Auto Scaling group, you include information such as the subnets for the instances and the number of instances the group must maintain at all times.
  2. Go to the left menu under EC2 and choose Auto Scaling Group under Auto Scaling
  3. Click on the Create Auto Scaling group button.
  1. Step 1: Choose launch template or configuration
    • Auto Scaling group name: Enter whiz-ASG
    • Launch template: Select whizlabsLT
    • Click on the Next button.
  2. Step 2: Choose instance launch options
    • VPC: Select the Default VPC from the list.
    • Subnet: Select all the subnets.
    • Click on the Next button.
  1. Step 3: Integrate with other services
    • No changes are needed on this page, click on the Next button.
  2. Step 4: Configure group size and scaling
    • Under Group size – optional
      • Desired capacity: Enter 2
      • Minimum capacity: Enter 2
      • Maximum capacity: Enter 2
  • For Instance maintenance policy – is optional, leave it as it is.
  • No changes are needed, click on the Next button
  1. Step 5: Add notifications
    • No changes are needed on this page, click on the Next button.
  2. Step 6: Add tags
    • Enter tags in key-value pairs to identify your auto-scaling group.
    • Click on the Add tag button.
    • Key: Name
    • Value: ASG-EC2
    • Click on the Next button
  3. Now scroll down and click on the Create Auto Scaling group button.
  4. Whiz-ASG Auto scaling is created successfully.
  5. You will be redirected to the autoscaling group page, you will be able to see that two instances are launched by the autoscaling group.
  6. Now go to the EC2 instances list. You will see that there are two new running instances (which were created by your autoscaling group) You can confirm this from their tag name, which you gave at the time of creating the autoscaling group.
  7. You have successfully created an autoscaling group with a policy of a minimum of 2 and a maximum of 2 instances.

Task 5: Test Auto Scaling Group

In this task, we are going to validate the functionality of the Auto Scaling group
  1. For testing the auto-scaling policy, go to the EC2 instance list and select one of your instances.
  2. Next, select an instance and click on Instance state and then Stop instance.
  3. Click the Stop button on the pop-up window to stop your instance.
  4. Once your instance is stopped (after 1-2 minutes) you can see that your stopped instance will be terminating automatically, and a new instance will be launched to fulfill the policy condition. A sample screenshot is provided below:
  • Note: Launching a new instance may take a few minutes, you can refresh the page to view the new instance.
Do you know?Amazon Auto Scaling can integrate with Amazon CloudWatch, which is a monitoring and management service for AWS resources. By utilizing CloudWatch metrics, Auto Scaling can automatically adjust the capacity of EC2 instances based on predefined scaling policies. This means that as the workload increases or decreases, Auto Scaling can dynamically add or remove instances to match the demand, ensuring optimal performance and cost-efficiency.

Task 6: Validation Test

  1. Once the lab steps are completed, please click on the Check my work button on the Right side panel.
  2. This will validate the resources in the AWS account and displays whether you have completed this lab successfully or not.
  3. Sample output :

Completion and conclusion

  1. You have successfully used the AWS management console to create a Launch Template.
  2. You have configured your own details while creating an Auto Scaling Group.
  3. You stopped an EC2 instance to verify a replacement instance would be created, as per the requirement.

End lab

  1. Sign out from the AWS Management Console.
  2. Click on End lab button in the IP Lab Portal and wait till the process gets completed

What gets checked

When you press Check my work, the platform verifies each of these:
  • Create Amazon EC2 Auto Scaling Group — Check whether an Auto Scaling Group is created or not.
  • Create Amazon EC2 Launch Template — Check whether an EC2 Launch Template is created or not.
  • Launch EC2 AMI type Amazon Linux — Check whether the EC2 instance is launched using an Amazon AMI.
  • Launch an EC2 Instance — Check whether an EC2 Instance is launched or not.