How csye-6225-spring-2025/tf-aws-infra works
Project Type and Purpose
• This is an “Infrastructure as Code” (IaC) repository using Terraform to provision a full AWS environment for the Health Tracker web application.
• It’s focused on creating a scalable, secure, multi-tier cloud architecture with CI/CD integration via GitHub Actions.
File Structure
• Root Terraform files (main.tf, variables.tf, outputs.tf, versions.tf) define resources, variables, and outputs.
• GitHub Actions workflow (terraform.yml) under .github/workflows orchestrates CI/CD.
• No application code—this repo’s sole purpose is AWS infra provisioning.
README Insights
• The README outlines key AWS components: VPC (public/private subnets), NAT gateways, ALB, ASGs, RDS, S3 (remote state), CloudWatch, IAM roles, security groups, NACLs.
• Emphasizes modular Terraform design, remote state management, and Checkov security scans.
a. Networking Layer
• VPC spanning three Availability Zones
• Public Subnets (with Internet Gateway)
• Private Subnets (with NAT Gateways)
• Route Tables, NACLs
b. Compute & Load Balancing
• Application Load Balancer (HTTPS listener, path‐based routing) in public subnets
• Auto Scaling Groups of EC2 instances in private subnets
c. Security & IAM
• Security Groups for ALB and EC2 instances
• IAM Roles and Policies for EC2, Lambda, and CI/CD processes
• KMS-managed keys for EBS encryption
d. Storage & Databases
• RDS MySQL cluster (multi-AZ) in isolated subnets
• S3 bucket for Terraform remote state and application assets
e. Observability & Logging
• CloudWatch Logs and Metrics
• VPC Flow Logs
f. CI/CD Integration
• GitHub Actions runner (external service) invoking terraform plan/apply
• S3/DynamoDB backend for state locking
• Checkov security scan step
Relationships and Data Flows
• Internet → ALB → EC2 ASG → RDS
• EC2 ASG retrieves assets from S3 and emits logs to CloudWatch
• GitHub Actions pushes state to S3 and locks in DynamoDB
• NAT Gateways enable outbound internet from private subnet (for package updates)
• IAM policies enforce least-privilege access between components
Architectural Patterns & Design Principles
• Multi-tier (Web tier, App tier, Data tier)
• High availability across 3 AZs
• Immutable infrastructure (AMI-based EC2 launches)
Technologies & Frameworks
• Terraform v1.5+ (IaC orchestration)
• AWS Cloud services (VPC, EC2, ALB, RDS, S3, CloudWatch, IAM, KMS)
• GitHub Actions (CI/CD workflow)
• Checkov (IaC compliance scanner)