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.
Scope Constraints
Reads infrastructure inventories, pricing documentation, and usage metrics for cost analysis. Does not modify files, provision resources, or access billing APIs or financial systems directly.
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
Input Sanitization
No user-provided values are used in commands or file paths. All inputs are treated as read-only analysis targets.
Procedure
Progress Checklist
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
Compaction resilience: If context was lost during a long session, re-read the Inputs section to reconstruct what system is being analyzed, check the Progress Checklist for completed steps, then resume from the earliest incomplete step.
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 |
Handoff
- Hand off to deployment-plan if cost optimization requires changes to deployment strategy (e.g., switching from blue-green to rolling to reduce compute overhead).
- Hand off to observability-design if cost monitoring needs integration with existing alerting and dashboard infrastructure.
Quality Checks
Evolution Notes
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: cost-analysis3description: Use when modeling infrastructure costs, projecting scaling expenses, or identifying optimization opportunities across cloud providers and third-party services. Covers per-unit cost estimation, growth milestone projections, and budget alerting setup. Do not use for deployment strategy design (use deployment-plan) or monitoring architecture (use observability-design).4---56# Cost Analysis78## Purpose910Model 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.1112## Scope Constraints1314Reads infrastructure inventories, pricing documentation, and usage metrics for cost analysis. Does not modify files, provision resources, or access billing APIs or financial systems directly.1516## Inputs1718- Current infrastructure inventory (services, providers, tiers)19- Current usage metrics (requests/day, storage volume, compute hours)20- Growth projections or scaling targets21- Budget constraints or cost reduction goals2223## Input Sanitization2425No user-provided values are used in commands or file paths. All inputs are treated as read-only analysis targets.2627## Procedure2829### Progress Checklist30- [ ] Step 1: Inventory infrastructure components31- [ ] Step 2: Estimate per-unit costs at current scale32- [ ] Step 3: Model cost projections at scale33- [ ] Step 4: Identify optimization opportunities34- [ ] Step 5: Design cost monitoring and alerting35- [ ] Step 6: Plan budget allocation and review cadence3637### Step 1: Inventory Infrastructure Components3839Catalog all cost-bearing components:40- **Compute**: Application servers, serverless functions, background workers, build runners41- **Storage**: Object storage, block storage, database storage, backup storage42- **Database**: Managed database instances, read replicas, connection poolers43- **CDN**: Bandwidth, edge compute, cache storage44- **Third-party services**: Auth providers, email/SMS, payment processing, analytics, error tracking45- **DNS and networking**: Domain registration, DNS queries, load balancers, NAT gateways, data transfer46- **Email**: Transactional email, marketing email, inbound processing4748### Step 2: Estimate Per-Unit Costs at Current Scale4950For each component, calculate:51- **Monthly base cost**: Fixed costs regardless of usage (reserved instances, minimum tiers)52- **Variable cost**: Per-request, per-GB, per-user marginal costs53- **Cost per user**: Total infrastructure cost divided by active users54- **Cost per request**: Total infrastructure cost divided by total requests55- Document pricing tier thresholds and current utilization against limits5657### Step 3: Model Cost Projections at Scale5859Project costs at growth milestones:60- **2x scale**: Which components scale linearly vs step-function? Where do tier upgrades hit?61- **5x scale**: Which pricing tiers break? Where do volume discounts apply?62- **10x scale**: What architectural changes become necessary? Which components become dominant costs?63- Identify cost cliffs — points where a small usage increase triggers a large cost jump6465### Step 4: Identify Optimization Opportunities6667Evaluate cost reduction strategies:68- **Right-sizing**: Over-provisioned instances, unused reserved capacity, oversized database tiers69- **Reserved/committed use**: Savings from 1-year or 3-year commitments on stable workloads70- **Spot/preemptible instances**: Suitable workloads for interruptible compute (batch jobs, builds)71- **Caching to reduce compute**: CDN caching, application-level caching, database query caching72- **Query optimization**: Slow queries consuming excess database resources, missing indexes73- **Architecture changes**: Serverless for bursty workloads, edge compute for latency, static generation7475### Step 5: Design Cost Monitoring and Alerting7677Establish ongoing cost visibility:78- **Budget thresholds**: Alert at 50%, 75%, 90%, 100% of monthly budget79- **Anomaly detection**: Unexpected cost spikes from runaway processes, misconfigured auto-scaling, or attacks80- **Cost-per-user trending**: Track unit economics over time to catch efficiency degradation81- **Tag-based allocation**: Cost attribution by service, team, environment, feature82- **Review dashboard**: Real-time cost breakdown accessible to engineering and leadership8384### Step 6: Plan Budget Allocation and Review Cadence8586Define the financial process:87- **Budget allocation**: Per-service or per-team budget breakdown88- **Review cadence**: Monthly cost review meetings, quarterly budget adjustments89- **Cost ownership**: Which team owns which infrastructure costs90- **Approval process**: Threshold for new infrastructure spending requiring approval91- **Cost-benefit framework**: How to evaluate infrastructure investments against engineering time9293> **Compaction resilience**: If context was lost during a long session, re-read the Inputs section to reconstruct what system is being analyzed, check the Progress Checklist for completed steps, then resume from the earliest incomplete step.9495## Output Format9697```markdown98# Cost Analysis: [Project/Service Name]99100## Infrastructure Cost Table101102| Component | Provider | Tier | Monthly Cost | Cost Driver | Notes |103|-----------|----------|------|-------------|-------------|-------|104| App Server | [provider] | [tier] | $X | requests | ... |105| Database | [provider] | [tier] | $X | storage + queries | ... |106| CDN | [provider] | [tier] | $X | bandwidth | ... |107| **Total** | | | **$X** | | |108109**Cost per user**: $X/month | **Cost per 1K requests**: $X110111## Scaling Projections112113| Component | Current | 2x | 5x | 10x |114|-----------|---------|-----|-----|------|115| Compute | $X | $X | $X | $X |116| Database | $X | $X | $X | $X |117| Storage | $X | $X | $X | $X |118| **Total** | **$X** | **$X** | **$X** | **$X** |119120## Optimization Recommendations121122| Optimization | Estimated Savings | Effort | Risk | Priority |123|-------------|-------------------|--------|------|----------|124| [description] | $X/month (Y%) | Low/Med/High | Low/Med/High | P1/P2/P3 |125126## Budget Alert Thresholds127128| Threshold | Monthly Amount | Action |129|-----------|---------------|--------|130| 50% | $X | Review dashboard |131| 75% | $X | Investigate anomalies |132| 90% | $X | Escalate to lead |133| 100% | $X | Freeze non-critical spending |134```135136## Handoff137138- Hand off to deployment-plan if cost optimization requires changes to deployment strategy (e.g., switching from blue-green to rolling to reduce compute overhead).139- Hand off to observability-design if cost monitoring needs integration with existing alerting and dashboard infrastructure.140141## Quality Checks142143- [ ] All cost-bearing infrastructure components are inventoried144- [ ] Per-unit costs (per user, per request) are calculated for current scale145- [ ] Scaling projections identify cost cliffs and tier boundaries146- [ ] Optimization recommendations include estimated savings and effort147- [ ] Cost monitoring covers budget alerts and anomaly detection148- [ ] Budget review cadence and cost ownership are defined149- [ ] Third-party service costs are included (not just cloud infrastructure)150- [ ] Cost projections account for both linear and step-function scaling151152## Evolution Notes153<!-- Observations appended after each use -->154155---156> Converted and distributed by [TomeVault](https://tomevault.io/claim/dtsong) — claim your Tome and manage your conversions.157<!-- tomevault:4.0:skill_md:2026-04-13 -->