Skip to content

Terraform: AWS infrastructure for voting app with CloudWatch monitoring#485

Open
bspark23 wants to merge 2 commits intodockersamples:mainfrom
SCAGroup6:mbata-blessing-adaoma
Open

Terraform: AWS infrastructure for voting app with CloudWatch monitoring#485
bspark23 wants to merge 2 commits intodockersamples:mainfrom
SCAGroup6:mbata-blessing-adaoma

Conversation

@bspark23
Copy link
Copy Markdown

Overview

This PR adds complete Terraform infrastructure for deploying the voting app to AWS production.

Changes

  • VPC & Networking: VPC with public/private subnets across 2 AZs, Internet Gateway, NAT Gateway, and route tables
  • Security: Security groups for ALB, ECS tasks, RDS, and ElastiCache with proper ingress/egress rules
  • Load Balancing: Application Load Balancer with listeners for vote app (port 80) and result app (port 8080)
  • Container Orchestration: ECS Fargate cluster with task definitions and services for vote, result, and worker containers
  • Databases: RDS Postgres (replacing local db container) and ElastiCache Redis (replacing local redis container)
  • IAM: Task execution role and task role with appropriate permissions for CloudWatch logging
  • Monitoring: CloudWatch alarms for ECS CPU utilization and RDS connection counts
  • Logging: CloudWatch log group for container logs

Infrastructure Outputs

Testing

Infrastructure deployed and tested. Vote app is functional and accepting votes.

Files Added

  • terraform/main.tf
  • terraform/variables.tf
  • terraform/vpc.tf
  • terraform/security_groups.tf
  • terraform/alb.tf
  • terraform/ecs.tf
  • terraform/iam.tf
  • terraform/rds.tf
  • terraform/elasticache.tf
  • terraform/cloudwatch.tf
  • terraform/outputs.tf

AdaomaB added 2 commits April 24, 2026 09:31
- VPC with public/private subnets, IGW, NAT gateway
- Security groups for ALB, ECS tasks, RDS, ElastiCache
- Application Load Balancer with listeners for vote (80) and result (8080)
- ECS Fargate cluster with task definitions and services for vote, result, worker
- RDS Postgres replacing local db container
- ElastiCache Redis replacing local redis container
- IAM roles for ECS task execution and task permissions
- CloudWatch log groups for container logging
- Updated app source to read connection hostnames from env vars
- CPU utilization alarms for vote and result ECS services
- Database connection count alarm for RDS
- CPU utilization alarm for ElastiCache Redis
- All alarms configured with 2-minute evaluation period and appropriate thresholds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants