How rudranarayan94/devsecops works
Project Type and Purpose
• This is a frontend-only (React) application paired with Infrastructure-as-Code (Terraform) to provision AWS resources and a fully automated DevSecOps CI/CD pipeline.
• Purpose: convert currency rates in the browser, deployed on an EC2 instance via CodePipeline/CodeBuild/CodeDeploy. Terraform provisions VPC, EC2, S3, IAM roles, pipeline, etc.
File Structure
• Top level:
• README.md – project overview and setup
• .gitignore
• Terraform/ – Terraform modules and configs
• Key IaC files: Terraform/main.tf (resources), variables.tf (inputs), backend.tf (remote state), output.tf (outputs).
• Pipeline config: buildspec.yml (CodeBuild), appspec.yml (CodeDeploy), scripts/install.sh.
Extract Architecture Details from README
• Networking: VPC, public subnet, IGW, Security Group (HTTP/SSH).
• Compute: single EC2 (Amazon Linux), IAM instance profile.
• Artifact store: S3 bucket for Terraform state & CodePipeline artifacts.
• CI/CD: CodePipeline (Source→Build→Deploy), CodeBuild (build React), CodeDeploy (deploy to EC2).
• Source: GitHub repo, GitHub PAT.
Main Components & Their Relationships
a. Developer & GitHub
• Developer pushes code (React + Terraform + configs) to GitHub repo.
b. Terraform IaC
• terraform init/plan/apply creates:
• VPC, Subnet, Internet Gateway
• Security Group
• EC2 instance + IAM Role
• S3 bucket for remote state & pipeline artifacts
• CodePipeline, CodeBuild, CodeDeploy roles and resources
c. CI/CD Pipeline (AWS)
• Source stage: reads from GitHub → stores source in S3.
• Build stage: CodeBuild pulls source, runs buildspec.yml → outputs artifacts to S3.
• Deploy stage: CodeDeploy pulls artifact, uses appspec.yml & scripts/install.sh → deploys to EC2.
d. React Frontend
• Served by nginx/apache on EC2 (user data installs CodeDeploy agent & web server).
• End users (browsers) access EC2 public IP over HTTP (port 80).
e. AWS Services
• S3: holds Terraform state (backend.tf) & CodePipeline artifacts.
• IAM: roles/policies for least-privilege access.
• EC2: hosts the built React static site.
• VPC components ensure networking.
Architectural Patterns & Principles
• Infrastructure as Code: declarative provisioning with Terraform.
• DevSecOps pipeline: automated security-aware build and deployment.
• Cloud-native services: leverage managed services (CodePipeline et al).
• Least privilege: IAM roles on EC2 and pipeline components.
• Separation of concerns: React code vs. IaC code vs. deployment scripts.