π Hosting Your First Website on AWS EC2 with Elastic IP

Hi, Iβm Mohit Deore passionate about cloud computing, DevOps, and frontend technologies. I love building scalable applications and exploring new tools in the cloud and container ecosystem.
When I first started exploring AWS, I wanted to try something simple yet powerful: hosting my own website on an EC2 instance. In this blog, Iβll walk you through how I created a personal web server using EC2, Apache, and Elastic IP β all from scratch.
π Hosting a Simple Website on AWS EC2 :
1 ) Launch an EC2 Instance
π₯οΈ Choose Amazon Linux 2 (Free Tier eligible).
β‘ Instance type: t2.micro.
π Download the key pair (
.pemfile).
2)Connect to the Instance using SSH
ssh -i your-key.pem ec2-user@<public-ip>
3)Install Apache Web Server (β Apache will be now running)
sudo yum update -y
sudo yum install httpd -y
sudo systemctl start httpd
sudo systemctl enable httpd

4)Create a Simple HTML Page
echo "<h1>Hello from my EC2 Server π</h1>" | sudo tee /var/www/html/index.html
5)Update Security Group Rules
π Add inbound rule for HTTP (Port 80)
π Source:
0.0.0.0/0(Anywhere).
6)Assign an Elastic IP
βοΈ Go to Elastic IPs β Allocate new IP.
π Associate it with your EC2 instance.

7)Access the Website
π Open in browser:
http://<your-elastic-ip>
π Your site is live

β Why Elastic IP is Better than Default Public IP
π Default public IP changes every time you stop/start the instance.
π Elastic IP is static and stays permanent.
π Useful when hosting websites or mapping a custom domain.



