From f2d0d6e2f0b11b173761261377bfa4566abb0e98 Mon Sep 17 00:00:00 2001 From: ranju99-ranju Date: Sat, 28 Feb 2026 05:24:16 -0800 Subject: [PATCH 01/12] Add AWS provider and dev instance configuration --- infrastructure/aws/dev/main.tf | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 infrastructure/aws/dev/main.tf diff --git a/infrastructure/aws/dev/main.tf b/infrastructure/aws/dev/main.tf new file mode 100644 index 000000000..55cf90c23 --- /dev/null +++ b/infrastructure/aws/dev/main.tf @@ -0,0 +1,13 @@ +provider "aws" { + region = "ap-south-1" +} + +resource "aws_instance" "dev_instance" { + ami = "ami-12345678" + instance_type = "t2.micro" + + tags = { + Name = "dev-instance" + Environment = "dev" + } +} From 8b42ba536ae3467ce3b91f9723b6959bb3a6fbe5 Mon Sep 17 00:00:00 2001 From: ranju99-ranju Date: Sat, 28 Feb 2026 05:26:26 -0800 Subject: [PATCH 02/12] Add AWS staging instance configuration --- .../aws/dev/infrastructure/aws/staging/main.tf | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 infrastructure/aws/dev/infrastructure/aws/staging/main.tf diff --git a/infrastructure/aws/dev/infrastructure/aws/staging/main.tf b/infrastructure/aws/dev/infrastructure/aws/staging/main.tf new file mode 100644 index 000000000..9c654cc37 --- /dev/null +++ b/infrastructure/aws/dev/infrastructure/aws/staging/main.tf @@ -0,0 +1,13 @@ +provider "aws" { + region = "ap-south-1" +} + +resource "aws_instance" "staging_instance" { + ami = "ami-12345678" + instance_type = "t2.small" + + tags = { + Name = "staging-instance" + Environment = "staging" + } +} From f45d3c8627514e43d637206ffd559a415064df65 Mon Sep 17 00:00:00 2001 From: ranju99-ranju Date: Sat, 28 Feb 2026 05:27:59 -0800 Subject: [PATCH 03/12] Add AWS infrastructure configuration for production --- .../staging/infrastructure/aws/prod/main.tf | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/main.tf diff --git a/infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/main.tf b/infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/main.tf new file mode 100644 index 000000000..293fded5e --- /dev/null +++ b/infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/main.tf @@ -0,0 +1,27 @@ +provider "aws" { + region = "ap-south-1" +} + +resource "aws_launch_template" "prod_template" { + name_prefix = "prod-template" + image_id = "ami-12345678" + instance_type = "t2.micro" +} + +resource "aws_autoscaling_group" "prod_asg" { + desired_capacity = 2 + max_size = 4 + min_size = 2 + vpc_zone_identifier = ["subnet-123456"] + + launch_template { + id = aws_launch_template.prod_template.id + version = "$Latest" + } + + tag { + key = "Environment" + value = "prod" + propagate_at_launch = true + } +} From 3ced565207d212809224022407e320190a5c46f3 Mon Sep 17 00:00:00 2001 From: ranju99-ranju Date: Sat, 28 Feb 2026 05:29:14 -0800 Subject: [PATCH 04/12] Create main.tf for GCP dev environment Add Google Cloud provider and compute instance configuration. --- .../aws/prod/infrastructure/gcp/dev/main.tf | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/main.tf diff --git a/infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/main.tf b/infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/main.tf new file mode 100644 index 000000000..a7076a5d7 --- /dev/null +++ b/infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/main.tf @@ -0,0 +1,20 @@ +provider "google" { + region = "asia-south1" +} + +resource "google_compute_instance" "dev_vm" { + name = "dev-vm" + machine_type = "e2-micro" + zone = "asia-south1-a" + + boot_disk { + initialize_params { + image = "debian-cloud/debian-11" + } + } + + network_interface { + network = "default" + access_config {} + } +} From eada85ac46856f7e74a94e4d4f4c51d050df79bf Mon Sep 17 00:00:00 2001 From: ranju99-ranju Date: Sat, 28 Feb 2026 05:30:30 -0800 Subject: [PATCH 05/12] Add machine type to GCP main.tf configuration --- .../infrastructure/gcp/dev/infrastructure/gcp/staging/main.tf | 1 + 1 file changed, 1 insertion(+) create mode 100644 infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/infrastructure/gcp/staging/main.tf diff --git a/infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/infrastructure/gcp/staging/main.tf b/infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/infrastructure/gcp/staging/main.tf new file mode 100644 index 000000000..c4ed9559f --- /dev/null +++ b/infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/infrastructure/gcp/staging/main.tf @@ -0,0 +1 @@ +machine_type = "e2-small" From 98bb0f848393de5ce66258b10f07b22b7772d6ca Mon Sep 17 00:00:00 2001 From: ranju99-ranju Date: Sat, 28 Feb 2026 05:31:22 -0800 Subject: [PATCH 06/12] Add Google Compute Instance Group Manager resource --- .../gcp/staging/infrastructure/gcp/prod/main.tf | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/infrastructure/gcp/staging/infrastructure/gcp/prod/main.tf diff --git a/infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/infrastructure/gcp/staging/infrastructure/gcp/prod/main.tf b/infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/infrastructure/gcp/staging/infrastructure/gcp/prod/main.tf new file mode 100644 index 000000000..041e2a940 --- /dev/null +++ b/infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/infrastructure/gcp/staging/infrastructure/gcp/prod/main.tf @@ -0,0 +1,11 @@ +resource "google_compute_instance_group_manager" "prod_group" { + name = "prod-group" + base_instance_name = "prod-instance" + zone = "asia-south1-a" + + version { + instance_template = "prod-template" + } + + target_size = 2 +} From 72704aba999acfc83477dfdce8a1f3054578a071 Mon Sep 17 00:00:00 2001 From: ranju99-ranju Date: Sat, 28 Feb 2026 05:34:07 -0800 Subject: [PATCH 07/12] Revise README for multi-cloud infrastructure details Updated project overview and structure, added cloud selection details, and refined setup instructions for backend and frontend. --- README.md | 190 +++++++++++++++++++----------------------------------- 1 file changed, 68 insertions(+), 122 deletions(-) diff --git a/README.md b/README.md index e60c97d74..ed96aba1f 100644 --- a/README.md +++ b/README.md @@ -1,125 +1,71 @@ -# DevOps Assignment - -This project consists of a FastAPI backend and a Next.js frontend that communicates with the backend. - -## Project Structure - -``` -. -├── backend/ # FastAPI backend -│ ├── app/ -│ │ └── main.py # Main FastAPI application -│ └── requirements.txt # Python dependencies -└── frontend/ # Next.js frontend - ├── pages/ - │ └── index.js # Main page - ├── public/ # Static files - └── package.json # Node.js dependencies -``` - -## Prerequisites - -- Python 3.8+ -- Node.js 16+ -- npm or yarn - -## Backend Setup - -1. Navigate to the backend directory: - ```bash - cd backend - ``` - -2. Create a virtual environment (recommended): - ```bash - python -m venv venv - source venv/bin/activate # On Windows: .\venv\Scripts\activate - ``` - -3. Install dependencies: - ```bash - pip install -r requirements.txt - ``` - -4. Run the FastAPI server: - ```bash - uvicorn app.main:app --reload --port 8000 - ``` - - The backend will be available at `http://localhost:8000` - -## Frontend Setup - -1. Navigate to the frontend directory: - ```bash - cd frontend - ``` - -2. Install dependencies: - ```bash - npm install - # or - yarn - ``` - -3. Configure the backend URL (if different from default): - - Open `.env.local` - - Update `NEXT_PUBLIC_API_URL` with your backend URL - - Example: `NEXT_PUBLIC_API_URL=https://your-backend-url.com` - -4. Run the development server: - ```bash - npm run dev - # or - yarn dev - ``` - - The frontend will be available at `http://localhost:3000` - -## Changing the Backend URL - -To change the backend URL that the frontend connects to: - -1. Open the `.env.local` file in the frontend directory -2. Update the `NEXT_PUBLIC_API_URL` variable with your new backend URL -3. Save the file -4. Restart the Next.js development server for changes to take effect - -Example: -``` -NEXT_PUBLIC_API_URL=https://your-new-backend-url.com -``` - -## For deployment: - ```bash - npm run build - # or - yarn build - ``` - - AND - - ```bash - npm run start - # or - yarn start - ``` - - The frontend will be available at `http://localhost:3000` - -## Testing the Integration - -1. Ensure both backend and frontend servers are running -2. Open the frontend in your browser (default: http://localhost:3000) -3. If everything is working correctly, you should see: - - A status message indicating the backend is connected - - The message from the backend: "You've successfully integrated the backend!" - - The current backend URL being used +Multi-Cloud Infrastructure Design – DevOps Assignment -## API Endpoints +Overview -- `GET /api/health`: Health check endpoint - - Returns: `{"status": "healthy", "message": "Backend is running successfully"}` +This project demonstrates a structured multi-cloud infrastructure design across: + • Amazon Web Services (AWS) + • Google Cloud Platform (GCP) -- `GET /api/message`: Get the integration message - - Returns: `{"message": "You've successfully integrated the backend!"}` +The focus of this assignment is infrastructure thinking, scalability planning, and environment separation rather than application complexity. + +⸻ + +Cloud & Region Selection + +AWS +Region: ap-south-1 (Mumbai) +Reason: Low latency and cost efficiency. + +GCP +Region: asia-south1 +Reason: Geographic alignment and service availability. + +⸻ + +Environment Strategy + +Each cloud contains: + • Dev – Single small virtual machine + • Staging – Medium-sized virtual machine + • Production – Multiple instances with auto-scaling concept + +This ensures environment isolation and safe promotion of changes. + +⸻ + +Infrastructure as Code + +Terraform is used to define infrastructure resources. + +State Management Design: + • AWS: S3 backend with DynamoDB locking (design intention) + • GCP: Cloud Storage backend (design intention) + • Separate configuration per environment + +⸻ + +Scalability & Availability + +Production environments are designed to scale horizontally to handle traffic spikes. + +Instance failure handling: + • Auto-scaling replaces failed instances. + • Load balancer routes traffic only to healthy instances. + +⸻ + +Future Improvements + • Multi-region deployment + • CI/CD automation pipeline + • Kubernetes-based container orchestration + • Web Application Firewall integration + +⸻ + +What Was Intentionally Not Implemented + • Kubernetes (overkill for this simple application) + • Multi-region failover + • Blue-green deployments + • Advanced security hardening + +The focus was on foundational and scalable infrastructure design within time constraints. From b862943b791cd969bedaadf247685b7dbb4dbb8d Mon Sep 17 00:00:00 2001 From: ranju99-ranju Date: Sat, 28 Feb 2026 05:35:47 -0800 Subject: [PATCH 08/12] Update README to remove unimplemented features section Removed section on intentionally not implemented features. --- README.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/README.md b/README.md index ed96aba1f..0a1e1770f 100644 --- a/README.md +++ b/README.md @@ -60,12 +60,3 @@ Future Improvements • Kubernetes-based container orchestration • Web Application Firewall integration -⸻ - -What Was Intentionally Not Implemented - • Kubernetes (overkill for this simple application) - • Multi-region failover - • Blue-green deployments - • Advanced security hardening - -The focus was on foundational and scalable infrastructure design within time constraints. From 01ed3e4037a5771d1fe8a6f173139c4f1d081ef9 Mon Sep 17 00:00:00 2001 From: ranju99-ranju Date: Sat, 28 Feb 2026 05:49:06 -0800 Subject: [PATCH 09/12] Update README.md --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 0a1e1770f..949d42a39 100644 --- a/README.md +++ b/README.md @@ -59,4 +59,13 @@ Future Improvements • CI/CD automation pipeline • Kubernetes-based container orchestration • Web Application Firewall integration + +11. What Was Intentionally Not Implemented + • Kubernetes (overkill for this application) + • Multi-region failover + • CI/CD automation pipeline + • Web Application Firewall + +Reason: +Focused on foundational infrastructure clarity within assignment constraints. From 0e4b6a62731e23217169a4933cbdd19ff2b0cdbb Mon Sep 17 00:00:00 2001 From: ranju99-ranju Date: Sat, 28 Feb 2026 06:20:23 -0800 Subject: [PATCH 10/12] Updated AWS dev main.tf with EC2 configuration Updated infrastructure configuration to use AWS resources instead of GCP. Added AWS provider and instance resource. --- .../gcp/staging/infrastructure/gcp/prod/main.tf | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/infrastructure/gcp/staging/infrastructure/gcp/prod/main.tf b/infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/infrastructure/gcp/staging/infrastructure/gcp/prod/main.tf index 041e2a940..4dd82e8d8 100644 --- a/infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/infrastructure/gcp/staging/infrastructure/gcp/prod/main.tf +++ b/infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/infrastructure/gcp/staging/infrastructure/gcp/prod/main.tf @@ -1,11 +1,12 @@ -resource "google_compute_instance_group_manager" "prod_group" { - name = "prod-group" - base_instance_name = "prod-instance" - zone = "asia-south1-a" +provider "aws" { + region = "ap-south-1" +} - version { - instance_template = "prod-template" - } +resource "aws_instance" "dev_instance" { + ami = "ami-12345678" + instance_type = "t2.micro" - target_size = 2 + tags = { + Environment = "dev" + } } From b3b65622e9fc762756b001b0fee356c97aca1786 Mon Sep 17 00:00:00 2001 From: ranju99-ranju Date: Sat, 28 Feb 2026 06:31:40 -0800 Subject: [PATCH 11/12] Delete infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/infrastructure/gcp/staging/infrastructure/gcp/prod/main.tf --- .../gcp/staging/infrastructure/gcp/prod/main.tf | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/infrastructure/gcp/staging/infrastructure/gcp/prod/main.tf diff --git a/infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/infrastructure/gcp/staging/infrastructure/gcp/prod/main.tf b/infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/infrastructure/gcp/staging/infrastructure/gcp/prod/main.tf deleted file mode 100644 index 4dd82e8d8..000000000 --- a/infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/infrastructure/gcp/staging/infrastructure/gcp/prod/main.tf +++ /dev/null @@ -1,12 +0,0 @@ -provider "aws" { - region = "ap-south-1" -} - -resource "aws_instance" "dev_instance" { - ami = "ami-12345678" - instance_type = "t2.micro" - - tags = { - Environment = "dev" - } -} From 140ce664eb9deed5ef97ff005eeb44cbda14b992 Mon Sep 17 00:00:00 2001 From: ranju99-ranju Date: Sat, 28 Feb 2026 06:34:49 -0800 Subject: [PATCH 12/12] Delete infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/infrastructure/gcp/staging/main.tf --- .../infrastructure/gcp/dev/infrastructure/gcp/staging/main.tf | 1 - 1 file changed, 1 deletion(-) delete mode 100644 infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/infrastructure/gcp/staging/main.tf diff --git a/infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/infrastructure/gcp/staging/main.tf b/infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/infrastructure/gcp/staging/main.tf deleted file mode 100644 index c4ed9559f..000000000 --- a/infrastructure/aws/dev/infrastructure/aws/staging/infrastructure/aws/prod/infrastructure/gcp/dev/infrastructure/gcp/staging/main.tf +++ /dev/null @@ -1 +0,0 @@ -machine_type = "e2-small"