# Cost allocation labels

> For the complete documentation index, see [llms.txt](https://docs.ringleader.dev/llms.txt).


> A CloudIdentity can put cloud labels or tags on every workstation it builds, so a cloud bill can be grouped by owner, namespace or workstation.


A CloudIdentity can put cloud labels (tags on AWS and Azure) on every workstation it builds. Set
`addRingleaderLabels: true` to have Ringleader fill in four labels, so a cloud bill can be grouped by
owner, namespace or workstation. You can add labels of your own, and their values can differ for each
workstation.

## Labels that Ringleader adds

`addRingleaderLabels: true` adds these four labels:

| Label | Value |
|---|---|
| `ringleader-subject` | A short hash of the workstation's creator. |
| `ringleader-namespace` | The workstation's namespace. |
| `ringleader-workstation` | The workstation's name. |
| `ringleader-workstation-uid` | The workstation's unique id, which tells a recreated workstation apart from an earlier one of the same name. |

The workstation's attached resources carry every Ringleader label too, so their charges group with the
VM's. On GCP that is the boot disk. On AWS it is the root volume and the primary network card. On Azure it is
the network card, the public IP and the OS disk. Labels you write yourself stay on the VM alone.

On AWS and Azure, a VM that Ringleader builds for a namespace in an organization also carries a
`ringleader-org` tag that identifies the organization. The VM goes without the tag if the tag would take it
past its cloud's limit on tags. [Subnet claims](https://docs.ringleader.dev/cloud-accounts/cloud-identities/subnet-claims/) says what
Ringleader uses it for.

Keys that start with `ringleader-` are Ringleader's. Ringleader refuses a CloudIdentity that writes one,
and drops one that a workstation writes.

## Labels of your own

Both `defaultProviderConfig` and `overrideProviderConfig` may carry the VM's cloud labels or tags. Their
values may be templated per workstation:

- `owner: ${shortHash:creatorUserId}`
- `team: ${metadata:namespace}`
- `id: ${metadata:uid}`

Ringleader expands the templates once for each workstation the identity governs. It then sanitizes the
values to one portable character set, so the same file produces the same label on every cloud.

Ringleader removes only labels that it applied itself. Keys that anything else put on a VM, such as your own
cost-center tagging or a cloud policy that appends tags, are left alone.

## Label workstations for cost reporting

In the CloudIdentity, set `addRingleaderLabels: true` under the cloud's block of `defaultProviderConfig`
or `overrideProviderConfig`. A namespace member may also set `labels` (GCP), `tags` (AWS and Azure) and
`addRingleaderLabels` on their own workstation, as
[Keys a namespace member may set](https://docs.ringleader.dev/reference/providers/images-keys/#keys-a-namespace-member-may-set) lists.

To add a label that identifies who owns a workstation, put it in `overrideProviderConfig`, never in
`defaultProviderConfig`. A workstation's own `providerConfig` can replace a default, so a member could
relabel their workstation as someone else. An override cannot be replaced.

## Next steps

- [Provider images and keys](https://docs.ringleader.dev/reference/providers/images-keys/): the `labels`, `tags` and
  `addRingleaderLabels` keys of each cloud.
- [Identity selection and workstation defaults](https://docs.ringleader.dev/cloud-accounts/cloud-identities/selection-defaults/):
  how defaults and overrides fold together.

