Cost Estimation

Scalable provides static-table-based cost estimation for cloud providers, helping users understand the financial impact of their deployment plans before execution.

Overview

The scalable.costing module defines:

  • CostEstimate — provider-neutral cost estimate

  • CostLineItem — itemized cost breakdown

Providers implement the optional estimate_cost() method:

  • AWS — estimates from static on-demand pricing tables

  • GCP — estimates from static on-demand pricing tables

  • Kubernetes — returns None (on-prem k8s has no direct cost)

  • Local/Slurm — returns None (no monetary cost)

Usage

Via CLI (dry-run mode):

scalable run scalable.yaml --target aws --dry-run

This prints the cost estimate and includes it in the plan output.

Programmatic access:

from scalable.providers.registry import get_provider
from scalable.providers.base import DeploymentSpec, ScalePlan

provider = get_provider("aws")
estimate = provider.estimate_cost(spec, plan)
if estimate:
    print(f"${estimate.total_hourly:.4f}/hr")
    print(f"${estimate.total_monthly:.2f}/mo")

Telemetry Integration

When a cost estimate is produced during a run, it is recorded as a CostEvent in the telemetry store (cost.jsonl). The scalable report command includes cost summary data:

cost:
  hourly_usd: 0.384
  monthly_usd: 280.32

Cost Tables

Static cost tables cover common AWS and GCP instance types across major regions. These are representative on-demand Linux pricing as of 2024.

Supported AWS instances: m5.*, c5.*, r5.*, t3.*

Supported GCP machines: n1-standard-*, n1-highmem-*, n1-highcpu-*, e2-standard-*

Future Work

Future releases may extend cost estimation with:

  • Live pricing API integration

  • Spot/preemptible instance pricing

  • Cost-aware scheduling recommendations via ML Optimization

  • Historical cost tracking and budgets

See Also