# ⚡ Quick Start Guide

This guide gets you up and running in the fastest way possible.

## 🎯 For Complete Beginners (30 minutes)

### 1. Create Accounts (5 minutes)
- [GitHub](https://github.com) - Free account
- [AWS](https://aws.amazon.com) - Free tier account (credit card required)

### 2. Upload Code (5 minutes)
- Download this project as ZIP
- Create new GitHub repository: `malware-website-crawler`
- Upload all files to GitHub

### 3. Set Up AWS (10 minutes)
- Create IAM user: `malware-crawler-deploy`
- Attach these policies:
  - `AmazonECS_FullAccess`
  - `AmazonRDS_FullAccess`
  - `AmazonElastiCacheFullAccess`
  - `AmazonS3FullAccess`
  - `AmazonVPCFullAccess`
  - `IAMFullAccess`
  - `CloudWatchLogsFullAccess`
  - `AmazonEC2ContainerRegistryFullAccess`
  - `ElasticLoadBalancingFullAccess`
- Download access keys CSV

### 4. Configure GitHub (5 minutes)
- Go to repository Settings → Secrets → Actions
- Add secrets:
  - `AWS_ACCESS_KEY_ID` (from CSV)
  - `AWS_SECRET_ACCESS_KEY` (from CSV)

### 5. Deploy (5 minutes)
- Create `terraform/terraform.tfvars`:
  ```hcl
  aws_region = "us-east-1"
  environment = "prod"
  allowed_ips = ["0.0.0.0/0"]
  ```
- Go to Actions tab → Run workflow
- Wait 10-15 minutes

### 6. Access Application
- Go to AWS Console → ECS → Clusters → malware-crawler-cluster
- Copy Load Balancer DNS name
- Open in browser

## 🚀 For Experienced Users (10 minutes)

### Prerequisites
- AWS CLI configured
- GitHub account
- Terraform installed

### Quick Deploy
```bash
# Clone repository
git clone <your-repo-url>
cd malware-website-crawler

# Configure AWS credentials
aws configure

# Set up GitHub secrets (via web interface)
# Add: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY

# Create terraform.tfvars
cat > terraform/terraform.tfvars << EOF
aws_region = "us-east-1"
environment = "prod"
allowed_ips = ["$(curl -s ifconfig.me)/32"]
EOF

# Deploy via GitHub Actions
git add terraform/terraform.tfvars
git commit -m "Add terraform configuration"
git push origin main

# Monitor deployment in GitHub Actions tab
```

## 🔧 For Developers (5 minutes)

### Local Development
```bash
# Clone and setup
git clone <your-repo-url>
cd malware-website-crawler

# Create environment file
cp env.example .env
# Edit .env with your settings

# Start local services
docker-compose up -d

# Load malware database
python scripts/load_known_malware.py

# Run application
python app.py
```

## 🎛️ Common Configurations

### Minimal Cost Setup
```hcl
# terraform/terraform.tfvars
aws_region = "us-east-1"
environment = "prod"
allowed_ips = ["YOUR_IP/32"]
db_instance_class = "db.t3.micro"
fargate_cpu = 256
fargate_memory = 512
min_capacity = 0  # Scale to zero when not in use
max_capacity = 1
```

### High Performance Setup
```hcl
# terraform/terraform.tfvars
aws_region = "us-east-1"
environment = "prod"
allowed_ips = ["YOUR_IP/32"]
db_instance_class = "db.t3.small"
fargate_cpu = 1024
fargate_memory = 2048
min_capacity = 2
max_capacity = 10
```

### Development Setup
```hcl
# terraform/terraform.tfvars
aws_region = "us-east-1"
environment = "dev"
allowed_ips = ["0.0.0.0/0"]  # Open for development
db_instance_class = "db.t3.micro"
fargate_cpu = 256
fargate_memory = 512
min_capacity = 0
max_capacity = 1
```

## 🚨 Emergency Procedures

### Stop All Services (Immediate Cost Reduction)
```bash
# Via AWS Console
# ECS → Clusters → malware-crawler-cluster → Services → Update service → Desired count: 0

# Via AWS CLI
aws ecs update-service --cluster malware-crawler-cluster --service malware-crawler-service --desired-count 0
```

### Complete Teardown
```bash
# Via Terraform
cd terraform
terraform destroy -auto-approve

# Via Scripts
./scripts/teardown.sh
```

### Emergency Teardown (Force Delete Everything)
```bash
./scripts/emergency-teardown.sh
# Type 'EMERGENCY' to confirm
```

## 📊 Cost Monitoring

### Check Current Costs
```bash
./scripts/cost-monitor.sh
```

### Set Up Billing Alerts
```bash
aws cloudwatch put-metric-alarm \
  --alarm-name "High-AWS-Cost" \
  --alarm-description "Alert when AWS costs exceed threshold" \
  --metric-name EstimatedCharges \
  --namespace AWS/Billing \
  --statistic Maximum \
  --period 86400 \
  --threshold 100 \
  --comparison-operator GreaterThanThreshold
```

## 🔍 Troubleshooting

### Application Won't Start
1. Check ECS service status in AWS Console
2. Review CloudWatch logs: `/ecs/malware-crawler-app`
3. Verify security group allows your IP
4. Check database and Redis connectivity

### High Costs
1. Run cost monitoring script
2. Stop ECS services when not in use
3. Use selective teardown to remove unused resources
4. Set up billing alerts

### Deployment Fails
1. Check GitHub Actions logs
2. Verify all secrets are configured
3. Ensure AWS access keys have correct permissions
4. Check Terraform configuration

## 📞 Quick Help

| Problem | Solution |
|---------|----------|
| Can't access app | Wait 5-10 minutes, check ECS service status |
| High costs | Stop ECS services, use teardown scripts |
| Deployment fails | Check GitHub secrets, AWS permissions |
| App is slow | Check CloudWatch logs, increase ECS resources |
| Need to update | Push code changes to GitHub main branch |

## 🎯 Next Steps

After successful deployment:

1. **Test the application** with a sample website
2. **Set up security** by restricting access to your IP
3. **Monitor costs** using the cost monitoring script
4. **Set up billing alerts** to avoid unexpected charges
5. **Bookmark your application URL** for easy access

---

**Need more help?** Check the full [README.md](README.md) for detailed instructions or the [SETUP_CHECKLIST.md](SETUP_CHECKLIST.md) for a step-by-step checklist.
