# See what a resource costs

See what one instance, database, cache, VPN endpoint, volume, CDN distribution or web ACL has cost this month and last month, what it costs right now, and how close it is to its monthly cap.

## Prerequisites

- Permission for `billing:GetCostAndUsage`. Without it, the resource's page shows no **Cost** card.
- In the console, the permission to open the resource's own page.

## See the cost of a resource

**Console**
1. Open the resource's page: an instance, a database, a cache cluster, a VPN endpoint, a web ACL,
   or the cost tab of a CDN distribution.

The **Cost** card shows **This month so far**, **Last month** and **Right now**: the hourly charge,
"(list …/h, monthly cap reached)" once the cap is reached, or, for a resource that has not been
metered yet, when its first hour is billed. A machine with a monthly cap shows its progress towards
it. **Open in the cost explorer** opens the resource there.

**CLI**
```sh
dcloud billing costs resource --kind instance --id i-0123456789abcdef0
```

**API**
```http
GET /billing/api/resource-cost?kind=instance&id=i-0123456789abcdef0
```

`kind` is `instance`, `database`, `cache`, `vpn`, `volume`, `distribution` (CDN) or `webAcl`
(WAF). Replace _i-0123456789abcdef0_ with the resource's id as its service names it.

## Result

The answer has `monthToDate` and `lastMonth` (as charged, in EUR), `currentHour` (null when the
resource was not metered in the last two hours: stopped, deleted, or storage), `storagePerMonth`,
and `caps`, one row per machine, with what it was charged this month against its cap and whether
the cap is `reached`. An id with no usage in your organization answers `200` with zeros, not `404`.

## Related

- [How you are charged](how-you-are-charged.md)
- [Explore costs](explore-costs.md)
- `billing.costs.resource` · `dcloud billing costs resource`
