Home » AWS Auto Scaling for Beginners: Build & Test Your First Group

AWS Auto Scaling for Beginners: Build & Test Your First Group

Auto Scaling Group

Introduction

If you have ever worried about your app slowing down during heavy traffic or wondered how to save costs when things are quiet, you are not alone. That is where AWS Auto Scaling comes in it automatically adjusts the number of EC2 instances your app is using, so you always have the right amount of power without overspending.

In this guide, I will walk you through the entire process of setting up Auto Scaling on AWS from launching your very first EC2 instance to configuring a scaling group that reacts to real-time CPU usage. Don’t worry if you are new to this; I will explain everything in simple terms, step by step.

What is AWS Auto Scaling?

AWS Auto Scaling helps maintain application availability and allows you to scale your EC2 capacity up or down automatically according to conditions you define, such as CPU utilization or network traffic. This means your application can handle sudden spikes or drops in demand without manual intervention.

Prerequisites

  • AWS Account 
  • Basic knowledge of AWS EC2 Instance

Step 1: Create a Launch Template

  • Go to EC2 and select Launch template 
  • Click on launch template button 
create launch template
  • Provide name of your template 
    • Name: AS-template
    • Select OS : ubuntu
    • Instance Type: t2.micro
    • create key pair 
    • Security group : select port 22(SSH) and port 80 (HTTP)
  • Leave as default remaining setting 
  • Click on Launch template 

Step 2: Create Auto Scaling Group

  • Go to EC2 → Auto Scaling Groups → Create Auto Scaling group

create auto scaling group
  • Name: autoscaling-group
  • Select Template: select that one you have created before
  • Click on Next button
Select autoscaling tenplate
  • Select VPC: Default
  • Subnets: Choose two subnets in different AZ for high availability
  • Avaibility Zone: Balance Best effort
  • Click on Next button
Select VPC
  • Integrate with other services: Leave as default 
  • Click on Next button
  • Group Size
    • Desired: 1 
    • Min : 1 
    • Max: 3
desired capacity
  • Select Scaling Policies: Target Tracking Scaling Policy
  • Policy Name : AS-target tracking scaling polic
  • Metric Type : Average CPU Utilization 
  • Target Value: 50% 
  • Click on Next button 
target tracking policy
  • Click on Next button for skip notification 
  • Click on Next button for skip add tags [ but you must use in production level]
  • Ten review all the setting and click on create auto scaling group button
autoscaling group

Step 3: Test Auto Scaling (Manually Create Load)

Multi Copy Code Blocks
bash

sudo yum install -y stress
stress --cpu 2 --timeout 300
    
  • Wait for Auto scaling group 
  • Within a few minutes, new instance will be launch you can check or see from EC2 dashbaord 
Increase intances

Step 4: Clean Up

Remember to delete all resources (instances, Auto Scaling group, launch template, key pair) after the lab to avoid unwanted charges.

Leave a Reply

Your email address will not be published. Required fields are marked *