Let’s Create a Auto Scaling Group of EC2 Instances

Alexandria Chandler
5 min readMay 22, 2023

--

Hello ☁️Cloud Readers!

Today, I have been tasked with creating an Auto Scaling Group of EC2 Instances for scalability, reliability, and security for the Level Up Bank.

Important Essentials

  • Stable Internet Connection
  • AWS Account
  • Patience

Let’s get started!

In the VPC dashboard of AWS, I am going to create a new VPC with a CIDR block of 10.10.0.0/16.

Be sure to keep the default Tenancy, so that you can save more money. If I had selected Dedicated, it would have put my instances on hardware that is specifically dedicated to me, which would cost me more money. For the sake of this task, the default option would be more cost efficient.

Once the VPC is created, now we can make some minor changes like making sure our EC2 Instances get DNS gets host names. All I need to do is select our newly created VPC and click Actions to Edit VPC Settings. Listed under DNS settings, make sure Enable DNS Hostnames is checked.

The necessary modifications have been made, and my VPC is good to go. Now I can move on to creating my public subnets. These subnets will be a group of t2.micro instances with Apache installed.

The Subnet option is located right below my VPCs within AWS. Lets create a new one.

Notice it says Subnet 1 of 3. I promise the other two subnets have been created :D

The subnets have been creating, now we can move on to creating the Internet Gateway.

The Internet Gateway has also been created, now we can attach it to the VPC. It already gives a prompt to do so, but if you do not see a prompt, you can always go to Actions and select Attach to VPC.

I have created a custom VPC with public subnets and a Internet Gateway for our VPC. I can finally start making an Auto-Scaled Group of EC2 Instances.

The first thing I want to do is create a Launch Template within the EC2 Dashboard of AWS. This option will help me to configure my EC2 Instances for Auto Scaling. This is also similar to creating a normal EC2 Instance, but in a template format for reuse, share, or later launch purposes.

I am going to use a template that already has Apache installed since Level up Bank uses that particular web server. I am also using a VPC with the proper security group and the newly created Subnets.

The instance type is going to be the same version from my template, which is t2.micro.

The next set of configurations are going to be group size. For this task, these are the options I chose:

The next steps are not as important, so all there is left is to review and create the Auto Scaling Group!

I have already created a target group and registered those instances. The next step is to create a Load Balancer so that we can distribute traffic to the Auto Scaling Group we just created.

Clicking the None associated option will prompt you to create a load a balancer or associate the target with an existing one.

These are the steps I took to configuring the appropriate VPC, Subnets, and Security Groups :

I have connected the Target Group to the Load Balancer, but I have yet to connect the instances to the Target group. My Auto-Scaling Group is also detached.

To fix this, you are going to find the Load Balancing Tab in the Details of your Auto Scaling group we just created and add the target group. This way any time a new instance is launched into the group, it will be picked up by the load balancer.

The last step is to copy and paste the DNS name from your Load Balancer Details within the EC2 Dashboard.

And there you have it, as always, thanks for reading! 😎

--

--