Skip to content

Projects, tokens and SSH keys

Everything in Hetzner Cloud lives inside a project: Servers, volumes, networks, firewalls, IP addresses and the tokens that manage them. Nothing in one project can see another.

An API token is created inside a project, under Security → API tokens, and reaches only that project. So the token is how you choose where Alchemy deploys. Give it Read & Write access, so Alchemy can create resources, and store it in a profile:

Terminal window
alchemy profile edit --add Hetzner

See Setup for the details.

Because a token reaches one project, separate projects give you hard isolation. Use one for production and another for everything else, each with its own token and profile:

Terminal window
alchemy profile create prod
alchemy profile edit --profile prod --add Hetzner
alchemy deploy --stage prod --profile prod

Many stages can share the development project, each with its own Servers.

A Server is a whole machine, and you sign in to it over SSH. An SSH key registers your public key with the project, so Servers created with it accept your key, and never a password:

alchemy.run.ts
const key = yield* Hetzner.SshKey("deploy", {
publicKey: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI… you@laptop",
});

See Servers for attaching keys to a Server.

With CI=true, Alchemy skips the profile and reads HCLOUD_TOKEN from the environment. See CI.