☁️ Launching an EC2 Instance and Hosting a Web Server (AWS Beginner Guide)
Hi everyone 👋
Today I tried something interesting in AWS —
I created an EC2 instance, installed a web server, and accessed it from my browser 🌐
Let me walk you through the steps in a simple way 👍
📌 What is EC2?
EC2 (Elastic Compute Cloud) is a service provided by AWS that allows you to create a virtual machine in the cloud.
👉 You can use it like your own computer:
- Install software
- Run applications
- Host websites
🚀 Step-by-Step Process
🔹 Step 1: Login to AWS Console
- Go to AWS Console
- Search for EC2
- Click Launch Instance
🔹 Step 2: Configure Instance
Choose the following:
- Name: MyWebServer
- AMI: Amazon Linux
- Instance Type: t2.micro (Free Tier)
🔹 Step 3: Create Key Pair
- Create a new key pair
- Download
.pemfile 👉 This is used to securely connect to your instance
🔹 Step 4: Configure Security Group
Allow these:
- SSH (Port 22) → for login
- HTTP (Port 80) → for web access
👉 Very important step!
🔹 Step 5: Launch Instance
Click Launch Instance ✅
Your EC2 server is now running 🎉
🔹 Step 6: Connect to EC2
Use SSH:
ssh -i your-key.pem ec2-user@your-public-ip
🔹 Step 7: Install Web Server
Install Apache:
sudo yum update -y
sudo yum install httpd -y
Start server:
sudo systemctl start httpd
sudo systemctl enable httpd
🔹 Step 8: Create a Simple Web Page
echo "<h1>Hello from EC2 🚀</h1>" | sudo tee /var/www/html/index.html
🔹 Step 9: Access from Browser
Open browser and enter:
http://your-public-ip
👉 You will see your webpage 🎉
🔁 Simple Flow
User → Browser → Public IP → EC2 Instance → Apache → Web Page
🧠 Real-Life Understanding
Think of EC2 like renting a computer in AWS:
- You install software
- You run a server
- Others can access it via internet
⚡ Important Points
✔ EC2 gives full control
✔ Security groups act like firewall
✔ Public IP is used for access
✔ Apache serves the webpage
🔐 Security Tip
- Never share your
.pemfile - Restrict SSH access if needed
- Use HTTPS for production
✅ Conclusion
In this task, we:
- Created an EC2 instance
- Installed a web server
- Hosted a webpage
- Accessed it from outside
This is the basic foundation of cloud hosting 🚀
Thanks for reading 😊
Top comments (0)