Host Apache Web Server on Amazon EC2
Apache webserver can be used to host your website which we can do with help of some services which are provided by Amazon web services (AWS).
Pre-requisites :
- Need AWS account with internet connection
- Basic knowledge of Cloud Computing or Cloud services.
- Have AWS account or can sign in using Free Tier of AWS.
Let's Start With AWS Console :
First Create VPC :
For singl e public subnet
- Check Health Report before implementing VPC
- Login to AWS account > click on services >VPC
- Click on Create VPC > VPC and more > No. of AZ (Select 1 ) with one public subnet > Create
- Then, Modify " Auto-assign IP settings "
- Go to Security Groups and copy security ID for default security group
- Click on Create new security group with add All traffic in first rule and paste security ID
- Now, select SSH port to My IP in other rule and add HTTP rule to my IP as we have view Apache web page using browser.

Create EC2 instance in Public subnet :
- Step 1 : Choose AMI (Amazon machine image) Linux or windows (processor &Ram)
- Steps 2 choose instance type ( Hardware capa city) — (e.g t2.micro )
- Step 3 :Configure instance details (Auto-assign public IP enable)
- Step 4 : Add storage 8GB (space where you'll have data)
- Step 5 : Add Tags
- Steps 6 : Configure security Groups
- Review and Launch.

Now, Use SSH extension to login through SSH shell.

Install Apache :
- sudo apt update
- sudo apt install apache2
- cd /var/www/html/
- sudo nano /var/www/html/index.html (To Edit Html file)
- Copy public IP address from ec2 instance and paste it using google chrome or a ny other browser and you'll see Apache web page.

Congratulations, you've successfully hosted Apache webserver on Amazon EC2.
Afterwork :
- Terminate EC2 instance.
- Delete VPC which was created.
- Release Elastic IP address ( if you have deployed public + private cloud ) or else you'll get extra charges (As Amazon cloud delivers services on pay as you go pricing).
P.S : This is the easiest way to implement that worked for me.
Host Apache Web Server on Amazon EC2 was originally publish ed in Towards AWS on Medium, where people are continuing the conversation by highlighting and responding to this story.
Comments
Post a Comment