Skip to content

Regions and runners

A region is where sandboxes run, such as us or eu. Inside a region, runners are the machines that host sandboxes, and Daytona’s scheduler places each new sandbox on one. Daytona runs shared regions for every organization. An organization allowed to bring its own compute can add a custom region: Daytona still runs the API and the scheduler, and the runners are machines you operate.

A sandbox runs in its organization’s default region unless it sets target. Changing target replaces the sandbox.

src/DevBox.ts
import * as Daytona from "@alchemy.run/daytona";
import { Base } from "./Images.ts";
export const DevBox = Daytona.Sandbox("DevBox", { snapshot: Base, target: "eu" });

Set the organization’s default with defaultRegionId on OrganizationSettings.

src/Compute.ts
import * as Daytona from "@alchemy.run/daytona";
export const Home = Daytona.Region("Home", {
proxyUrl: "https://proxy.daytona.example.com",
sshGatewayUrl: "ssh.daytona.example.com:2222",
});

Daytona shows the region’s proxy and SSH gateway keys only when it creates or rotates them, so Alchemy keeps them in state. Bump a counter in rotate, like rotate: { proxyApiKey: 1 }, to rotate one.

src/Compute.ts
export const Box1 = Daytona.Runner("Box1", { region: Home });

Box1.apiKey is the key you start the runner daemon with on your machine.

src/Compute.ts
export const Box2 = Daytona.Runner("Box2", { region: Home });
export const Box2 = Daytona.Runner("Box2", { region: Home, draining: true });

A draining runner takes no new sandboxes, and its sandboxes move off. unschedulable: true only stops new ones. Both change in place.