Skip to content

aysharmaDevops/aws-ec2-apache-webserver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AWS EC2 Apache Webserver πŸš€

This project demonstrates how to launch an AWS EC2 instance, install Apache HTTP server, and host a simple webpage.


πŸ“Œ Architecture

  • AWS EC2 (Amazon Linux 2023)
  • Apache HTTPD (Web Server)
  • Security Group with inbound rules:
    • Port 22 (SSH) β†’ to connect via terminal
    • Port 80 (HTTP) β†’ to allow browser access

βš™οΈ Steps Followed

1. Launch EC2 Instance

  • Selected Amazon Linux 2023 AMI
  • Instance type: t2.micro (Free Tier)
  • Created key pair (.pem) for SSH login
  • Configured security group to allow:
    • SSH (22) from my IP
    • HTTP (80) from anywhere (0.0.0.0/0)

2. Connect to Instance

ssh -i "ayush-key.pem" ec2-user@<PUBLIC_IP>
3. Install Apache
bash
Copy code
sudo dnf update -y
sudo dnf install -y httpd
sudo systemctl start httpd
sudo systemctl enable httpd
4. Deploy Webpage
bash
Copy code
sudo mkdir -p /var/www/html
echo "Hello Ayush πŸš€ Your Apache web server is live on AWS EC2!" | sudo tee /var/www/html/index.html
sudo systemctl restart httpd
5. Verify in Browser
Open browser and enter:

cpp
Copy code
http://54.172.211.214
βœ… You should see:
Hello Ayush πŸš€ Your Apache web server is live on AWS EC2!

πŸ”’ Security Note
.gitignore excludes sensitive files (like *.pem)

Never upload private keys to GitHub!

πŸš€ Next Steps
Automate Apache installation with User Data script

Add TLS/SSL (HTTPS) with Amazon Certificate Manager

Deploy using Terraform / AWS CLI

Add CI/CD pipeline for automated deployments

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages