High Availability With Auto Scaling

Carlhector
5 min readSep 26, 2022

--

Objectives: For this week project, we will be creating an auto-scaling group of EC2 instances by creating a VPC (virtual private cloud) with a cidr, three public subnets, and an auto-scaling group.

What is Auto Scaling?

Auto Scaling is a collection of Amazon EC2. Amazon Auto Scaling helps us maintain application availability and allows us to add and remove EC2 instances.

Prerequisite.

1. AWS Account with IAM Admin privilege

2. A Command Line Terminal

Let’s get started with AWS Auto scaling

Step 1: Create a Virtual Private Cloud (VPC)

Log into your AWS account, navigate toward to your search box and type VPC.

We will then give our VPC an unique name

Choose and create a name tag. I choose to name mine “Miami Dolphins” The Dolphins are 3–0 by the way. We then have to make sure you select “VPC and more” as show in the picture below and also have to make sure that we select the correct IPv4 CIDR block.

Make sure you select “VPC and more” as show in the picture below

We will then click on “Create VPC” to create your VPC.

Once we create our VPC, we should see a green success message at the very top of our console indicating us that we were successful on creating the VCP

We will then have to create a Templates. To do that, we will once again use the search bar, type Instances, navigate to “Instances”, click on “Launch Templates” and then select “Create launch templates” .

We will name our template

We will then choose the application that we want to use. I chose to use the Amazon Linux AMI.

We will then select a key pair. I already created a key pair from previous projects, so no need to create a new one. The purpose of a key pair is to help us connect to our Ec2 instances using SSH

We will then select “Create security group”, and provide a name, description and a vpc as shown below

The next step is to add inbound security group rules

We will then select Network Configuration and enable “Auto-assign public IP

In the “User Data” section, we will update our user data to enable Apache. We will use Bash script to input our commands for Apache.

We then click on create launch template.

We will then create an Auto-Scaling group

We will then navigate to our network section to choose our VPC, AZs (Availability Zones), subnets, and our Instance type as well.

Although the load balancer says optional, we still need to select “attach to new load balancer” to gain internet access.

We will then fix our subnet, target group and name

We will then select “Create Auto Scaling group”

Our next step is to verify to see if our instances are running and if Apache was installed. We will copy our IP address from our instance into a web browser.

My instances were running perfectly, but I hit a roadblock with the IP address. I kept getting the browser page cannot be found. It was frustrating, but I figured it out. I connected my instance to a command line.

I then used the following command

I copied the IP address and pasted it to a wed browser and

It worked.

Thank you for taking your time to read my article. Your feedbacks are welcome.

--

--