# Scaling Infrastructure Guide

Scale infrastructure to meet growing demand.

## Vertical Scaling

Increase resources on existing instances:

```nickel
{
  servers = [
    {
      name = "app-01",
      instance_type = "t3.large",  # Original
      # Change to:
      # instance_type = "t3.2xlarge"  # Larger
    }
  ]
}
```

## Horizontal Scaling

Add more instances:

```nickel
{
  servers = [
    {
      name = "web",
      count = 3,  # Original
      # Change to:
      # count = 10  # More instances
      instance_type = "t3.large"
    }
  ]
}
```

## Auto-Scaling

Let infrastructure scale automatically:

```nickel
{
  auto_scaling = {
    enabled = true,
    min_instances = 2,
    max_instances = 20,
    target_cpu_utilization = 70,
    scale_up_cooldown = 60,
    scale_down_cooldown = 300
  }
}
```

## Database Scaling

### Vertical

```nickel
{
  database = {
    instance_class = "db.r6i.2xlarge"  # Larger instance
  }
}
```

### Horizontal (Read Replicas)

```nickel
{
  database = {
    primary = { instance_class = "db.r6i.2xlarge" },
    read_replicas = [
      { name = "replica-1" },
      { name = "replica-2" },
      { name = "replica-3" }
    ]
  }
}
```

## Related Documentation

- [Capacity Planning](../operations/capacity-planning.md)
- [Auto-Scaling](../examples/cost-optimization-examples.md)
- [Performance Tuning](../troubleshooting/performance-issues.md)
