Machines
Every ix machine is the same size, and the size is large: 100 vCPUs, 256 GiB of memory and 1 PiB of disk. You never pick an instance type.
Each machine has its own kernel, and the operating system inside is yours to choose. To fit more machines on one host, boot one with fewer vCPUs: ix new --cpus 8 or cpuCores: 8 in the SDK. The count must be 2, 4, 8, 16, 32 or 64. The price does not change with the size. The meters count use.
ix new --name build --no-shell
ix stop build # only the disk bills
ix start build # the disk is as it was
ix rm build # nothing billsEphemeral and persistent
A machine is persistent by default. lifetime: "ephemeral" removes it when the scope ends. A ttl makes the platform remove it at the deadline. Leaving the scope of a persistent machine never removes it.
const ix = new Client()
// Ephemeral: removed when the scope ends.
await using scratch = await ix.machines.create({ lifetime: "ephemeral" })
// A deadline: the platform removes it after 20 minutes,
// even if this process dies first.
const ci = await ix.machines.create({
ttl: "20m",
name: "ci-run-418",
})
// Persistent, the default: scope exit only releases the handle.
await using dev = await ix.machines.create({ name: "dev" })
const again = await ix.machines.connect("dev")Architecture and CPU
arch is "x86_64" or "arm64". cpu is "epyc-5" or "graviton-5" and implies its architecture. Leave both unset and the platform picks.
// Any ARM host.
await using a = await ix.machines.create({ arch: "arm64", lifetime: "ephemeral" })
// One host class: the full instruction set of that CPU.
const g = await ix.machines.create({ cpu: "graviton-5", name: "bench" })A snapshot or fork keeps the architecture of its machine and never moves to another. A machine pinned with cpu restores only on the same CPU class. A pair that contradicts itself, such as arch: "arm64" with cpu: "epyc-5", fails with invalid_argument.
Live output
machine.exec starts the command and returns a Process at once. Await it for the result, or read stdout and stderr while it runs. Dropping the Process stops the command. The SDK reference lists every member.
// exec returns at once. Read the output while it runs.
const proc = machine.exec(["npm", "test"])
for await (const chunk of proc.stdout) process.stdout.write(chunk)
const { exitCode } = await proc
// Write to stdin.
const sort = machine.exec(["sort"], { stdin: true })
await sort.stdin.write("b\na\n")
await sort.stdin.close()
console.log((await sort).stdout)
// Stop a command.
const slow = machine.exec(["sleep", "600"])
setTimeout(() => slow.kill(), 5000)
await slow