# Connect Akamai Cloud (Linode)

Costfluent reads your Akamai Cloud (Linode) spend from the account's invoices, through the Linode
API, with a personal access token you create for it. One connection is one Linode account, and the
cost of everything invoiced to it.

## How Costfluent connects

Costfluent collects each invoiced month's Linode cost per invoice item and region, as Akamai
invoices it. A month is there once Akamai issues its invoice, on the first day of the next month;
until then the running month shows no Linode cost, unless a mid-month invoice has been issued.

Costfluent stores the token encrypted and reads three things with it: the account's ID, the
account's invoices, and the items of each invoice it collects. The account's ID is the connection's
identity, and the token is only ever used for that connection.

:::caution
Linode has no scope that reads only billing. A token with the "Account" scope at "Read Only" can
also read the account's name, address, contact details and the card on file. Costfluent never reads
those fields: it takes only the account's ID from the account, and the invoices and their items.
Create a token with that one scope and no other access, as the prerequisites describe.
:::

## Prerequisites

1. The Owner or Integration owner organization role in Costfluent.
2. A Linode user who may read the account's billing:
   - the account's unrestricted user;
   - a restricted user whose "Billing Access" is "Read Only" or more, set in Cloud Manager under
     "Users & Grants" on the user's permissions;
   - on an account using Identity and Access, a user with the role `account_billing_viewer`.
3. A personal access token for Costfluent alone, created by that user. In Cloud Manager, select your
   username at the top of the screen, then "API Tokens", and select
   "Create a Personal Access Token". Enter a "Label" that names Costfluent and choose an
   "Expiry": the token stops working then, so note the date to replace it before. Set "Account"
   to "Read Only" and every other product or service to "No Access", then select
   "Create Token". Copy the token before you close the window: Linode does not show it again.

## Connect

<Stepper>

1. Open **Settings**, then **Integrations**, select **Akamai Cloud (Linode)**, and open the
   **Connect** tab.
2. Select "Add access token", keep the suggested **Display name** or enter your own, and paste the
   token into **Personal access token**.
3. Select "Test connection" to see each check, or "Connect" to save.

</Stepper>

Before storing anything, Costfluent reads the account the token belongs to and then the first page
of its invoices, so a connection that saves can read your invoices. A second connection of the same
account is refused. If Linode does not answer during that check, the connection is saved anyway and
checked again automatically.

## Data and freshness

Akamai invoices an account on the first day of each month for the month before. Costfluent files
each invoice item's whole cost on the day its billing starts, as the invoice states it: the first of
the month for most items, the day a resource was added for one added during the month, and the first
day an invoice bills for its tax. Month and longer views are exact; a daily chart shows each item on
that one day, so daily cost for Linode is not available.

:::note
The running month has no invoice, so it shows no Linode cost until Akamai issues that invoice on the
first of the next month. Each sync also reads the previous month again until the 15th of the month,
so an invoice issued on the first arrives with the next sync. When an account's charges reach its
billing threshold during a month, Akamai issues a mid-month invoice; its items land as soon as it is
issued, and the rest of the month follows with the next month's first invoice.
:::

:::note
Amounts are in US dollars, as Linode invoices them. Each invoice item is its amount before tax, and
each tax on the invoice is a row of its own, named as the invoice names it. A negative item, such as
a credit, is a credit.
:::

Connecting imports as far back as your plan's backfill reaches, and at most six months
([Manage connections](/connect/manage-connections#how-it-behaves)), for each month Akamai has
invoiced.

## Reporting dimensions

- **Service** is the Linode product an invoice item's label names, such as a Linode plan, Block
  Storage, Object Storage, NodeBalancers or Backups; an item whose label Costfluent does not
  recognize has the service Linode, in the category Other.
- **SKU** is the invoice item's label.
- **Resource** is the instance the label names, where it names one; Linode's invoices carry no
  resource IDs.
- **Region** is the item's region, and Global for an item without one, such as tax.
- The billing account is the Linode account, and the billing period is the invoice's month.

## Update or disconnect

### After connecting

The **Manage** tab lists the connection by its display name, with its account's ID. Open the gear
icon beside it to see whether the invoices 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

Linode does not rotate the token for you, and it stops working at its expiry. Before then, create a
new token the same way, select **Update credentials** on the connection page and paste it. A token
of another account is refused. Once the connection reads with the new token, revoke the old one in
Cloud Manager: select your username, then "API Tokens", and select "Revoke" beside it.

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

## Troubleshooting

The check's messages say what Linode answered:

- **Linode refused the token.** The token is wrong, has expired or was revoked. Create a new token
  and paste it.
- **The token may not read the account's invoices.** The token lacks the "Account" scope at
  "Read Only", or the user who created it may not read billing. A token's scopes cannot be
  changed once it exists, so create a new one with that scope as a user with billing access, as the
  prerequisites describe, and select **Update credentials**.
- **Linode could not be reached.** Linode did not answer, or answered with an error of its own.
  Select **Run checks** later; a connection saved meanwhile is checked again automatically.
