How to Create an Autoscaling group of EC2 Instances for high availability

Janita Williamson
4 min readAug 28, 2022

--

Autoscaling helps the availability of the application you’re trying to launch! AWS EC2 Instance offers so many resources to help with the availability of instances for consumers. In this article I will go over step by step on how to achieve creating an auto scaling group of EC2 Instances for high availability. Part 2 can be FOUND HERE! It is the Advanced & Complex portion for this project where I add target policies for the ASG, load balancers, security groups & more!

The task:

  1. Create VPC with CIDR
  2. Create 3 public subnets
  3. Create an autoscaling group with t2.micro instances (Apache install included)
  4. Create an application load balancer
  5. Create web server security groups
  6. Create a load balancer security group

What I used to complete the task:

  • AWS Account
  • CLI -command line interface
  • knowledge of autoscaling & load balancing
  • Apache install

Step 1. Create VPC with CIDR 10.10.0.0/16

Step 2. Create 3 public subnets

  • select the VPC you just created in the drop-drown box

Step 3. Create 3 subnets

  • create a name for each subnet, chose an Availability Zone for each & the IPv4 CIDR Block for each.
Subnet 1
Subnet 2
Subnet 3, then click “Create Subnet”
Success! We now have created 3 subnets…yay!

Step 4. Create an autoscaling group using t2.micro instances (Apache install included)

  • the first thing you’re going to want to do is create a launch template, and that can be found under the EC2 service
  • Next create a name for Launch Template
  • Under the Application and OS Images (AMI-Amazon Machine Image) select Amazon Linux AWS (leave everything as it defaults.
  • Instance Type, select t2 micro.
  • Key Pair (login), I selected one I’ve already created. If you need to create a key pair you have to create one in the EC2 Management Consule & select create new key pair, save the download into a place on your computer that’s easy to access and don’t share the code with anyone.
  • Network Settings> common security group (select the one you create for the VPC)> Advanced network configuration, Auto-assign public IP click enable.

Click the Advanced details at the very bottom

  • Click the Advanced details at the very bottom>User data> then enter your script. For this project it required an Apache install.
click create launch template when done.

To complete the Auto Scaling follow the red boxes below

Step. 5 Create an Application Load Balancer to distribute traffic to the autoscaling group

Leave everything the same here and just click next. You will create a load balancer later on.

That completes this portion of How to Create an Autoscaling group of EC2 Instances for high availability!

Check out PART 2 on that continues on with creating the load balancer & more.

That article can be FOUND HERE!

Let’s Connect!

My Linkedin profile: https://www.linkedin.com/in/janita-williamson-186a1a85

--

--

Janita Williamson

DevOps Engineer| AWS Certified |Appdynamics | Terraform | Kubernetes | Docker | Python | Linux