OVHcloud FOCUS export
Have OVHcloud write your bill as FOCUS files to an Object Storage bucket, create a user that may only read it, and connect the bucket to Costfluent.
OVHcloud can write your bill as a FOCUS file into an Object Storage bucket of yours every day, and Costfluent reads that bucket as a FOCUS bucket. It is the optional second path: Connect OVHcloud reads the same cost through an API key, with nothing to set up in a bucket. Connect one of the two, because each imports the same cost and the second counts it twice.
Before you start
- The Costfluent access under Prerequisites.
- A Public Cloud project with an Object Storage bucket for the export.
- An OVHcloud API token allowed to call the
/finopsroutes. OVHcloud documents setting up the export through its API only.
Turn on the export
OVHcloud writes into your bucket with an access key you give it, so the export needs a user that may write there. Costfluent gets a different user under Create a read-only key.
-
In the Public Cloud project, open "Object Storage" under "Storage", and on the "Users" tab select "Create a user". Save its access key and secret key: OVHcloud shows the secret key once.
-
On the "Containers" tab, open the "..." menu of the bucket, select "Add S3 user", choose that user and the Role "Read and write".
-
Send
POST /v2/finops/bucketExportto your account's API endpoint,https://api.eu.ovhcloud.comfor an account in Europe, with the writing user's keys and the bucket:CodeexportHouris the hour of the daily run in UTC.filePolicyREPLACEkeeps one file per month, overwritten on every run;CREATEkeeps one file per run.endpointURLis the host alone, withouthttps://.pathPrefix./writes at the bucket's top; another value is a folder the files go under. -
Note the
idin the answer, and callGET /v2/finops/bucketExport/{id}untilresourceStatusisREADY. OVHcloud first lists the bucket and writes to it with the keys; when that fails, the status isERROR.
Create a read-only key
Costfluent reads the bucket with a user of its own whose policy allows only listing the bucket and reading its objects.
-
On the "Users" tab of "Object Storage", select "Create a user", and save its access key and secret key.
-
Open the "..." menu of that user, select "Import a policy", and import this policy with your bucket's name. It replaces the user's current policy.
Code
Use a user that did not create the bucket and that the export does not write with. OVHcloud lets the user who created a bucket do anything in it, whatever that user's policy says.
Connect in Costfluent
- Open Settings, then Integrations, select FOCUS bucket, open the Connect tab and select Add access key.
- Choose OVHcloud as the Provider, and enter the bucket's region in lower case in Region,
such as
gra,sbg,deoreu-west-par: the export'sregion. - Enter the bucket's name in Bucket. In Prefix, enter the export's
pathPrefix, or leave it empty when thepathPrefixis./. - Enter the read-only user's access key in Access key ID and its secret key in Secret access key.
- Select Test connection to see each check, or Connect to save.
You can connect before the first run: Costfluent accepts a prefix that holds no file yet.
How it behaves
- OVHcloud writes a file every day at
exportHourUTC, or every hour whenperiodisHOURLY. Each file holds the month so far, in FOCUS 1.3, as a CSV file namedfocus.csvunder a folder of your OVHcloud account's identifier. - Costfluent reads the newest file of each month in each sync's window
(Data and freshness), so the
CREATEandREPLACEpolicies import the same cost.CREATEleaves one file per day in the bucket. - OVHcloud writes from its next run on and describes no export of earlier months.
DELETE /v2/finops/bucketExport/{id}stops the export. The files it wrote stay in the bucket.
Troubleshooting
- The export stays in
ERROR.GET /v2/finops/bucketExport/{id}/tasknames the cause. Most oftenendpointURLstarts withhttps://, the writing user may not list the bucket or write to it, orbucketNameorregionis wrong. Send the whole correctedtargetSpecwithPUT /v2/finops/bucketExport/{id}, the secret key included, which OVHcloud never returns. - No file appears. The export is not
READY, or its first run has not come yet: the nextexportHourin UTC. - OVHcloud cost is counted twice. An OVHcloud API key connection imports the same cost. Remove one of the two connections.
- Every other message: Troubleshooting on the FOCUS bucket page.