Cost Analysis
Purpose
Model infrastructure costs at current and projected scale, identify optimization opportunities, and establish cost monitoring with budget alerting. Produces a cost breakdown that enables informed architecture and scaling decisions.
Inputs
- Current infrastructure inventory (services, providers, tiers)
- Current usage metrics (requests/day, storage volume, compute hours)
- Growth projections or scaling targets
- Budget constraints or cost reduction goals
Process
Step 1: Inventory Infrastructure Components
Catalog all cost-bearing components:
- Compute: Application servers, serverless functions, background workers, build runners
- Storage: Object storage, block storage, database storage, backup storage
- Database: Managed database instances, read replicas, connection poolers
- CDN: Bandwidth, edge compute, cache storage
- Third-party services: Auth providers, email/SMS, payment processing, analytics, error tracking
- DNS and networking: Domain registration, DNS queries, load balancers, NAT gateways, data transfer
- Email: Transactional email, marketing email, inbound processing
Step 2: Estimate Per-Unit Costs at Current Scale
For each component, calculate:
- Monthly base cost: Fixed costs regardless of usage (reserved instances, minimum tiers)
- Variable cost: Per-request, per-GB, per-user marginal costs
- Cost per user: Total infrastructure cost divided by active users
- Cost per request: Total infrastructure cost divided by total requests
- Document pricing tier thresholds and current utilization against limits
Step 3: Model Cost Projections at Scale
Project costs at growth milestones:
- 2x scale: Which components scale linearly vs step-function? Where do tier upgrades hit?
- 5x scale: Which pricing tiers break? Where do volume discounts apply?
- 10x scale: What architectural changes become necessary? Which components become dominant costs?
- Identify cost cliffs — points where a small usage increase triggers a large cost jump
Step 4: Identify Optimization Opportunities
Evaluate cost reduction strategies:
- Right-sizing: Over-provisioned instances, unused reserved capacity, oversized database tiers
- Reserved/committed use: Savings from 1-year or 3-year commitments on stable workloads
- Spot/preemptible instances: Suitable workloads for interruptible compute (batch jobs, builds)
- Caching to reduce compute: CDN caching, application-level caching, database query caching
- Query optimization: Slow queries consuming excess database resources, missing indexes
- Architecture changes: Serverless for bursty workloads, edge compute for latency, static generation
Step 5: Design Cost Monitoring and Alerting
Establish ongoing cost visibility:
- Budget thresholds: Alert at 50%, 75%, 90%, 100% of monthly budget
- Anomaly detection: Unexpected cost spikes from runaway processes, misconfigured auto-scaling, or attacks
- Cost-per-user trending: Track unit economics over time to catch efficiency degradation
- Tag-based allocation: Cost attribution by service, team, environment, feature
- Review dashboard: Real-time cost breakdown accessible to engineering and leadership
Step 6: Plan Budget Allocation and Review Cadence
Define the financial process:
- Budget allocation: Per-service or per-team budget breakdown
- Review cadence: Monthly cost review meetings, quarterly budget adjustments
- Cost ownership: Which team owns which infrastructure costs
- Approval process: Threshold for new infrastructure spending requiring approval
- Cost-benefit framework: How to evaluate infrastructure investments against engineering time
Output Format
# Cost Analysis: [Project/Service Name]
## Infrastructure Cost Table
| Component | Provider | Tier | Monthly Cost | Cost Driver | Notes |
|-----------|----------|------|-------------|-------------|-------|
| App Server | [provider] | [tier] | $X | requests | ... |
| Database | [provider] | [tier] | $X | storage + queries | ... |
| CDN | [provider] | [tier] | $X | bandwidth | ... |
| **Total** | | | **$X** | | |
**Cost per user**: $X/month | **Cost per 1K requests**: $X
## Scaling Projections
| Component | Current | 2x | 5x | 10x |
|-----------|---------|-----|-----|------|
| Compute | $X | $X | $X | $X |
| Database | $X | $X | $X | $X |
| Storage | $X | $X | $X | $X |
| **Total** | **$X** | **$X** | **$X** | **$X** |
## Optimization Recommendations
| Optimization | Estimated Savings | Effort | Risk | Priority |
|-------------|-------------------|--------|------|----------|
| [description] | $X/month (Y%) | Low/Med/High | Low/Med/High | P1/P2/P3 |
## Budget Alert Thresholds
| Threshold | Monthly Amount | Action |
|-----------|---------------|--------|
| 50% | $X | Review dashboard |
| 75% | $X | Investigate anomalies |
| 90% | $X | Escalate to lead |
| 100% | $X | Freeze non-critical spending |
Quality Checks
Evolution Notes
1---2name: cost-analysis3department: "operator"4description: "Infrastructure cost modeling, scaling projections, and optimization recommendations"5version: 16triggers:7 - "cost"8 - "pricing"9 - "budget"10 - "compute"11 - "scaling"12 - "infrastructure cost"13 - "optimization"14 - "reserved instances"15---1617# Cost Analysis1819## Purpose2021Model infrastructure costs at current and projected scale, identify optimization opportunities, and establish cost monitoring with budget alerting. Produces a cost breakdown that enables informed architecture and scaling decisions.2223## Inputs2425- Current infrastructure inventory (services, providers, tiers)26- Current usage metrics (requests/day, storage volume, compute hours)27- Growth projections or scaling targets28- Budget constraints or cost reduction goals2930## Process3132### Step 1: Inventory Infrastructure Components3334Catalog all cost-bearing components:35- **Compute**: Application servers, serverless functions, background workers, build runners36- **Storage**: Object storage, block storage, database storage, backup storage37- **Database**: Managed database instances, read replicas, connection poolers38- **CDN**: Bandwidth, edge compute, cache storage39- **Third-party services**: Auth providers, email/SMS, payment processing, analytics, error tracking40- **DNS and networking**: Domain registration, DNS queries, load balancers, NAT gateways, data transfer41- **Email**: Transactional email, marketing email, inbound processing4243### Step 2: Estimate Per-Unit Costs at Current Scale4445For each component, calculate:46- **Monthly base cost**: Fixed costs regardless of usage (reserved instances, minimum tiers)47- **Variable cost**: Per-request, per-GB, per-user marginal costs48- **Cost per user**: Total infrastructure cost divided by active users49- **Cost per request**: Total infrastructure cost divided by total requests50- Document pricing tier thresholds and current utilization against limits5152### Step 3: Model Cost Projections at Scale5354Project costs at growth milestones:55- **2x scale**: Which components scale linearly vs step-function? Where do tier upgrades hit?56- **5x scale**: Which pricing tiers break? Where do volume discounts apply?57- **10x scale**: What architectural changes become necessary? Which components become dominant costs?58- Identify cost cliffs — points where a small usage increase triggers a large cost jump5960### Step 4: Identify Optimization Opportunities6162Evaluate cost reduction strategies:63- **Right-sizing**: Over-provisioned instances, unused reserved capacity, oversized database tiers64- **Reserved/committed use**: Savings from 1-year or 3-year commitments on stable workloads65- **Spot/preemptible instances**: Suitable workloads for interruptible compute (batch jobs, builds)66- **Caching to reduce compute**: CDN caching, application-level caching, database query caching67- **Query optimization**: Slow queries consuming excess database resources, missing indexes68- **Architecture changes**: Serverless for bursty workloads, edge compute for latency, static generation6970### Step 5: Design Cost Monitoring and Alerting7172Establish ongoing cost visibility:73- **Budget thresholds**: Alert at 50%, 75%, 90%, 100% of monthly budget74- **Anomaly detection**: Unexpected cost spikes from runaway processes, misconfigured auto-scaling, or attacks75- **Cost-per-user trending**: Track unit economics over time to catch efficiency degradation76- **Tag-based allocation**: Cost attribution by service, team, environment, feature77- **Review dashboard**: Real-time cost breakdown accessible to engineering and leadership7879### Step 6: Plan Budget Allocation and Review Cadence8081Define the financial process:82- **Budget allocation**: Per-service or per-team budget breakdown83- **Review cadence**: Monthly cost review meetings, quarterly budget adjustments84- **Cost ownership**: Which team owns which infrastructure costs85- **Approval process**: Threshold for new infrastructure spending requiring approval86- **Cost-benefit framework**: How to evaluate infrastructure investments against engineering time8788## Output Format8990```markdown91# Cost Analysis: [Project/Service Name]9293## Infrastructure Cost Table9495| Component | Provider | Tier | Monthly Cost | Cost Driver | Notes |96|-----------|----------|------|-------------|-------------|-------|97| App Server | [provider] | [tier] | $X | requests | ... |98| Database | [provider] | [tier] | $X | storage + queries | ... |99| CDN | [provider] | [tier] | $X | bandwidth | ... |100| **Total** | | | **$X** | | |101102**Cost per user**: $X/month | **Cost per 1K requests**: $X103104## Scaling Projections105106| Component | Current | 2x | 5x | 10x |107|-----------|---------|-----|-----|------|108| Compute | $X | $X | $X | $X |109| Database | $X | $X | $X | $X |110| Storage | $X | $X | $X | $X |111| **Total** | **$X** | **$X** | **$X** | **$X** |112113## Optimization Recommendations114115| Optimization | Estimated Savings | Effort | Risk | Priority |116|-------------|-------------------|--------|------|----------|117| [description] | $X/month (Y%) | Low/Med/High | Low/Med/High | P1/P2/P3 |118119## Budget Alert Thresholds120121| Threshold | Monthly Amount | Action |122|-----------|---------------|--------|123| 50% | $X | Review dashboard |124| 75% | $X | Investigate anomalies |125| 90% | $X | Escalate to lead |126| 100% | $X | Freeze non-critical spending |127```128129## Quality Checks130131- [ ] All cost-bearing infrastructure components are inventoried132- [ ] Per-unit costs (per user, per request) are calculated for current scale133- [ ] Scaling projections identify cost cliffs and tier boundaries134- [ ] Optimization recommendations include estimated savings and effort135- [ ] Cost monitoring covers budget alerts and anomaly detection136- [ ] Budget review cadence and cost ownership are defined137- [ ] Third-party service costs are included (not just cloud infrastructure)138- [ ] Cost projections account for both linear and step-function scaling139140## Evolution Notes141<!-- Observations appended after each use -->