How traffic-tacos/traffic-tacos-infra-iac works
Project type and purpose
• This repository is an Infrastructure-as-Code (IaC) project written in Terraform. Its purpose is to provision and manage a AWS-based 3-tier, microservices-friendly environment for the “Traffic Tacos” system. It orchestrates network (VPC, subnets, IGW, NAT), compute (EKS, EC2), data (DynamoDB, ElastiCache, S3), messaging (SQS, EventBridge), observability (CloudWatch, Prometheus, Grafana), and edge services (Route53, ACM, CloudFront).
File structure
• Top-level Terraform entrypoints:
• main.tf, providers.tf, backend.tf, var.tf, outputs.tf
• A modules/ directory containing one folder per AWS service (vpc, ec2, eks, dynamodb, eventbridge, sqs, s3-static, cloudfront, route53, acm, elasticache, awsprometheus, awsgrafana, ecr, plus a placeholder rds).
• CI/CD and tooling: .github/workflows/terraform.yml, atlantis.yaml.
• Documentation under README.md and docs/.
README for additional insights
• Confirms a 3-tier architecture: Public tier (ALB, bastion), Private App tier (EKS, EC2), Private DB tier (RDS planned, DynamoDB, ElastiCache).
• Two core microservices: Ticket Service and Reservation Service, each using DynamoDB + EventBridge + SQS patterns.
• EKS cluster with multiple node groups, Karpenter autoscaling, Helm support.
• Static website on S3 + CloudFront, custom domain via Route53 + ACM.
a. Main components (group into four logical layers):
1. Edge & DNS layer
• Route53 Hosted Zone
• ACM Certificate
• CloudFront CDN (fronting S3 static website)
2. Network & Security layer
• VPC with three tiers (Public, Private-App, Private-DB)
• Internet Gateway (Public tier)
• NAT Gateway (Private tiers)
• Security Groups & IAM roles
3. Compute & Microservices layer
• EKS Cluster (3 node-groups: ondemand, mix, monitoring)
• EC2 Bastion Host (in Public tier)
• ECR repositories for each microservice (gateway-api, reservation-api, inventory-api, payment-sim-api, reservation-worker)
• Microservices deployed via Kubernetes (ALB Ingress Controller)
4. Data & Messaging layer
• DynamoDB tables (6 tables for Ticket + Reservation)
• EventBridge buses & rules (Ticket + Reservation)
• SQS queues + DLQs (payment-webhooks, reservation-events)
• ElastiCache Redis cluster
5. Observability & Monitoring layer
• AWS Managed Prometheus workspace
• AWS Managed Grafana workspace
• CloudWatch metrics & alarms
b. Relationships and interactions:
• Users (web/mobile) → DNS → CloudFront → S3 static content or ALB → EKS services.
• EKS services ↔ DynamoDB for persistence.
• Services emit domain events to EventBridge → routed to SQS DLQs or downstream services.
• Reservation TTL logic via DynamoDB & EventBridge scheduler.
• Payment and reservation events flow through SQS for reliable processing.
• EKS Karpenter monitors SQS for spot interruption signals.
• Monitoring: EKS metrics → Prometheus → Grafana dashboards.
c. Architectural patterns/design principles:
• 3-Tier network segmentation for security/isolation.
• Microservices pattern with event-driven communication (EventBridge + SQS).
• Immutable infra via Terraform modules (one module per service).
• GitOps/CI integration via Atlantis/GitHub workflows.
d. Key technologies/frameworks:
• Terraform modules
• AWS core services (VPC, EC2, EKS, DynamoDB, SQS, EventBridge, ElastiCache, S3, CloudFront, ACM, Route53)
• Kubernetes (EKS), Helm (planned)
• Karpenter for auto-scaling
• AWS Managed Prometheus & Grafana