Each user owns their rigs
An end-user owns the rigs and hosts it creates. Only that user can use them: open SSH or open service ports.The API that runs a command on a rig, and the API that reads a rig’s files,
are not available to end-users yet. Until then, an end-user runs commands
over SSH, for example
amika rig ssh <rig> -- <command>.Set up your backend
1
Turn on end-users
End-users are off by default. Contact Amika to turn them on for your
organization.
2
Create an act-as key
An organization owner creates an API key with only the
end-users:act-as
permission, under Settings → API Keys. Admins and members cannot create
this key. Store it on your backend only.This key can act for your users, but it can’t read your organization’s own
data. A key can’t have both end-users:act-as and org:access, so a request
that forgets to name a user never sees every user’s data.3
Act as a user
Add the Without the header, the key gets
Amika-As-Principal header with your ID for the user. The request
runs as that user, with exactly that user’s access.- HTTP API
- TypeScript SDK
403 on every route except token minting
and user disable.Create a rig for a user
Create the rig with the act-as header. The user owns the rig.- HTTP API
- TypeScript SDK
secret_env_vars or a snapshot. The user has
root on the rig, so anything on it is theirs to read.
Give your app a token for the user
If your user’s own app or CLI talks to Amika directly, mint a short-lived principal token for that user. Send this request without the act-as header.- HTTP API
- TypeScript SDK
ttl_seconds).
In your client app, the TypeScript SDK can get a new token from your backend
before the old one expires:
- Create, list, stop, start, and delete their rigs.
- Open SSH, and use their rigs’ services and ports.
- Add and delete their own SSH keys.
- Connect their own machines as hosts. See the next section.
Let users connect their own machines
A user can run rigs on their own machine. They install theamika-hostd
daemon there, and it registers the machine as a host that the user owns.
Your team can see the host, but it can’t use it or put rigs on it.
1
Get a token for the user
Your backend mints a principal token
and gives it to the user, for example through your app or CLI. Don’t give the
user one of your organization’s API keys.
2
Install the daemon
On the user’s machine:
3
Set up and start the host
Pass the user’s token in
AMIKA_HOSTD_API_KEY for each command. Don’t write
it to a file.up registers the host to the user. The daemon keeps only its own host
secret, not the user’s token. With bare_metal, a rig is the machine
itself. See Bring your own compute for the other runtimes and
options.my-laptop.
Your organization’s own work never runs on a user’s host.
amika-hostd up registers the host each time it starts. To restart the
daemon later, pass a new token, since tokens expire.
Rigs that create rigs
Each user’s rig gets its own credential,AMIKA_RUNTIME_TOKEN, so code on the
rig can call Amika. With it, the rig can create more rigs for the same user,
and connect to, stop, start, and delete the rigs it created. It can stop and
delete itself, but it can’t start itself or reach the user’s other rigs.
Amika replaces the credential each time the rig starts.
To create a rig with no credential, pass "rig_credential": "none". A
bare-metal rig never gets one.
Find users’ rigs in your organization
Your team’s rig, host, and snapshot lists show only your organization’s own resources by default. To see users’ resources, passowner=end_user or
owner=any. Each resource has an owner field that names the user.
- HTTP API
- TypeScript SDK
org:access here, not your act-as key.
Remove a user’s access
When a user leaves, disable them. The TypeScript SDK has no call for this yet, so use the HTTP API.502, call it again to finish.
Sharing a rig between users isn’t available yet. Today each rig belongs to one
user.