The goal of this assignment is to deploy a MERN stack blog application using:
- Terraform to provision infrastructure
- Ansible to configure the backend server
- AWS S3 to host the frontend
- MongoDB Atlas for the database
-
Used Terraform to:
- Create EC2 instance for backend
- Create S3 bucket for frontend
- Create IAM credentials
-
Used Ansible to:
- Install Node.js and npm on EC2
- Install pm2
- Clone backend repo and install dependencies
- Start backend with pm2
-
MongoDB Atlas:
- Created free cluster
- Whitelisted EC2 IP
- Created database and user
- Connected to backend via .env
-
Frontend:
- Built frontend with
npm run build - Synced
dist/folder to S3 - Enabled static website hosting
- Built frontend with
-
Media Uploads:
- Used S3 bucket for storing images
- Integrated image upload in blog posts
- Terraform
- Ansible
- AWS EC2, S3, IAM
- MongoDB Atlas
- Node.js, React
- Ran
terraform destroyto remove resources - Removed IAM credentials
- PM2 showing backend running.png
- MongoDB cluster.png
- Media upload success.png
- S3 frontend in browser.png
- diagram architecture.png