Illuri Sandeep
4 min readMar 19, 2021

--

How to Launch Apache Webserver on AWS EC2-Instance and how to create our AMI ?

In this blog i will show how to launch the AWS EC2-instance and how to setup the Apache webserver on it and how to create our webserver ami.

The steps we follow to achieve our setup:

  1. Launch Instance from EC2 dashboard on AWS.
  2. Install Apache software on the Instance.
  3. Configure var/www/html file
  4. Start the webserver services.
  5. Create AMI

How to Launch Instance from EC2 dashboard on AWS

First sign into the AWS Console

Then go the services and click on ec2 you will launch into the ec2-dashboard

Then click on the launch instance from the EC2-dashboard.

Now you will ami screen will appear on your screen , select the Amazon Linux 2 AMI

Now you will need to select the instance type , select the instance type as t2.micro and click on the Next.

Now you will load into the page where we need to Configure Instance Details , but for now we will go with default settings , click Next.

After configure instance details we will land to the page where we need to add the volume, you can add the volume how much your website requires.

After clicking next on the storage page we will get into page where we need to add tags to our instance. Add the tag as shown in image.

Now we need to Configure Security Group,we allow port22 beacause we connect to instance using ssh-protocol. Since we are using the apache webserver we also allow port 80 i.eHTTP protocol by clicking on add rule.

After setting up the security groups we need to click on Review and Launch, then select the key pair and cklick on launch to launch the instance.

After the instance has launched now to get into the instance click on connect and select browser based connection the a new window pop up in your browser where the get the instance terminal.

Since we have succesfully launched our instance now we need to get into our root user account for that we need to type sudo su — root command in our terminal to switch from EC2-user to root user.

Now we need to install Apache web server for that we use a command yum install httpd -y.

Now we need to configure config file for this just go to var/www/html directory and create a file with index .html and write the html code on that file then save file.

cd /var/www/html

Now just start the Apache webserver services using a command

systemctl start httpd

systemctl status httpd — This command is to see status of webserver.

Now go to the browser and type your public-ip/filename.html in my case it is 13.126.67.96/index.html. Our webserver has launched successfully

Now we go the EC2-instance dashboard and select our instance and then click on Actions and select create image as shown in figure.

Our Apache webserver AMI has successfully created.

THANKYOU

--

--