> Index of every page on this site: [llms.txt](https://docs.a-line.cloud/llms.txt)

# Keys

> Declare key rings and keys in an infrastructure link. Key material never goes in Git.

Keys is in **Preview** and only available where the platform runs the key
service. Without it, a plan or sync of a link that declares key rings fails
with `keys_unavailable`.

## Key rings

A key ring file is `key-rings/<name>.yaml` in an infrastructure link. The
file name is the ring's name; its keys go under `keys:`. Only metadata is
declared: key material is made by the key service and never leaves it.

```yaml title="key-rings/payments.yaml" iac tree=keys
# yaml-language-server: $schema=https://a-line.cloud/schemas/iac/v1.json
version: 1
keys:
  card-data:
    rotation_period: 90d
    labels:
      team: billing
  receipts: {}
```

| Key field | Meaning |
| --- | --- |
| `purpose` | `encrypt_decrypt`, the default and only value. |
| `rotation_period` | Automatic rotation such as `90d`, at least `1d`. Left out, the current schedule stays. |
| `labels` | At most 32 pairs. When present, they replace the key's labels. |
| `destroy` | `true` schedules the whole key for destruction (see below). |
| `destroy_delay` | How long until a `destroy: true` key is destroyed, `24h` to `30d`, default `7d`. |

An organization has at most 10 key rings. The plan lists the rings and keys
it creates and the keys whose rotation period or labels it changes.

## Removing keys

Destroy is never implicit. Removing a key from a file, or a whole ring file,
keeps the key: the plan reports it as unmanaged and IaC stops changing it.
Delete an empty ring in the console.

To destroy a key, keep it in the file with `destroy: true`. The key needs
**Allow destroy** switched on in the console, otherwise the sync refuses the
change. The key is scheduled for destruction after `destroy_delay` and can
be restored in the console until then.

```yaml title="key-rings/archive.yaml" iac tree=keys-destroy
# yaml-language-server: $schema=https://a-line.cloud/schemas/iac/v1.json
version: 1
keys:
  legacy:
    destroy: true
    destroy_delay: 14d
```

## Export

Exported key ring files hold each key's rotation period and labels, never
key material and never `destroy`.

See [Keys](/concepts/keys) for how keys encrypt data.
