Connect Oracle Cloud (OCI)
Give a dedicated Oracle Cloud Infrastructure (OCI) user an API signing key and a policy that may read only your tenancy's cost reports, and Costfluent imports its daily cost from the FOCUS reports Oracle writes.
Costfluent reads your Oracle Cloud Infrastructure (OCI) spend from the FOCUS cost reports Oracle writes for your tenancy, with an API signing key of a user you create for Costfluent. One connection is one tenancy.
How Costfluent connects
Oracle writes your tenancy's cost reports into an Object Storage bucket of its own, not into your
tenancy: in the namespace bling, in a bucket named after your tenancy's OCID, in your tenancy's
home region. Costfluent lists the reports under FOCUS Reports/, where Oracle keeps a folder for
each day of usage, and reads them. It reads nothing else.
You give Costfluent the tenancy OCID, the user's OCID, the key's fingerprint, its private key and the home region. Costfluent keeps them encrypted. OCI signs every request with the private key itself and offers no short-lived token for reading the reports, so Costfluent hands the key to its collection agent for each collection of your tenancy, and for nothing else. The tenancy OCID is the connection's identity, and the key is only ever used for that connection.
An OCI API key acts as its user: a request signed with it may do whatever the user's groups may do. Costfluent only reads the reports, but the key could do more if the user's groups allow more. Create a user and a group for Costfluent alone, as the steps below describe, and give the group nothing but the policy that reads the reports.
Prerequisites
- The Owner or Integration owner organization role in Costfluent.
- Access to the OCI console as a user who may create users, groups and policies in the tenancy, such as a member of the Administrators group.
Prepare Oracle Cloud
-
Create a user for Costfluent alone. Open the navigation menu, select Identity & Security, under Identity select Domains, select your identity domain, and then Users.
-
Create a group whose only member is that user.
-
In the tenancy's root compartment, create a policy with these two statements, with your group's name in place of
<group>. Oracle reads cross-tenancy statements only in the root compartment, not in a child compartment.CodeDo not change the OCID in the first statement: it is the tenancy that holds Oracle's report bucket, the same for every customer, not yours. The second lets the group read the reports in it.
-
Open the user's details page. Under Resources, select API keys, then Add API key. In the dialog, select Generate API key pair, then Download private key, and then Add. Keep the downloaded file until you have pasted it into Costfluent, then delete it: Costfluent never shows it again.
-
Copy the
fingerprintfrom the Configuration file preview the console shows once the key is added. The user's API keys list shows it too. -
Copy the user's OCID, which starts with
ocid1.user.oc1.., from the user's details page. -
Open the Profile menu and select the entry that reads "Tenancy:" and your tenancy's name. Copy the tenancy's OCID, which starts with
ocid1.tenancy.oc1.., under Tenancy Information, and note its home region on the same page.
Costfluent needs the home region's identifier, such as eu-frankfurt-1 for Germany Central
(Frankfurt). Oracle's list of regions
gives each region's identifier beside its name.
The private key the console's "Generate API key pair" downloads has no passphrase, which is what Costfluent needs: it signs with the key on every collection, and a key protected by a passphrase is refused.
Connect
- Open Settings, then Integrations, select Oracle Cloud, and open the Connect tab.
- Select "Add API key", keep the suggested Display name or enter your own, and enter the
tenancy's OCID into Tenancy OCID, the user's OCID into User OCID, the fingerprint into
Fingerprint, the home region's identifier into Home region, and the whole private key,
from
-----BEGINto-----END, into Private key. - Select "Test connection" to see each check, or "Connect" to save.
Before storing anything, Costfluent lists your tenancy's reports with the key, which proves that the key is your tenancy's and that the policy is in place, and reads the newest report's header to check that it is a FOCUS report. A connection that saves can therefore read your reports. A tenancy with no report yet connects too: Oracle writes a new tenancy's first report some hours after its usage starts. A second connection of the same tenancy is refused. If Oracle does not answer during that check, the connection is saved anyway and checked again automatically.
Data and freshness
Connecting imports as far back as your plan's backfill reaches, and at most six months (Manage connections). Older months collected on request reach one year back, which is as long as Oracle keeps the reports. Cost arrives by the day the usage occurred, in the report's billing currency.
Oracle writes a report every six hours, each holding about six hours of usage, and its data can arrive up to 24 hours late. A day's cost is therefore complete by the next day.
Oracle adds a correction to a report as a new row rather than changing the old one. Each sync reads the running month again, and the previous month until the 15th of the month after it. When Oracle writes a newer report into an older month, Costfluent collects that month again.
Reporting dimensions
- Service is the OCI service the report names, with its Service category.
- Sub-account is the tenancy, or the compartment where a report names one.
- Region is the region's name the report states.
- Resource is the resource's name the report states.
- SKU is the meter the report states, or the SKU ID where it states none.
- Tag holds every key of the row's tags, as written.
- The seller is the one the report names,
Oracle Cloud Infrastructurefor a row that names none.
Update or disconnect
After connecting
The Manage tab lists the connection by its display name, with its tenancy OCID under Account. Open the gear icon beside it to see whether the reports 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
A user can have up to three API keys at a time, so a key is rotated without a gap. Add a new API key to the same user as in step 4 above and copy its fingerprint. Select Update credentials on the connection page and enter the same tenancy OCID, user OCID and home region with the new key's fingerprint and private key. Costfluent does not show the stored private key, so you paste the whole new one. A key of another tenancy is refused. Once the checks pass, delete the old key from the user's API keys.
Deleting the user's API key removes Costfluent's access to your reports. To retire the connection, remove it in Costfluent, then delete the user, its group and the policy. Removing it erases the cost it imported (Remove a connection).
Troubleshooting
The check's messages say what is wrong. Those from Oracle's answer name its HTTP status, error code and request ID:
- Enter the tenancy's OCID, which starts with ocid1.tenancy.oc1.. The tenancy OCID is empty or is not a tenancy's. Copy it again under Tenancy Information.
- Enter the user's OCID, which starts with ocid1.user.oc1.. The user OCID is empty or is not a user's. Copy it again from the user's details page.
- Enter the API key's fingerprint as the console shows it: 16 pairs of hexadecimal digits separated by colons. Copy the fingerprint from the user's API keys list.
- Paste the API key's private key in PEM form, from -----BEGIN to -----END. The private key is empty, or its first line is missing. Paste the whole downloaded file.
- The private key is protected by a passphrase. The key has a passphrase. Add a key to the user with "Generate API key pair", as step 4 describes, and paste that one.
- The private key is not an RSA private key in PEM form. Part of the key is missing, or another file was pasted, such as the public key. Paste the whole private key the console downloaded.
- Enter the tenancy's home region identifier, such as eu-frankfurt-1. The home region is empty or is a region's name. Enter its identifier from Oracle's list of regions.
- ... does not exist. Check the tenancy's home region, such as eu-frankfurt-1. No region has that identifier. Check its spelling against Oracle's list of regions.
- ... answered ... with a redirect, which is never followed. Check the home region. The region is not your tenancy's home region. Enter the home region shown on the tenancy's page.
- Oracle Cloud refused the API signing key for ... Check the user OCID, the key's fingerprint and its private key, and that the key is still on the user. The user OCID, the fingerprint or the private key is wrong, they belong to different keys, or the key was deleted. Compare the fingerprint with the user's API keys list, or add a new key and enter it.
- The key may not read ... Check that a policy in the tenancy's root compartment defines Oracle's usage-report tenancy and endorses the user's group to read objects in it, that the region is the tenancy's home region, and that the tenancy OCID is the tenancy's. The policy is missing, is in a child compartment, names another group or changed the first statement's OCID; or the region or the tenancy OCID is wrong. Create the policy as step 3 describes, check that the user is in its group, then select Run checks.
- The file ... has no ... column, so it is not a FOCUS file. The newest report is not one Costfluent can read. Oracle writes these reports itself, so nothing in the connection changes them: tell us through the contact form.
- The report ... was removed after it was listed. Oracle removed a report while Costfluent was reading. The next collection lists the reports again; nothing needs doing.
- ... lists more than ... objects, more than Oracle keeps in a year. The tenancy holds more reports than Costfluent reads at once. The next collection lists them again after Oracle removes the oldest; if it keeps failing, tell us through the contact form.
- This key belongs to another tenancy than the one this connection collects. Shown when updating credentials with a key of another tenancy. Nothing was changed; connect that tenancy as a new connection.
- ... could not be reached to verify these credentials. Oracle did not answer, or answered with an error of its own. Select Run checks later; a connection saved meanwhile is checked again automatically.