Moving to AWS from On-Premise Servers

Larry Johnson
4 min readJul 19, 2023

--

Create an EC2 Instance web server while being a start-up

Companies are always looking for ways to reduce their OPEX cost, maintain On-Premise hardware has also ways been a headache. Whether is you’re dealing with obsolete hardware, electricity cost, or even during the pandemic you had an shortage on computer chips.

Most have decided to do away with owning servers and instead rather pay cloud providers for that same infrastructure.

In this article, I’ll demonstrate how to create a simple cloud server as if you were a small start-up that didn’t have enough capital to spend.

Prerequisites
- An AWS account
- Terminal of your choice in order to SSH into the instance

  1. Launch an EC2 Amazon Linux t2.micro instance in the public subnet of of your Default VPC.
    Navigate to the EC2 of your AWS console.

Locate the Launch Instance button in the EC2 page of the AWS console.

You’ll be asked to name your server, for this project we’re going to use “Shadow_Corp”. While also selecting the preferred AMI that we would like to use which is “Amazon Linux”.

Select t.2 micro as your instance type.

Create a key pair that will be used to access your instance.

2. Create a Security Group that allows inbound HTTP traffic from 0.0.0.0/0 and inbound SSH traffic from your IP only. While also leaving the rest of the settings as default.
Once your verified everything is to your liking. Go ahead and click on the Launch Instance button.

Verify your instance is up and running by selecting it in your list of instances.

Verify your security group settings was also set correctly.

3. SSH into you instance

When ready to SSH into your instance, select your instance and click on the Connect button.

You’ll be brought to a screen with the command to SSH into the instance.

Now before you run that command in your terminal navigate to the folder which contains your key pair. The command won’t run if you’re not inside of this folder.

Once you’re connected to your instance lets create a script that will install our web server and our welcome page.

vim week5.sh
#!/bin/bash
#sudo yum update -y
#sudo yum install -y httpd
#sudo systemctl start httpd
#sudo system enable httpd
#echo " Hello there! Welcome to Shadow Corp " > /var/www/html/index.html

To make that file executable we’ll use the following command and then the next command to run it.

chmod +x week5.sh
sudo ./week5.sh

You’ll eventually see “complete” meaning Apache was installed successfully.

Now to verify the server is up and running we can do two things. We can either go back to our EC2 console and grab the public IP Address or we can use the command below to obtain it.

curl ifconfig.me

Using that command will return the below response.

Copy your IP Address into a web browser and you will see your custom home page.

You’ve now migrated one of your webservers over to AWS.

If you’ve made it here thanks for reading and feel free to connect with me on LinkedIn.

--

--