A step-by-step guide for deploying a Node.js application with MongoDB on AWS EC2, complete with domain setup and SSL configuration.
# Clone this repository
git clone https://github.com/yourusername/your-repo-name.git
# Navigate to the project directory
cd your-repo-name
# Copy the deployment scripts
cp scripts/* /your/deployment/location
- AWS Account with appropriate permissions
- Registered domain name (for production deployment)
- Node.js application ready for deployment
- Basic understanding of:
- Linux commands
- SSH
- AWS Services (EC2, Route 53)
# Connect to your instance
ssh -i "your-key.pem" ec2-user@your-ec2-instance
Key configurations:
- AMI: Amazon Linux or Ubuntu
- Security Groups: SSH (22), HTTP (80), HTTPS (443)
sudo apt update
sudo apt install mongodb
sudo service mongodb start
sudo apt install nodejs npm
npm install pm2 -g
Domain setup steps available in AWS console:
- Create hosted zone
- Update nameservers
- Create A record
Essential security configurations included:
- EC2 security groups
- MongoDB authentication
- SSL/TLS setup for secure protocols
- Domain configuration
Service | Purpose | Type |
---|---|---|
EC2 | Virtual Server | IaaS |
Route 53 | DNS Management | PaaS |
ACM | SSL Certificates | PaaS |
.
├── scripts/
│ ├── deploy.sh
│ ├── setup-mongodb.sh
│ └── setup-nodejs.sh
├── docs/
│ └── detailed-guide.md
└── README.md
-
Connection Timeout
- Check security group rules
- Verify instance is running
-
MongoDB Connection Failed
sudo systemctl status mongodb
-
Domain Not Resolving
- Allow 48 hours for DNS propagation
- Verify Route 53 settings
- AWS Documentation
- MongoDB Documentation
- Node.js Community
Made by Armaan Moledina
Project for Cloud Computing Course: Semester 5 Computer Engineering