Resources

A new way to scale your servers on AWS is with Auto Scaling Group. A single instance may not be enough for some applications, but managing many instances can prove to be difficult. With an Auto Scaling Group, you can use Amazon Elastic Compute Cloud (Amazon EC2) capacity management services to automatically launch and terminate Amazon EC2 instances based on User policies. You get the best of both worlds!

What is an Auto Scaling Group?

The Auto Scaling Groups (ASG) is an AWS service that allows you to easily launch, configure, and manage a group of instances in an Availability Zone.

It allows you to specify AWS CloudWatch alarms that will trigger the ASG to change the instance size, launch more or fewer instances, or even terminate instances. By using CloudWatch events, you can also configure additional instances to start or stop in response to changes in your application’s load.

For example, if one of your ELB websites becomes overloaded with traffic, CloudWatch will automatically detect this and the ASG will be triggered to launch more EC2 instances. After things have quieted down again they are then terminated by the Auto Scaling Group. This way, you do not need to worry about manually changing any configurations when there is an increase in traffic – it all happens automatically behind the scenes!

The Auto Scaling Groups are associated with each other through “Launch Configuration”. When launching new instances using Launch Configuration users select which AutoScalingGroup they want the instance added to. If they don’t select an AutoScalingGroup it will be added to the default group with the same name as Launch Configuration.

An AWS Auto Scaling Group (ASG) is a fundamental component of AWS scaling solutions. AWS ASGs are designed to automatically adjust the number of instances in a group to maintain optimal performance and cost efficiency, based on defined criteria such as traffic load or resource utilization. In essence, AWS ASGs provide the scalability needed to ensure that your applications can handle varying workloads without manual intervention. They are a crucial part of AWS scaling strategies, enabling businesses to achieve elasticity and cost optimization in their cloud infrastructure. So, what exactly is an AWS ASG? It’s the linchpin that empowers your AWS environment to effortlessly adapt to changing demands, making it an indispensable tool for efficient cloud resource management.

CloudWatch is Amazon’s monitoring and alerting service for Amazon Web Services (AWS) resources such as Amazon Elastic Compute Cloud (EC2), Amazon Relational Database Service (RDS Service), Amazon Simple Storage Service (S3 Bucket), Amazon CloudFront, and more. It provides integrated Dashboards, Metrics, Notifications, and Logs so you can see your resource health status and activity logs at a glance.

Boost your earning potential with AWS expertise. Explore our certified AWS Courses for a high-paying career

Auto Scaling Components:

  1. Groups — Each EC2 instance is assigned to a group so that it may be treated as a logical unit when scaling and management. (When you create a group, we can set the minimum, maximum, and desired number of EC2 instances.)
  2. Configuration Templates- For our ec2 instances, we utilize launch configuration or launch template. We may provide details such as AMI ID, instance type, security groups, block device mapping…
  3. Scaling Options — Amazon EC2 Autoscaling allows us to scale our auto-scaling groups in a variety of ways. We may set the scale based on the occurrence of certain criteria (dynamic scaling) or at a specific time (scheduled scaling).

Build Your Career as a
AWS Solution Architect

AWS Solutions Architect Associate

Let’s Get Started

  1. Login into Amazon Management Console and search for EC2.
  2. Now, select Launch Template and then click Create Launch Template.

Auto Scaling Groups (ASG)

3.  Give a name to your Launch Template.

Auto Scaling Groups

4. Choose any Amazon Machine Image (AMI) you want to select from the dropdown. Here we are using Amazon Linux 2 AMI, SSD Volume Type.

(ASG)

5.   In Instance Type select t2.micro (free tier eligible).

6.  Next, you need to select a Key Pair for your template.

7.    In Network Settings, select Security Groups as default sg-77dd3c7c.

8.  Now, you can add User Data in Advanced Details. (User data is helpful for the user to host their first ec2 web application.)

 Click on Create Launch Template.

You have created your first Launch Template. Now, let’s create a Load Balancer for Launch Template. Here, we are going to create a Classic Load Balancer.

Steps to create a Load Balancer:-

  1. In EC2 Dashboard, select Load Balancers and Click on Create Load Balancer.
  2. Select Create under Classic Load Balancer in Select load balancer type.

3.  Give load balancer a unique name and click on Next.

4.  Select Create a new security group and give it a name and description. Click on Next.

5.  In Configure Health Checkups, set Interval as 10 seconds and Healthy Threshold to 2  Click on Next.

6.  Click on Next and finally on Create.

You have created a Load Balancer for your instance. Finally, now we will create an Auto Scaling Group with a few easy steps.

Steps to Create ASG:

  1. In the EC2 Management Console dashboard, select Auto Scaling Groups.
  2. Now click on Create Auto Scaling Group.
  3. Give a name to your Auto Scaling Group in configurations.

  1. Next, you need to select the Launch Template created earlier while creating a new Launch Template. Click on Next.

5.  In-Network, Select all the Subnets and click on Next.

6, Now in load balancing, choose Attach to an existing load balancer.

7.  Select Choose from the existing Classic Load Balancer and then select it from the dropdown menu. ( Selecting health Check Type as ELB is optional.)

 Click on Next.

  1. Now in Group Size set desired, minimum and maximum capacities of a group.

The desired capacity group size is the default number of instances in a group, the minimum capacity of a group is by default set as 1 and the maximum capacity group size is a maximum number of instances that can be created automatically.

Click on Next and finally click Create Auto Scaling Group.

As soon as you create an Autoscaling group two functionalities occur:

The desired number of EC2 instances are created and all instances are registered to load balancer by ASG.

Note:- Once you complete creating Auto Scaling Group and any of the instances are found unhealthy or missing, it is replaced by another instance immediately. You can try terminating any one instance from the EC2 dashboard and see the magic; another instance would be created to maintain the desired capacity of instances in a group.

Now you can check your web application page by accessing DNS from Load Balancer’s description section.

Hurray, you have configured all the settings correctly.

Conclusion

As we near the end of this blog post, you should have a better understanding of how Auto Scaling Groups work and what factors go into setting up your own. If you need help getting started with AWS technologies such as autoscale groups or just want to learn more about them in general, check out our blogs or training courses. We hope that through reading this article you’ve learned something new and can take it back to improve your skillset at doing your job successfully!