Skip to content

Configuration โ€‹

spore.host reads configuration from three sources, in order of precedence (highest first):

  1. CLI flags โ€” --ttl 8h, --idle-timeout 1h
  2. Defaults file โ€” ~/.spawn/config.yaml
  3. EC2 tags โ€” set on the instance at launch, read by spored at startup

Defaults file (~/.spawn/config.yaml) โ€‹

Manage with spawn defaults:

sh
spawn defaults set <key> <value>
spawn defaults unset <key>
spawn defaults list

Available keys โ€‹

KeyCLI flagDescription
slack-workspace--slack-workspaceSlack workspace ID for chat notifications (experimental, not part of 1.0; needs a self-hosted spore-bot)
active-processes--active-processesProcess names that keep an instance alive (comma-separated)
active-ports--active-portsTCP ports whose connections are counted and reported (comma-separated). They don't prevent idle
idle-timeout--idle-timeoutDefault idle timeout duration โ€” stops the instance when idle
hibernate-on-idle--on-idle hibernateHibernate instead of stopping on idle (true/false)

File format โ€‹

The file is YAML. You can edit it directly at ~/.spawn/config.yaml:

yaml
dns:
  enabled: true
  domain: spore.host

defaults:
  idle_timeout: 1h
  active_processes: rsession
  hibernate_on_idle: false

Shared spore.host settings (~/.config/spore/config.toml) โ€‹

The AWS profile, region and expected account for all the spore.host tools live in a separate file, ~/.config/spore/config.toml, overridden by SPORE_PROFILE, SPORE_REGION and SPORE_ACCOUNT and by --profile, --region and --account. When an account is pinned in any of these, spawn refuses to act with credentials for a different account (since v0.135.2). See Profiles and per-tool config and the account guard.

EC2 tags โ€‹

Spored reads its configuration from EC2 tags on the instance at startup. These are set automatically when you use the corresponding CLI flags. You can also set them manually via the AWS console or CLI.

TagSet by flagDescription
spawn:ttl--ttlTime-to-live duration (e.g. 8h, 2d)
spawn:idle-timeout--idle-timeoutIdle timeout duration
spawn:hibernate-on-idle--on-idle hibernatetrue to hibernate instead of stop
spawn:terminate-on-idle(automatic: spawn service, spawn pool, spawn burst)true to terminate instead of stop. Wins over spawn:hibernate-on-idle
spawn:active-processes--active-processesComma-separated process names
spawn:active-ports--active-portsComma-separated TCP port numbers whose connections are counted (they don't prevent idle)
spawn:on-complete--on-completeAction on completion: terminate, stop, hibernate
spawn:completion-file--completion-filePath to watch for completion signal
spawn:completion-delay--completion-delayGrace period before acting on completion
spawn:pre-stop--pre-stopShell command to run before shutdown
spawn:pre-stop-timeout--pre-stop-timeoutMax wait time for pre-stop (default: 5m, Spot: 90s)
spawn:dns-name--name / --dnsDNS label for this instance (not written with --no-dns)
spawn:slack-workspace-id--slack-workspaceChat workspace ID (experimental)
spawn:notify-url(automatic)spore-bot URL for chat notifications (experimental)
spawn:notify-command(automatic)Slash command for workspace routing (experimental)
spawn:idle-cpu(no flag; set the tag)CPU percentage below which instance is considered idle (default 5)
spawn:ttl-deadline(automatic)Absolute RFC3339 termination deadline, set at launch
spawn:managed(automatic)Set to true on all spawn-managed instances

TIP

You can update tags on a running instance and spored will pick up the change on the next check cycle (every 60 seconds). spawn extend updates both spawn:ttl and spawn:ttl-deadline.

TTL vs idle timeout โ€” how they interact โ€‹

These two settings work together but have very different semantics. Understanding the difference is important.

TTL โ€” the hard deadline โ€‹

--ttl 12h sets an absolute termination time: launch time + 12 hours. This deadline:

  • Is computed once at launch and stored in the spawn:ttl-deadline EC2 tag
  • Is never reset by stop/wake cycles โ€” the clock keeps running even while the instance is stopped or hibernated
  • Always terminates when it fires. It isn't the only thing that can terminate the instance: a --cost-limit and --on-complete terminate do too

spawn extend adds time to the current deadline, not to the current clock:

sh
# Instance launched 3h ago with --ttl 12h โ†’ deadline in 9h
spawn extend my-instance 4h   # new deadline in 13h, not 4h from now

Idle timeout โ€” the activity monitor โ€‹

--idle-timeout 30m watches for inactivity and stops the instance when it goes idle (or hibernates with --on-idle hibernate). This timer:

  • Does reset every time the instance wakes up from a stop or hibernate
  • Does not terminate the instance โ€” it only stops/hibernates it. (spawn service instances, pool workers and spawn burst members are the exception: spawn tags them spawn:terminate-on-idle, and they terminate.)
  • Is useful for saving compute costs during quiet periods between tasks
sh
# --ttl: hard deadline, terminates at launch_time + 12h
# --idle-timeout: stops if idle for 30m; resets on each wake
spawn launch --name analysis --instance-type c8a.2xlarge \
  --ttl 12h \
  --idle-timeout 30m

A complete lifecycle โ€‹

T+0h       launch (TTL deadline: T+12h)
T+1h       job finishes, instance goes idle
T+1h 30m   idle timeout fires โ†’ instance STOPS
T+5h       spawn connect โ†’ instance wakes, idle timer resets
T+5h 30m   user disconnects, instance goes idle again
T+6h       idle timeout fires โ†’ instance STOPS again
T+12h      TTL deadline fires โ†’ instance TERMINATES

The TTL ensures the instance is eventually cleaned up. The idle timeout saves money during the gaps.