🧠 Prerequisites
AWS account
Basic Node.js knowledge
Terminal and VS Code installed
GitHub account (for code upload)
🪄 Step 1: Create EC2 Instance
Go to AWS EC2 Dashboard → Launch Instance
Choose Ubuntu (20.04 preferred)
Instance type: t2.micro (free tier)
Key pair: Create or download .pem file (e.g., my-webserver-kp.pem)
In Security Group, allow inbound rule for:
SSH (22)
HTTP (80)
Custom TCP (3000)
Launch the instance
🌐 Step 2: Allocate Elastic IP
Go to EC2 → Elastic IP → Allocate
Associate Elastic IP with your instance
✅ This gives your server a permanent IP address
🔐 Step 3: Connect to EC2 via SSH (Windows)
Open Git Bash or terminal
Go to .pem file location:
cd /Downloads
Set permission (Linux/macOS only):
chmod 400 my-webserver-kp.pem//your key pair name
Connect to EC2:
ssh -i "my-webserver-kp.pem" ubuntu@
Step 4: Setup Node.js & Git
Inside EC2 terminal:
sudo apt update
sudo apt install nodejs npm git -y
node -v
npm -v
📦 Step 5: Clone Your Project
git clone https://github.com//.git
cd
npm install
🚀 Step 6: Run Your App with PM2
Install PM2:
sudo npm install -g pm2
Run your server:
pm2 start index.js
pm2 reload all
pm2 status
🧪 Step 7: Visit Your App
Open browser and visit:
http://:3000
Congrats 🎉 You’ve got your app live on the internet!
Conclusion
You’ve just deployed a backend server to AWS EC2 without needing Docker, NGINX, or complex CI/CD. It’s raw, simple, and effective — perfect for learning and practice.
Next Steps:
Use NGINX to run on port 80/443 (for domain & SSL)
Add MongoDB with Atlas
Deploy frontend (React/Vite) using S3 or EC2 + NGINX