How to SetUp Scaling Processes in Auto Scaling Groups

code coding computer cyberspace
Reading Time: 5 minutes
Pro Tip: You Can Scale AWS ASGs Down to Zero - ParkMyCloud

Hello Readers! In this blog let’s see How to SetUp Scaling Processes in Auto Scaling Groups.

What’s an Auto Scaling Groups?

  1. In real-life the load on your websites and application can change.
  2. In the cloud, you can create and get rid of servers very quickly.
  3. The goal of an Auto Scaling Group (ASG) is to:
    • Scale out (add EC2 instances) to match an increased load
    • Scale in (remove EC2 instances) to match a decreased load.
    • Ensure we have a minimum and a maximum number of machines running.
    • Automatically Register new instances to a load balancer.

ASGs have the following attributes

  • A launch configuration
    • AMI + Instance Type
    • EC2 User Data
    • EBS Volumes
    • Security Groups
    • SSH Key Pair
  • Min Size / Max Size / Initial Capacity.
  • Network + Subnets Information.
  • Load Balancers Information.
  • Scaling Policies.

Auto Scaling Alarms

  • It is possible to scale an ASG based on CloudWatch alarms.
  • An Alarm monitors a metric (such as Average CPU).
  • Metrics are computed for the overall ASG instances.
  • Based on the alarm:
    • We can create Scale-out policies (increase the number of instances).
    • We can create Scale-in policies (decrease the number of instances).

Auto Scaling New Rules

  • It is now possible to define “better” auto scaling rules that are directly managed by EC2.
    • Target Average CPU Usage
    • Number of requests on the ELB per instance.
    • Average Network In.
    • Average Network Out.
  • These rules are easier to set up and can make more sense.

Let’s get started !

Scaling Processes in Auto Scaling Groups

Launch: Add a new EC2 to the group, increasing the capacity.

Terminate: Removes an EC2 instance from the group, decreasing its capacity.

Health Check: Checks the health of the instances.

Replace Unhealthy: Terminate unhealthy instances and re-create them.

AZ Rebalance: Balancer the number of EC2 instances across AZ.

Alarm Notification: Accept notification from CloudWatch.

Scheduled Actions: Performs scheduled actions that you create.

AddToLoadBalancer: Adds instances to the load balancer or target group.

Step 1: Firstly you must have logged into AWS Management Console account before starting. So, Create an AWS account if you don’t have one. After that Login to your AWS Management Console and Click on Services menu > Choose Auto Scaling Groups.

Step 2: Now we will create a Auto Scaling Groups, you need to give your auto scaling group a name, i’m going to name that My-Application.

You have to option you can either create your other scaling group from launch template or from launch configuration.

Step 3: Next we will create a launch configuration, let’s setup our launch configuration, i’m going to give it a name MyTemplate and i’m going to choose the AMI is Auto Scaling Groups because that is the name of my AMI.

Step 4: Instance Type
And the Next thing is to choose your instance type this is just the same process as an creating the EC2 instance and next is choose your instance type i’m going to select the t2.micro which is free and which has one vCPU and one Memory

Step 4: Key Pair (Login)

If you want to use your existing key pair than you can use, otherwise you can create your new key pair using create new key pair option, so i’m going to select here my existing key pair.

Step 6: Network Settings

Let’s leave all options as default and now we will create security group which is very important for your launch configuration,so i will give it to a name is application-test and description is totally optional you can configure according your customisation.

And now we will configure our ports number 22, 80. We have to need here ports 80 and 22, i will select here ssh for port 22 and custom TCP rule for port 80 and at last click on create launch configuration.

Step 7: Now we have create the launch configuration done we can now go back to our auto scaling group then we can click on refresh and attach the launch configuration to auto scaling group and after that you can configure your VPC and Subnets according to your customisation, now i’m going to leave as default setting and click on Next.

Step 8:Load balancing 

Now we will configure application load balancing if you want to learn how to setup application load balancer you can go through this link:https://blog.knoldus.com/how-to-setup-an-application-with-an-elastic-load-balancer%ef%bf%bc%ef%bf%bc/

After the setup your load balancing done you can click on Next.

Step 9:Configure group size and scaling policies

In which how many servers we want, you put in the minimum server or the maximum server, let’s suppose if you want to choose five server than you can choose your requirements, but now i’m going to choose minimum capacity is 1 and maximum capacity is 2.

Next is Scaling policies which is optional, i’m going to trigger additional server to spin up this is where you setup, Now i will choose here Target tracking scaling policy and i’m going to choose Average CPU utilisation, target value is default and instance need will be 300 and click on Next.

Step 10: You can add notification to either SMS or Email but for now i’m not going to add anything and click on Next and at last you can also add tags but we won’t do that click on Next and if you want to edit something then you can use edit from edit button and click on create auto scaling group.

Congrats! 👏 This is our Auto Scaling Groups and it will show us we have one instance running and you can see all activities.

Conclusion
Therefore In this blog we learn How to SetUp Scaling Processes in Auto Scaling Groups.Thanks, If you find this blog helpful do share with your friends.

HAPPY LEARNING!

knoldus

Written by 

I am an enthusiastic , hard-working and determine girl with strong attention to detail and eager to learn about new technologies.