π§ 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
Top comments (0)