Steps to Enable Horizontal Auto Scaling for AWS Web Applications

Arish AhmadArish Ahmad
3 min read

Introduction

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.

Horizontal auto scaling in AWS is a way to scale a system by adding more machines or servers to an auto scaling group.

Follow these steps to horizontally auto scale an AWS web application

  1. Open the AWS Management Console and navigate to the EC2 dashboard.

  2. Create an instance and host a website, you can use an EC2 instance with Windows or an EC2 instance with Linux.

  3. Create an Image of this instance, you can use Create AMIs from EC2 Instances.

  4. In the left navigation panel, choose Auto Scaling Groups under Auto Scaling.

  5. Click Create Auto Scaling group.

  6. Write a suitable name for the Auto scaling group.

  7. Scroll down and click Create a launch template. A new tab will open up.

  8. Write a suitable name for the template.

  9. Scroll and click on My AMIs under Application and OS Images (Amazon Machine Image).

  10. Select the newly created AMI.

  11. Select any free tier instance type (Example: t2.micro).

  12. Select any Key pair.

  13. Select any Security group under Network settings

  14. Now click on Create the launch template.

  15. Please go ahead and return to the previous tab and refresh the launch template.

  16. Now you can select the newly created launch template from the drop-down.

  17. Click Next.

  18. Under Network select all the availability zones in which you want your instances.

  19. Now click Next.

  20. Scroll and hit Next.

  21. Under the Group Size set Desired capacity to 3.

    Desired capacity: Represents the initial capacity of the Auto Scaling group at the time of creation. An Auto Scaling group attempts to maintain the desired capacity. It starts by launching the number of instances that are specified for the desired capacity, and maintains this number of instances as long as there are no scaling policies or scheduled actions attached to the Auto Scaling group.

  22. Under Scaling set Min desired capacity to 2 and Max desired capacity to 5.

    Minimum desired capacity: This represents the minimum group size. When scaling policies are set, they cannot decrease the group's desired capacity lower than the minimum capacity.

    Maximum desired capacity: Represents the maximum group size. When scaling policies are set, they cannot increase the group's desired capacity higher than the maximum capacity.

  23. Now click on the Target tracking scaling policy.

  24. Now scroll and hit Next.

  25. Now click Next -> Next.

  26. Review all the changes made.

  27. Click on Create auto scaling group.

  28. You can go to the instances to check the creation on the EC2 instance with the same hosted website. To check, hit the Public IPv4 address of all the new instances.

  29. To delete the auto-scaling group, select the group -> Actions -> Delete -> type delete -> Delete.

  30. To delete the template, select the launch template -> Actions -> Delete template -> type delete -> Delete.

1
Subscribe to my newsletter

Read articles from Arish Ahmad directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Arish Ahmad
Arish Ahmad

Final-year BTech student specializing in software development. Completed a Flutter internship and amassed three years of project experience, crafting Threads clone, Stream Arbiter, Ticketify, and Google Docs. Proficient in C++, having successfully solved 250+ LeetCode questions.