reserved instance
**Reserved Instances and Savings Plans**
**Cost Optimization Options**
| Option | Commitment | Savings | Flexibility |
|--------|------------|---------|-------------|
| On-Demand | None | 0% | Full |
| Spot | None | 60-90% | Low (interruptions) |
| Reserved | 1-3 years | 30-72% | Low |
| Savings Plans | 1-3 years | 30-72% | Medium |
**Reserved Instances**
Commit to specific instance type in specific region:
```
p3.2xlarge in us-east-1
- On-demand: $3.06/hr = $26,825/year
- 1-year RI: $19,929/year (26% savings)
- 3-year RI: $12,964/year (52% savings)
```
**Savings Plans**
More flexible commitment to compute spend:
**Compute Savings Plans**
Works across:
- All instance types
- All regions
- EC2, Fargate, Lambda
**EC2 Instance Savings Plans**
Works across:
- All sizes within instance family
- All AZs in region
```bash
# Example commitment
# Commit to $10/hr spend
# Covers any mix of instances up to that amount
```
**ML Workload Strategy**
| Workload | Strategy |
|----------|----------|
| Always-on inference | Reserved/Savings Plan |
| Variable inference | On-demand + Spot |
| Training | Spot with checkpoints |
| Development | Spot |
**Calculating Requirements**
```python
# Estimate steady-state compute
baseline_gpus = 8 # Always running
peak_gpus = 24 # During training
# Cover baseline with Savings Plan
# Cover peak with Spot + On-demand
# Baseline cost with g4dn.xlarge
baseline_hourly = 8 * 0.526 # $4.21/hr
baseline_yearly = baseline_hourly * 24 * 365 # $36,900
# With 3-year Savings Plan (52% savings)
savings_plan_cost = baseline_yearly * 0.48 # $17,712/year
```
**Best Practices**
- Analyze usage patterns before committing
- Start with 1-year commitment
- Use Savings Plans for flexibility
- Combine with Spot for variable workloads
- Review and adjust annually
- Use AWS Cost Explorer / GCP Recommender