Skip to content

Cost Model

HybridOps can treat cost as an operating signal alongside availability and readiness. A configured budget limit can block a recovery or burst action before additional spend is created.

Cost records

Managed actions can publish a cost record under:

<runtime-root>/logs/cost/<env>/<component>-<run_id>.json

The record carries the estimated spend associated with that run and the information needed to attribute it to an environment, component, and purpose.

Before a cost-controlled action proceeds, HybridOps evaluates the current estimate against the active environment policy and records the decision.

Decision Meaning
ALLOW The action is within the configured limit and may proceed.
DENY The projected spend exceeds the configured limit, so the action is blocked.
SIMULATE_ONLY Spend is not approved, so the action remains non-executing.

Attribution

Cost records use consistent attribution fields so estimates can be tied back to the execution that produced them.

Field Example values
cost:env dev, staging, prod
cost:owner hybridops-tech
cost:component ctrl01, rke2, netbox, edge
cost:run_id build number or UUID
cost:purpose dr-test, burst, baseline, deploy

Provider-specific tags or labels may carry the same attribution where the target supports them.

Policy configuration

Cost limits belong in environment policy rather than being hard-coded into an execution path.

policy:
  decision:
    prefer_cloud_with_credits: true
    cloud_priority: ["azure", "gcp", "onprem"]
    max_cost_per_hour_usd: 5

prefer_cloud_with_credits allows an environment to favour an eligible target with available credits. cloud_priority defines the preference order when more than one target is viable. max_cost_per_hour_usd is the configured hourly limit; the action is denied when projected spend exceeds it.

Cost record schema

{
  "run_id": "<RUN_ID>",
  "timestamp": "<ISO8601>",
  "env": "<ENV>",
  "owner": "<OWNER>",
  "component": "<COMPONENT>",
  "purpose": "<PURPOSE>",
  "estimated_monthly_cost_usd": 12.34,
  "currency": "USD",
  "details": {
    "compute": 8.50,
    "storage": 3.20,
    "network": 0.64
  },
  "source": "terraform-plan"
}

The source field identifies where the estimate came from. The value above is one implementation-specific example. Other execution paths may use another recorded source while keeping the same decision contract.

When a cost limit is exceeded

A DENY decision means the configured limit is working as intended. The cost threshold response runbook defines the operating response.

Typical choices are:

  1. Reduce scope: use a smaller footprint or defer optional capacity.
  2. Approve an exception: record the reason, obtain the required approval, and rerun through the documented override path.
  3. Postpone: defer the action until the budget or operating window changes.

The decision, chosen response, and any approval record should remain tied to the same run evidence.