Skip to content

MathisDulieu/taylor-shift-tour-site

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Taylor Shift's Ticket Shop Infrastructure

High-performance, scalable infrastructure for Taylor Shift's concert ticket sales using AWS ECS Fargate, RDS, and Terraform.

Prerequisites

  • 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.Httpd

Quick Start

cd taylor-shift-infrastructure/terraform/environments/dev

terraform init
terraform plan
terraform apply

terraform output application_url

Application will be available at the output URL in ~8 minutes.

Architecture Overview

Internet → CloudFront → ALB → ECS Fargate → RDS MySQL
                        ↓
                 Auto Scaling (1-10 tasks)

Core Components

  • 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

Project Structure

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

Environment Deployment

Using Automation Scripts (Recommended)

# 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 -Destroy

Manual Deployment

Development

cd terraform/environments/dev
terraform init && terraform apply
  • Resources: 1 ECS task, db.t3.micro
  • Cost: ~$35/month
  • Purpose: Development and testing

Staging

cd terraform/environments/staging
terraform init && terraform apply
  • Resources: 2 ECS tasks, db.t3.small
  • Cost: ~$85/month
  • Purpose: Pre-production validation

Production

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

Performance Testing

Automated Benchmarking

# 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"

Performance Testing Scenarios

# 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

Configuration

Scaling Configuration

Environment Min Tasks Max Tasks CPU Threshold Memory Threshold
Dev 1 2 80% 85%
Staging 1 4 75% 80%
Prod 2 10 70% 80%

Database Backup

  • Dev: 1 day retention
  • Staging: 3 days retention
  • Prod: 7 days retention + Multi-AZ

Security Best Practices

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)

Performance Benchmarks

Baseline Performance (Dev Environment)

  • 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

Scaling Recommendations

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

Management Commands

View Application Status

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} --follow

Manual Scaling

aws 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

About

Scalable infrastructure deployment for Taylor Shift's concert ticket shop using Terraform. High-performance e-commerce platform designed to handle massive traffic surges during ticket sales.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors