# Estimate a cost

Price an API operation before you run it, per hour and per month with the monthly cap, without creating anything.

The estimate takes an operation id, such as `rds.instances.create`, and the request body you would
send it. Nothing is created.

## Prerequisites

- Permission for `billing:EstimateCost`, or for the IAM action of the operation you price (whoever
  may create something may see what it costs).

## Estimate an operation

**Console**
The create forms that buy capacity (instances, databases, caches, file systems, load balancers,
autoscaling groups and others) show the estimate while you fill them in: per hour, per month with the monthly cap, and the part
that is metered but not charged yet.

**CLI**
```sh
dcloud billing estimates create --operation rds.instances.create \
  --body instanceClass='"performance-2"'
```

Every CLI command also takes `--dry-run`: the CLI prints the request it would send, and sends
nothing. For a command that changes something, and when you are signed in, it also prints the same
estimate.

**API**
```http
POST /billing/api/estimate
{ "operation": "rds.instances.create", "body": { "instanceClass": "performance-2" } }
```

## Result

The answer lists each priced item with `eurPerHour`, `eurPerMonth` (with the monthly cap applied)
and `monthlyCap`, the totals, `usagePrices` for pay-per-use meters, and a `summary` such as
"5,99 €/month max · 0,0096 €/h (excl. VAT)". Items marked `billed: false` are not on your
invoice: they are metered but not charged yet, or billed by your own provider. The totals
`eurPerHour` and `eurPerMonth` leave them out; `notBilledEurPerMonth` carries what the metered,
not-charged ones would cost a month.

An operation that buys nothing answers `summary` "No charge: this operation does not buy or release
billed capacity." with no lines.

## When the estimate is refused

- `404` "Unknown operation: …" for an operation id the API does not have.
- `403` "Forbidden" with neither `billing:EstimateCost` nor the operation's own action.
- `400` when `operation` is not an operation id.

## Related

- [How you are charged](how-you-are-charged.md)
- `billing.estimates.create` · `dcloud billing estimates create`
