High-performance, scalable infrastructure for Taylor Shift's concert ticket sales using AWS ECS Fargate, RDS, and Terraform.
- AWS CLI configured with appropriate permissions
- Terraform >= 1.0
- PowerShell (Windows)
winget install Hashicorp.Terraform && winget install Amazon.AWSCLI && winget install Git.Git && winget install Apache.Httpdcd taylor-shift-infrastructure/terraform/environments/dev
terraform init
terraform plan
terraform apply
terraform output application_urlApplication will be available at the output URL in ~8 minutes.
Internet → CloudFront → ALB → ECS Fargate → RDS MySQL
↓
Auto Scaling (1-10 tasks)
- ECS Fargate: Serverless containers (PrestaShop)
- RDS MySQL: Multi-AZ database with automated backups
- Application Load Balancer: Traffic distribution across tasks
- Auto Scaling: CPU/Memory-based scaling (70%/80% thresholds)
- Secrets Manager: Secure database credentials
terraform/
├── modules/ # Reusable infrastructure components
│ ├── networking/ # VPC, subnets, NAT gateway
│ ├── database/ # RDS MySQL + Secrets Manager
│ ├── security/ # Security groups
│ ├── load-balancer/ # ALB + target groups
│ └── ecs/ # ECS cluster, service, auto scaling
├── environments/
│ ├── dev/ # Development (t3.micro, 1 task)
│ ├── staging/ # Testing (t3.small, 2 tasks)
│ └── prod/ # Production (t3.medium, 3+ tasks)
├── shared/ # Common variables and outputs
└── scripts/ # Automation and testing scripts
├── benchmark.ps1 # Load testing and performance analysis
└── deploy.ps1 # Automated deployment script
# Deploy any environment with automated script
.\scripts\deploy.ps1 dev
.\scripts\deploy.ps1 staging
.\scripts\deploy.ps1 prod
# Plan-only mode (no deployment)
.\scripts\deploy.ps1 staging -PlanOnly
# Destroy infrastructure
.\scripts\deploy.ps1 dev -Destroycd terraform/environments/dev
terraform init && terraform apply- Resources: 1 ECS task, db.t3.micro
- Cost: ~$35/month
- Purpose: Development and testing
cd terraform/environments/staging
terraform init && terraform apply- Resources: 2 ECS tasks, db.t3.small
- Cost: ~$85/month
- Purpose: Pre-production validation
cd terraform/environments/prod
terraform init && terraform apply- Resources: 3+ ECS tasks, db.t3.medium, Multi-AZ
- Cost: ~$265/month
- Purpose: Live concert ticket sales
# Basic load test
.\scripts\benchmark.ps1 -Url "http://your-app-url" -Concurrent 50 -Requests 1000
# Save results to file
.\scripts\benchmark.ps1 -Url "http://your-app-url" -Concurrent 100 -Requests 2000 -OutputFile "results.txt"
# Compare environments
.\scripts\benchmark.ps1 -Url "http://dev-url" -Concurrent 50 -Requests 1000 -OutputFile "dev_results.txt"
.\scripts\benchmark.ps1 -Url "http://staging-url" -Concurrent 50 -Requests 1000 -OutputFile "staging_results.txt"
.\scripts\benchmark.ps1 -Url "http://prod-url" -Concurrent 50 -Requests 1000 -OutputFile "prod_results.txt"# Light load testing
.\scripts\benchmark.ps1 -Url "http://your-app-url" -Concurrent 10 -Requests 100
# Medium load testing
.\scripts\benchmark.ps1 -Url "http://your-app-url" -Concurrent 50 -Requests 1000
# Heavy load testing
.\scripts\benchmark.ps1 -Url "http://your-app-url" -Concurrent 200 -Requests 5000| Environment | Min Tasks | Max Tasks | CPU Threshold | Memory Threshold |
|---|---|---|---|---|
| Dev | 1 | 2 | 80% | 85% |
| Staging | 1 | 4 | 75% | 80% |
| Prod | 2 | 10 | 70% | 80% |
- Dev: 1 day retention
- Staging: 3 days retention
- Prod: 7 days retention + Multi-AZ
Secrets Management
- Database credentials stored in AWS Secrets Manager
- No hardcoded secrets in code
- IAM roles with least privilege access
Network Security
- Private subnets for database and ECS tasks
- Security groups with minimal required access
- ALB in public subnets only
Infrastructure Security
- Deletion protection enabled for production
- Encrypted storage for RDS
- VPC flow logs (production)
- Light Load (10 concurrent): 1.6s avg response, 100% success
- Medium Load (50 concurrent): 6.0s avg response, 99.9% success
- Breaking Point: ~50+ concurrent users
| Expected Users | Recommended Config | Estimated Cost |
|---|---|---|
| 0-100 | Dev (1 task) | $35/month |
| 100-1,000 | Staging (2 tasks) | $85/month |
| 1,000-10,000 | Prod (5+ tasks) | $400+/month |
terraform output application_url
aws ecs describe-services --cluster taylor-shift-tickets-{env}-cluster --services taylor-shift-tickets-{env}-service
aws logs tail /ecs/taylor-shift-tickets-{env} --followaws ecs update-service --cluster taylor-shift-tickets-prod-cluster --service taylor-shift-tickets-prod-service --desired-count 5
aws ecs update-service --cluster taylor-shift-tickets-prod-cluster --service taylor-shift-tickets-prod-service --desired-count 2