> ## Documentation Index
> Fetch the complete documentation index at: https://docs.thoras.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Understanding Cost in Thoras

> How Thoras calculates savings and waste, what the numbers mean, and how to bring them closer to your actual bill.

Thoras shows you how much compute your workloads waste and how much you save
when it right-sizes them. Those figures start as estimates and can become exact
billed cost, depending on how much you connect. This guide walks through each
level, what it gives you and when to move up.

## What you see out of the box

With no extra configuration, Thoras estimates cost from a built-in static price
list. It discovers your nodes, matches each instance type to its on-demand
price, and averages across the cluster to get a cost-per-core-hour and
cost-per-GB-hour. When it recommends smaller requests for a workload, the
difference is your projected savings.

These estimates are directional. They answer "how much over-provisioned compute
could we reclaim?" rather than "how much will our AWS bill drop?" They do not
account for:

* Savings Plans or Reserved Instances
* Committed use discounts (GCP)
* Custom or negotiated pricing
* Spot price fluctuations (Thoras uses published average discounts)

A workload showing $100 in projected annual savings means Thoras identified $100
worth of over-provisioned compute at on-demand rates. If a Savings Plan already
covers that capacity, your bill may not drop by the full amount, because the
commitment remains.

For how the baseline calculation works in detail, including EKS Fargate pricing,
spot handling and mixed instance types, see
[Cost Estimates](https://docs.thoras.ai/guides/cost-estimates.md).

### Overriding the baseline

If you know your blended rate (for example, you pay an effective \$0.12/hour per
node after Savings Plans), you can override the average node cost in the
dashboard cluster settings. This brings estimates closer to your actual spend
without any AWS integration.

See
[Overriding Average Node Cost](https://docs.thoras.ai/guides/cost-estimates.md#overriding-average-node-cost).

## The fidelity ladder

Each level adds accuracy. Pick the one that matches how precise you need cost
reporting to be.

| Level | What it gives you | Setup effort | AWS cost |
| - | - | - | - |
| **Baseline estimates** (default) | Directional savings at on-demand rates | None | None |
| **Cost Explorer** | Cluster-level billed cost by day, reflecting your actual discount mix | IAM role + one Helm value | \~\$0.01/day per cluster |
| **CUR 2.0** | Pod-level billed cost per AIScaleTarget, from your invoice | IAM role + S3 access + CUR export | S3 storage only |
| **Cost alerts** | Slack notifications when spend crosses a threshold | Feature flag + Slack webhook | None beyond the source |

You can adopt them independently. CUR 2.0 does not require Cost Explorer, and
cost alerts work with estimated cost alone. That said, Cost Explorer is the
simplest step up from baseline, and CUR 2.0 gives the highest fidelity.

## Level 1: AWS Cost Explorer

Cost Explorer replaces the static price list with what AWS actually billed you.
The figures on the dashboard then match your invoice at the cluster level,
broken down by service and usage type for each day.

### What changes

* The cost graph shows billed cost instead of estimates.
* Savings Plans, Reserved Instances and negotiated rates are reflected in the
  cost graph, because the numbers come from your bill. Billing calibration
  applies to EC2 workloads; Fargate savings still use regional on-demand rates
  (see [Cost Estimates](https://docs.thoras.ai/guides/cost-estimates.md#idle-spend)).
* Collection runs nightly. The first run backfills 90 days; each run after that
  re-fetches the last 7 days to pick up AWS restatements.

### How it works

The Thoras worker calls the AWS Cost Explorer API with your cluster's cost
allocation tag as a filter. That tag tells AWS "show me only the spend for this
cluster." The worker stores each day's cost by service and usage type in its
local database.

#### Cost allocation tags

AWS automatically tags EKS resources with `aws:eks:cluster-name`, but Cost
Explorer ignores tags that have not been activated in the Billing console. If
the tag is not activated, queries succeed and return zero rows. Activation can
take up to 24 hours. This is the most commonly missed step.

#### How the worker gets AWS credentials

The worker needs an IAM role with one permission: `ce:GetCostAndUsage`. You bind
the role to the worker's service account (`thoras-worker`) with one of two
methods:

* **IRSA** (IAM Roles for Service Accounts): Requires an OIDC provider on your
  EKS cluster. You annotate the service account with the role ARN. The kubelet
  mounts token files into the pod, and the AWS SDK exchanges them for
  credentials automatically.
* **EKS Pod Identity**: Requires the Pod Identity Agent add-on. You create a pod
  identity association between the role and the service account. No annotation
  needed. Does not work on Fargate nodes.

Both methods end up the same inside the pod. The AWS SDK's default credential
chain picks up whichever is configured. The Thoras code does not distinguish
between them.

### Quick start

1. Create an IAM role with `ce:GetCostAndUsage` permission, trusted by your
   worker's service account.
2. Activate the `aws:eks:cluster-name` cost allocation tag in the Billing
   console.
3. Set the Helm values:

```yaml theme={null}
thorasWorker:
  # IRSA only: annotate the service account. Leave this out with Pod Identity.
  serviceAccount:
    annotations:
      eks.amazonaws.com/role-arn: arn:aws:iam::123456789012:role/thoras-cost-explorer
  enableCostAndUsageCollector: true
```

4. Run `helm upgrade`.

For the full setup, including Terraform examples, EKS Pod Identity instructions,
cross-account billing and troubleshooting, see
[AWS Cost Explorer](https://docs.thoras.ai/guides/aws-cost-explorer.md).

### Console mode

If your clusters report to a self-hosted
[Thoras console](https://docs.thoras.ai/guides/aws-cost-explorer.md#collect-through-your-console), the
console can call Cost Explorer for all of them with one AWS role. Each cluster's
worker sends its queries to the console instead of calling AWS directly. The
console scopes every query to that cluster's approved cost allocation tag and
account.

This means you create one IAM role on the console instead of one per cluster. On
each tenant cluster, the values are:

```yaml theme={null}
thorasWorker:
  enableCostAndUsageCollector: true
  costExplorerMode: console
```

No IAM role needed on the tenant cluster itself. See
[Collect through your console](https://docs.thoras.ai/guides/aws-cost-explorer.md#collect-through-your-console)
for the console-side setup.

## Level 2: AWS Cost and Usage Report (CUR 2.0)

Cost Explorer shows what your cluster cost. CUR 2.0 shows what each
AIScaleTarget's pods cost, because AWS splits each node's cost between the pods
that ran on it.

### What changes

* A **Billed cost** tab appears on the dashboard, showing cost per
  AIScaleTarget, per namespace, by day or hour.
* Cost comes directly from your AWS invoice, split to the pod level.
* [Cost alerts](https://docs.thoras.ai/guides/cost-alerts.md) with a scope use this data for the highest
  accuracy.

### How it works

AWS delivers a CUR 2.0 Data Export as Parquet files in an S3 bucket. With
[split cost allocation data](https://docs.aws.amazon.com/cur/latest/userguide/enabling-split-cost-allocation-data.html)
enabled for EKS, each row that represents a pod carries tags identifying its
namespace, workload type and workload name. The Thoras worker reads these files,
filters for rows belonging to your cluster, and matches each pod's cost to its
AIScaleTarget.

The worker reads the report every 6 hours and stores up to 14 months of history.

> [!NOTE]
>
> CUR data always includes tags regardless of whether the cost allocation tag is
> activated in the Billing console. Activation matters for Cost Explorer, not
> for CUR.

### Prerequisites

In your AWS management (payer) account:

1. Turn on split cost allocation data for Amazon EKS.
2. Create a CUR 2.0 Data Export with: resource IDs, split cost allocation data,
   hourly granularity, Parquet format and "overwrite existing" versioning.
3. Note the S3 bucket, path prefix and export name.

The worker needs `s3:ListBucket` on the bucket and `s3:GetObject` on the export
path. If the export is in a different account (usually the payer account), you
either add a bucket policy or set `curRoleArn` so the worker assumes a role in
that account.

### Quick start

```yaml theme={null}
thorasWorker:
  enableCurIngestion: true
  curBucket: my-cur-bucket
  curPrefix: my-prefix # leave empty if at the bucket root
  curExportName: my-export
  # Only when reading through a role in another account:
  # curRoleArn: arn:aws:iam::999988887777:role/cur-reader

thorasDashboard:
  extras:
    billed_cost: true
```

Run `helm upgrade`. The worker reads the report on startup.

For the full setup, including cross-account access patterns, network policy
configuration and troubleshooting, see
[AWS Cost and Usage Report](https://docs.thoras.ai/guides/aws-cost-and-usage-report.md).

> [!NOTE]
>
> Requires chart version `5.12.0` (platform `4.132.0`).

## Cost alerts

Cost alerts send a Slack message when a day's, week's or month's cost crosses a
threshold you set. They work with any cost source:

| Source | What it covers | Requires |
| - | - | - |
| Estimated | Managed workloads, priced from node pricing | Nothing extra |
| Billed (whole cluster) | The cluster's AWS bill | Cost Explorer collection |
| Billed (scoped) | What AWS billed specific namespaces or workloads | CUR 2.0 |

### Quick start

```yaml theme={null}
featureFlags:
  enableCostAlerts: true

slackWebhookUrl: https://hooks.slack.com/services/T000/B000/XXXX
```

Run `helm upgrade`, then create rules on the dashboard's **Alerts** tab.

For rule configuration, alert timing, the Slack message format and
troubleshooting, see [Cost Alerts](https://docs.thoras.ai/guides/cost-alerts.md).

> [!NOTE]
>
> Requires chart version `5.8.2` (platform `4.129.1`).

## Choosing a level

**Start with the baseline.** It works out of the box and gives you a sense of
where your workloads are over-provisioned. If you need a quick correction, the
average node cost override gets you closer without any AWS integration.

**Add Cost Explorer when you want the dashboard to reflect your actual bill.**
The setup is an IAM role and one Helm value. If you run multiple clusters with a
console, console mode centralizes it to one role.

**Add CUR 2.0 when you need per-workload cost attribution.** This is the highest
fidelity: each AIScaleTarget's billed cost, straight from your invoice. It takes
more setup (a CUR export, S3 permissions) but answers "what did this workload
actually cost?" rather than "what did this cluster cost?"

**Add cost alerts when you want proactive notification.** They layer on top of
whichever cost source you have. Estimated alerts need nothing extra; billed
alerts need Cost Explorer or CUR.

## Frequently asked questions

### Do the savings numbers account for Savings Plans?

Not by default. Baseline estimates use on-demand rates and do not know about
your commitments. With Cost Explorer enabled, billing calibration adjusts the
gap between current and recommended cost to reflect what you actually pay. This
applies to EC2 workloads; Fargate savings use regional on-demand rates even with
Cost Explorer, because Compute Savings Plans applied to Fargate are not included
in the calibration (see [Cost Estimates](https://docs.thoras.ai/guides/cost-estimates.md#idle-spend)).
CUR 2.0 goes further and shows each pod's share of the discounted node cost.

### Will my AWS bill drop by the savings amount shown?

The savings figure is the value of the compute capacity you would free up. If
that capacity is covered by a Savings Plan or Reserved Instance, the commitment
remains and your bill may not decrease by the full amount. The freed capacity
can be reallocated to other workloads or avoided on future provisioning.

### What does Thoras collect from AWS?

Cost Explorer collection stores one row per day, per service, per usage type:
billed cost, effective cost (amortized after commitments), and usage quantity.
CUR ingestion stores each workload's billed cost by hour and by day. Both stay
in your cluster's database. With cloud sync on, daily and hourly cost summaries
are forwarded to the console; per-service rows and per-workload CUR data stay in
the cluster.

### What does this cost on the AWS side?

Cost Explorer charges per API request, roughly \$0.01 per paginated request. A
nightly run costs a handful of requests; the 90-day backfill on first run is
larger but one-time. CUR ingestion reads from S3, so you pay only for S3 storage
and GET requests.

### Can I use CUR 2.0 without Cost Explorer?

Yes. CUR gives you per-workload billed cost independently. Cost Explorer gives
you cluster-level billed cost on the main cost graph. They complement each other
but neither requires the other.

### Does this work outside AWS?

The baseline estimates work on any cloud. Cost Explorer and CUR are
AWS-specific. GCP and Azure equivalents are not available today.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.