# ry sandbox

> Short-lived machines for one task each - created from a template, removed at their deadline.

```text
ry sandbox [options] [command]
```

## Subcommands

### `ry sandbox create`

Create a sandbox from `build:<id>` or `app:<name>` and wait until it runs.

```text
ry sandbox create [options] <template>
```

Options:

- `--ttl <duration>`: How long it lives, e.g. 10m, 2h (default 5m, at most 24h).
- `--cpus <n>`: vCPUs (default 1).
- `--memory <mb>`: Memory in MB (default 512).
- `--port <port>`: A further port reachable as `https://<port>-<id>`... (repeatable, at most 8).
- `-e, --env <KEY=VALUE>`: Environment of the sandbox (repeatable) - nothing is inherited from the template app.
- `--public`: Make its URLs public (default: only with a token signed by your org).
- `--readiness <boot|port>`: Up when the VM boots (default) or when its port answers.
- `--idle <duration>`: Sleep after this much idle time (default 5m).
- `--egress <mode>`: Outbound network: allow-all (default), deny-all (nothing, not even DNS) or allowlist.
- `--allow <domain|cidr>`: With an allowlist: a domain (api.example.com, *.example.com) or IPv4 range reachable on 80/443 (repeatable, implies --egress allowlist).

Example:

```bash
ry sandbox create app:web --ttl 30m
```

### `ry sandbox list`

The org's sandboxes that run (with --all: also the ended ones of the last 14 days).

```text
ry sandbox list [options]
```

Options:

- `--all`: Include ended sandboxes.

Example:

```bash
ry sandbox list
ry sandbox list --all
```

### `ry sandbox show`

One sandbox: state, deadline, URLs, machine.

```text
ry sandbox show [options] <id>
```

Example:

```bash
ry sandbox show sbx-1a2b3c4d5e6f
```

### `ry sandbox exec`

Run one command in a sandbox and exit with its exit code (the command goes after --).

```text
ry sandbox exec [options] <id> -- <command> [args...]
```

Options:

- `--timeout <seconds>`: Stop the command after this many seconds (default 60, at most 290; exit code 124).
- `--dir <path>`: Working directory in the sandbox (absolute).
- `-e, --env <KEY=VALUE>`: Env for this command only (repeatable).

Example:

```bash
ry sandbox exec sbx-1a2b3c4d5e6f -- uname -a
```

### `ry sandbox timeout`

Set a sandbox's deadline to now + duration (e.g. 30m) - like E2B setTimeout.

```text
ry sandbox timeout [options] <id> <duration>
```

Example:

```bash
ry sandbox timeout sbx-1a2b3c4d5e6f 1h
```

### `ry sandbox kill`

End a sandbox now - its machine and everything on its disk are gone.

```text
ry sandbox kill [options] <id>
```

Options:

- `-y, --yes`: Skip confirmation (required for automation).

Example:

```bash
ry sandbox kill sbx-1a2b3c4d5e6f
```
