Answer cost questions

Find where your cloud spend goes and what a change will cost, from the cost data that Stategraph keeps for every state. The agent ranks and explains. The figures come from Stategraph.

How Stategraph does it

  • With cost estimation on, Stategraph prices every resource in every state from its price book. It recalculates after applies and on a schedule.
  • Every total carries a coverage figure: the share of resources that have a price. The agent reports it with the total, so an estimate is never read as the full bill.
  • A plan carries a cost block, with the change in monthly cost of each resource that the plan touches.
  • With a billing source connected, actual spend from your cloud bill sits beside the estimates, in separate commands.

Before you begin

Steps

1. Ask where the spend goes

Where does our monthly AWS spend go? Use Stategraph to break it down by state, list the five
most expensive resources, and tell me how much of the estate is not priced.

The agent reads the tenant total, then each expensive state:

stategraph cost tenant --format=json
stategraph cost state --state <state-id> --format=json
stategraph cost billing-source list --format=json
aws_db_instance.primary$656.27
aws_db_instance.replica_1$328.50
aws_db_instance.replica_2$164.25
aws_instance.bastion$7.59
Monthly estimate per resource, from stategraph cost state.

2. Break it down by owner

stategraph cost tenant --tag-key Team

Output:

tag:Team        monthly      hourly    resources
--------------  -----------  --------  ---------
(total)         1156.612000  1.584400  204
data            1149.020000  1.574000  13
engineering     7.592000     0.010400  20

Other breakdowns: stategraph cost history --group-by provider for the trend, and stategraph cost unmanaged for spend that no state manages. Both need a billing source for actual spend.

3. Price a change before you apply it

When an agent plans a change, ask for its cost. The plan's cost block shows the change per resource:

Costs:
  Per state:
    acme-data-stores:
      ~ aws_db_instance.replica_1                           -164.25

See Make a change with a plan-only agent.

Next steps