Deploy Your First Static Web App Using HTTPD on EC2

Step 1: Create a Static Web Page on Your Local System
Start by creating a basic HTML page. You can use any code editor like VS Code, Sublime Text, or even Notepad.
Step 2: Push Your Code to GitHub
➤ Create a New Repository on GitHub:
➤ Use Terminal to Upload Files:
Open your terminal and run the following commands:
bashCopyEditcd path/to/aws-webapp # Navigate to your project folder
git init # Initialize Git
ls # List files to check index.html is present
git add . # Stage all files
git commit -m "Initial commit" # Commit with a message
git remote add origin https://github.com/your-username/aws-webapp.git
git push -u origin master
Step 3: Deploy the App on AWS EC2
➤ Log in to AWS Management Console
Go to EC2 Dashboard and follow these steps:
1. Choose Launch Instance
Click “Launch Instance”
Name:
MyHTTPDWebApp
Tags: Add a key-value pair for identification (e.g.,
Project: AWSWebApp
)
2. Application and OS Image
Select Amazon Linux 2 AMI
Instance type: t2.micro (Free Tier eligible)
3. Key Pair
Create or select an existing key pair (e.g.,
aws-key
)Download
.pem
file safely for SSH login
4. Network Settings
- Allow HTTP (port 80), HTTPS (443), and SSH (22) in the security group/firewall
5. Storage and Advanced Options
Leave default (8 GB General Purpose SSD)
Click Launch Instance
Step 4: Connect to Your EC2 Instance
Use the terminal to SSH into your EC2 machine:
bashCopyEditchmod 400 aws-key.pem
ssh -i "aws-key.pem" ec2-user@your-ec2-public-ip
Step 5: Install and Configure HTTPD (Apache Web Server)
Once inside the EC2 terminal:
bashCopyEditsudo yum update -y
sudo yum install httpd -y
sudo systemctl start httpd
sudo systemctl enable httpd
Step 6: Clone Your GitHub Repository & Deploy
Install Git and clone your project:
bashCopyEditsudo yum install git -y
git clone https://github.com/your-username/aws-webapp.git
sudo cp aws-webapp/index.html /var/www/html/index.html
Restart Apache:
bashCopyEditsudo systemctl restart httpd
Step 7: Access Your Web App
Open a browser and enter:
arduinoCopyEdithttp://your-ec2-public-ip
Subscribe to my newsletter
Read articles from M Chidrup directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

M Chidrup
M Chidrup
Certified Azure Cloud Enthusiast and Full Stack Developer with a strong foundation in building secure, scalable cloud-native applications. Passionate about integrating AI and automation in DevOps pipelines and exploring intelligent cloud systems. I specialize in React, Node.js, Azure, Kubernetes, and DevSecOps, and I love solving real-world problems through code, collaboration, and continuous learning.