cost-project

command
v0.19.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2026 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Command cost-project projects what standing an estate up on real AWS would cost, before anyone authorises the run.

The maintainer's rule is that heavy and paid runs are theirs, by hand. This tool exists to make that decision on a number rather than an impression: point it at a plan and it says what the estate would cost for a run of a given length, itemised, in the region and at the prices live/aws-prices.json names.

The rule this tool is built around

An unpriced type is never treated as free. A cost projector that silently prices what it does not know at zero is worse than no projector, because it produces a small, confident number that someone then acts on. So: every type in the plan is either priced by name in live/aws-prices.json, or reported as unpriced, and while any are unpriced the total is labelled a LOWER BOUND and the exit code is non-zero. `-strict` turns that into a refusal to print a total at all.

Two modelling facts the table carries and this tool honours:

  • Hourly resources are prorated by the run's length. A NAT gateway for three hours is three hours of NAT gateway.
  • Monthly resources are not always prorated. A Route 53 hosted zone is billed for the whole month even if it lives for an hour, so a three-hour run pays the same $0.50 as a thirty-day one. Getting that backwards understates a short run by a factor of two hundred.

What it does not model, and says so on every run: data transfer, request charges, storage, and instance sizing. `aws_instance` is priced as t3.micro because the table does not read instance_type. Those exclusions are printed, not buried, because the number is a projection and not a quote.

Input

A plan in JSON, which is exact and available before anything is created:

terraform plan -out=tfplan && terraform show -json tfplan > plan.json
go run ./tools/cost-project -plan plan.json -hours 3

Or a type/count inventory, for projecting a shape that has no plan yet:

go run ./tools/cost-project -counts aws_nat_gateway=3,aws_kms_key=4 -hours 3

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL