# Cost estimates

This page covers infrastructure and per-workflow costs for Pennsieve compute nodes.

> 📘 Compute nodes run in your own AWS account — all infrastructure and usage costs are billed directly by AWS, not by Pennsieve. The estimates below are based on AWS us-east-1 pricing at time of writing and may change. Refer to the [AWS Pricing](https://aws.amazon.com/pricing/) page for current rates.

***

## Infrastructure Cost (Idle)

When no workflows are running, you pay only for always-on resources:

| Mode          | Idle Cost/Month | With LLM |
| ------------- | --------------- | -------- |
| **Basic**     | \~$2-4          | \~$2-4   |
| **Secure**    | \~$49-53        | \~$49-53 |
| **Compliant** | \~$40-43        | \~$62-65 |

### What you're paying for

| Resource             | Basic   | Secure   | Compliant |
| -------------------- | ------- | -------- | --------- |
| EFS mount targets    | \~$0.30 | \~$0.30  | \~$0.30   |
| Secrets Manager      | \~$0.40 | \~$0.40  | \~$0.40   |
| KMS keys             | —       | \~$2.00  | \~$2.00   |
| NAT Gateway          | —       | \~$45.00 | —         |
| VPC Endpoints (base) | —       | —        | \~$36.00  |
| VPC Endpoints (LLM)  | —       | —        | \~$22.00  |
| VPC Flow Logs        | —       | \~$1-3   | \~$1-3    |

Lambda functions, ECS tasks, Step Functions, DynamoDB, and CloudWatch all have zero cost when idle. LLM resources (Governor Lambda, usage table, SSM parameters) also have zero idle cost — the only LLM-specific infrastructure cost is the additional VPC endpoints in compliant mode.

### Cost optimization

**Shared NAT Gateway** — Multiple compute nodes in the same AWS account can share a single NAT Gateway in secure mode. With 10 nodes sharing one NAT, the per-node cost drops from $45 to $4.50 — a 90% reduction.

***

## Per-Workflow Execution Cost

Each workflow incurs small pay-per-use charges. The finalizer calculates a cost estimate automatically after every execution.

| Component            | Rate                                                     |
| -------------------- | -------------------------------------------------------- |
| ECS Fargate (vCPU)   | $0.04048/vCPU-hour                                       |
| ECS Fargate (memory) | $0.004445/GB-hour                                        |
| Lambda invocations   | $0.20 per 1M requests                                    |
| Lambda compute       | $0.0000166667/GB-second                                  |
| Step Functions       | $0.000025/transition                                     |
| CloudWatch Logs      | $0.50/GB ingested                                        |
| EFS storage          | $0.30/GB-month (pro-rated, bursting throughput included) |

### Example: simple 2-processor workflow

Two sequential processors, each running 60 seconds on the default 0.5 vCPU / 1 GB configuration, processing 100 MB of input data:

| Component                           | Cost         |
| ----------------------------------- | ------------ |
| ECS Fargate (2 tasks, 60s each)     | \~$0.0019    |
| Lambda (7 invocations, \~37.5 GB-s) | \~$0.0006    |
| Step Functions (\~9 transitions)    | \~$0.0002    |
| CloudWatch Logs (\~110 KB)          | \~$0.0001    |
| EFS storage (100 MB for \~2 min)    | \~$0.0000    |
| **Total**                           | **\~$0.003** |

At 1,000 workflows per month with this profile, execution costs are roughly **$3/month** on top of the infrastructure base.

### Example: 3-processor pipeline (30 minutes each)

Three sequential ECS processors, each running 30 minutes on 2 vCPU / 8 GB configuration, processing 5 GB of input data:

| Component                       | Calculation                      | Cost        |
| ------------------------------- | -------------------------------- | ----------- |
| ECS Fargate vCPU                | 3 × 0.5 hr × 2 vCPU × $0.04048   | \~$0.121    |
| ECS Fargate memory              | 3 × 0.5 hr × 8 GB × $0.004445    | \~$0.053    |
| Lambda (orchestration)          | \~10 invocations × \~5s × 512 MB | \~$0.001    |
| Step Functions                  | \~15 transitions × $0.000025     | \~$0.0004   |
| CloudWatch Logs (\~500 KB)      | 0.0005 GB × $0.50                | \~$0.0003   |
| EFS storage (5 GB for \~1.5 hr) | 5 GB × $0.30/mo × (1.5 / 730)    | \~$0.003    |
| **Total**                       |                                  | **\~$0.18** |

Fargate compute dominates the per-workflow cost. At 100 workflows per month, execution costs are roughly **$18/month**.

### Example: large analysis pipeline with LLM (5 hours each)

Three sequential ECS processors on 4 vCPU / 30 GB configuration, each running 5 hours, processing 100 GB of input data. One processor calls Claude Sonnet for document analysis (\~500K input tokens, \~100K output tokens).

| Component                        | Calculation                      | Cost        |
| -------------------------------- | -------------------------------- | ----------- |
| ECS Fargate vCPU                 | 3 × 5 hr × 4 vCPU × $0.04048     | \~$2.43     |
| ECS Fargate memory               | 3 × 5 hr × 30 GB × $0.004445     | \~$2.00     |
| Lambda (orchestration)           | \~10 invocations × \~5s × 512 MB | \~$0.001    |
| Step Functions                   | \~15 transitions × $0.000025     | \~$0.0004   |
| CloudWatch Logs (\~15 MB)        | 0.015 GB × $0.50                 | \~$0.008    |
| EFS storage (100 GB for \~15 hr) | 100 GB × $0.30/mo × (15 / 730)   | \~$0.62     |
| LLM input (Sonnet)               | 500K tokens × $3.00/1M           | \~$1.50     |
| LLM output (Sonnet)              | 100K tokens × $15.00/1M          | \~$1.50     |
| **Total**                        |                                  | **\~$8.06** |

Fargate compute and LLM usage split the cost roughly evenly. Without LLM, the same workflow would cost \~$5.06. At 10 workflows per month, total execution costs are roughly **$81/month**.

***

## LLM / Bedrock Usage Cost

When LLM access is enabled, Bedrock usage is metered and subject to a configurable budget.

### Per-model pricing

| Model             | Input (per 1M tokens) | Output (per 1M tokens) | Best for                                   |
| ----------------- | --------------------- | ---------------------- | ------------------------------------------ |
| Claude Haiku 4.5  | $0.80                 | $4.00                  | Classification, extraction, simple Q\&A    |
| Claude Sonnet 4.6 | $3.00                 | $15.00                 | Analysis, summarization, complex reasoning |

> 1 million tokens is roughly 750,000 words or \~3,000 pages of text.

### Example workflows

**1. Metadata extraction from clinical notes (Haiku)**

Extract structured fields (diagnosis codes, medications, dates) from 500 clinical notes averaging 2 pages each.

| Step                                       | Tokens  | Cost      |
| ------------------------------------------ | ------- | --------- |
| Input: 500 notes x \~1,500 tokens each     | 750,000 | $0.60     |
| Output: structured JSON, \~200 tokens each | 100,000 | $0.40     |
| **Total**                                  |         | **$1.00** |

**2. Document summarization pipeline (Sonnet)**

Summarize 50 research papers averaging 15 pages each.

| Step                                      | Tokens  | Cost      |
| ----------------------------------------- | ------- | --------- |
| Input: 50 papers x \~11,000 tokens each   | 550,000 | $1.65     |
| Output: 1-page summary, \~750 tokens each | 37,500  | $0.56     |
| **Total**                                 |         | **$2.21** |

**3. Image analysis (Haiku)**

Classify 200 pathology slide thumbnails with a text prompt.

| Step                                                  | Tokens  | Cost      |
| ----------------------------------------------------- | ------- | --------- |
| Input: 200 images x \~1,600 tokens each + text prompt | 340,000 | $0.27     |
| Output: classification label, \~50 tokens each        | 10,000  | $0.04     |
| **Total**                                             |         | **$0.31** |

**4. High-volume daily pipeline (Haiku)**

Nightly batch processing 10,000 short text records.

| Step                                      | Tokens    | Cost        |
| ----------------------------------------- | --------- | ----------- |
| Input: 10,000 records x \~500 tokens each | 5,000,000 | $4.00       |
| Output: \~100 tokens each                 | 1,000,000 | $4.00       |
| **Total per run**                         |           | **$8.00**   |
| **Monthly (30 runs)**                     |           | **$240.00** |

### Budget controls

The default budget is **$5.00 per day**. Budget can be set to `daily` (resets at midnight UTC) or `monthly` (resets on the first of each month). Budgets are adjustable at runtime without redeployment.

Processors can also set a per-execution budget via `executionBudgetUsd`, providing a second layer of cost control that prevents a single workflow run from consuming the entire daily allowance.

***

## Cost Tracking

Every workflow execution gets a cost estimate in the finalizer logs:

```json
{
  "ecs": {"taskCount": 2, "totalSeconds": 120, "estimatedCost": 0.001892},
  "lambda": {"invocationCount": 7, "estimatedCost": 0.000626},
  "stepFunctions": {"stateTransitions": 9, "estimatedCost": 0.000225},
  "cloudWatchLogs": {"estimatedCost": 0.000054},
  "efsStorage": {"storageGB": 0.093, "durationHours": 0.05, "estimatedCost": 0.000002},
  "totalEstimatedCost": 0.002824
}
```

All resources are tagged with `ComputeNodeId` and `Environment` for cost allocation in AWS Cost Explorer.