# Connect OVHcloud

Costfluent reads your OVHcloud Public Cloud spend from OVHcloud's API, with a read-only API key you
create for it. One connection is one OVHcloud account, and the cost of every Public Cloud project in
it.

## How Costfluent connects

An OVHcloud API key has three parts: an application key, an application secret and a consumer key.
Costfluent stores them encrypted and signs every request to OVHcloud with them. It reads the
account the key belongs to, which identifies the connection, lists the account's Public Cloud
projects on every sync, and reads each project's usage. The key is only ever used for that
connection.

Costfluent refuses a consumer key that may do more than read: one whose rights include any method
other than GET, or that is not restricted to named routes at all.

OVHcloud runs three platforms, each with its own accounts, API and token page, where API keys are
created. You choose the platform when you connect, and Costfluent calls that platform's API:

| Platform | In Costfluent | API | Token page |
|---|---|---|---|
| OVHcloud Europe | `ovh-eu` | `eu.api.ovh.com` | `api.eu.ovhcloud.com` |
| OVHcloud North America, for accounts on ovh.ca | `ovh-ca` | `ca.api.ovh.com` | `ca.api.ovh.com` |
| OVHcloud US | `ovh-us` | `api.us.ovhcloud.com` | `api.us.ovhcloud.com` |

:::caution
A key works only on the platform it was created on, so create it on your account's platform and
choose that same platform when you connect. Only Public Cloud projects are read: dedicated servers,
domains and other OVHcloud services are not.
:::

## Prerequisites

1. The Owner or Integration owner organization role in Costfluent.
2. An OVHcloud account on OVHcloud Europe, OVHcloud North America or OVHcloud US. An account without
   a Public Cloud project connects, and its cost arrives once it has one.
3. An API key restricted to reading, created on the token page of your account's platform (the
   table above) while signed in to the account, with exactly three rights: `GET /auth/details`,
   `GET /cloud/project` and `GET /cloud/project/*/usage/*`. Choose unlimited validity: a key that
   expires stops the connection. The page then shows the application key, application secret and
   consumer key. The OVHcloud guide in the console links each platform's token page with the three
   rights filled in.

## Connect

<Stepper>

1. Open **Settings**, then **Integrations**, select **OVHcloud**, and open the **Connect** tab.
2. Keep the suggested **Display name** or enter your own, and under **Platform**,
   choose the platform you created the key on: Europe (`ovh-eu`), North America (`ovh-ca`) or US
   (`ovh-us`). The form opens on Europe.
3. Paste the application key, application secret and consumer key into their fields.
4. Select "Test connection" to see each check, or "Connect" to save.

</Stepper>

Costfluent reads the key's account, its rights, and one project's usage for the running month
before storing anything, so a connection that saves can read your cost. A connection with the same
account as an existing one is refused.

## Data and freshness

OVHcloud's API prices Public Cloud usage per calendar month, not per day, so Costfluent shows each
project's cost for a month on the first day of that month. Month and longer views are exact; a daily
chart shows the whole month on its first day, and daily cost for OVHcloud is not available.

:::note
The running month is OVHcloud's month to date. Each sync replaces it, so its cost grows during the
month until OVHcloud closes the month.
:::

Connecting imports as far back as your plan's backfill reaches, and at most six months
([Manage connections](/connect/manage-connections#how-it-behaves)), as long as OVHcloud reports
usage that far back. Cost arrives in the account's own currency, such as EUR, CAD or USD, and
reports convert it as they do any other cost ([Currency](/currency)). Where OVHcloud's total for a
project's month differs from the sum of its itemized lines, the difference arrives as one
adjustment line, so each project's month matches OVHcloud's own total.

## Reporting dimensions

- **Sub-account** is the Public Cloud project's ID.
- **Service** is the Public Cloud product, such as `Compute Instances`, `Block Storage`,
  `Object Storage` or `Managed Kubernetes Service`. The adjustment line's service is `Public Cloud`.
- **SKU** is what was billed: the instance flavor, such as `d2-2`, the volume or storage type, or a
  resource type and its component. The adjustment line's SKU is `remainder`.
- **Region** is the region OVHcloud states for the line.
- **Usage unit** is OVHcloud's unit, such as `Hours` or `GiB-Hours`.
- **Resource** is the ID OVHcloud gives the instance, volume, Kubernetes cluster or other resource
  a line bills, and the bucket's name for object storage; a line that names none, such as
  bandwidth or a snapshot, has no resource.
- The billing account is the OVHcloud account, and the billing period is the calendar month.

## Update or disconnect

### After connecting

The **Manage** tab lists the connection by its display name, with its OVHcloud account. Open the
gear icon beside it to see whether the costs are still readable, which workspaces the connection
feeds, and which months have been imported. **Run checks** runs the checks again on request.

### Rotating or removing access

Select **Update credentials** on the connection page and paste a new read-only key of the same
account, created on the same platform: **Platform** opens on the connection's own. Then revoke the
old key at OVHcloud. A key of another account is refused.

To retire the connection, remove it in Costfluent and revoke its key at OVHcloud. Removing it
erases the cost it imported
([Remove a connection](/connect/manage-connections#remove-a-connection)).

## Troubleshooting

- **This consumer key may change your OVHcloud account.** The consumer key's rights include more
  than GET, or are not restricted to named routes. Create a key with the rights under Prerequisites.
- **This consumer key's access rules do not allow reading its account.** The key lacks
  `GET /auth/details`. Create a key with the rights under Prerequisites.
- **This consumer key may not read Public Cloud usage.** The key lacks `GET /cloud/project` or
  `GET /cloud/project/*/usage/*`. Create a key with the rights under Prerequisites.
- **OVHcloud refused this key.** One of the three values is wrong, the platform chosen is not the
  one the key was created on, the consumer key was never validated on OVHcloud's token page, or it
  was revoked or has expired.
- **This key belongs to another organization.** Shown when updating credentials: the key belongs
  to another OVHcloud account. Connect that account as a new connection.
