Lifecycle Events โ
Spored emits lifecycle events when significant things happen to a running instance. Events are routed through the spore-bot Lambda to Slack DMs or Teams messages.
Event types โ
| Event | When it fires | Default message |
|---|---|---|
ttl_warning | 5 minutes before TTL expires | โฑ๏ธ name terminates in 5 minutes |
ttl_expired | At TTL expiry | ๐ด name has terminated โ scheduled end time reached |
idle_warning | 5 minutes before idle timeout | ๐ค name will stop in 5 minutes โ no activity detected |
idle_stopped | At idle timeout (default) | โน๏ธ name has stopped โ idle timeout reached |
idle_hibernated | At idle timeout with --hibernate-on-idle | ๐ค name has hibernated โ idle timeout reached |
completion | When spawn:completion-file is detected | โ name has completed |
spot_interrupt | On Spot interruption notice | โ ๏ธ name received a Spot interruption notice |
pre_stop_start | When pre-stop hook begins | ๐ name is running its shutdown task before terminating |
Receiving events โ
Events reach you as Slack DMs or Teams messages. To enable:
- Set
--slack-workspacewhen launching (orspawn defaults set slack-workspace <ID>) - Run
/spore notify <nickname>in Slack to subscribe your user
Without a subscription, events are posted to the channel webhook (if configured) but not sent as DMs.
Warning thresholds โ
The 5-minute warning is fixed. If you need to respond (extend TTL, save work), you have that window. The warning fires once โ subsequent checks within the same warning window don't re-trigger it.
Completion events โ
The completion event fires when spored detects the file at spawn:completion-file (default: /tmp/SPAWN_COMPLETE). After the delay specified by spawn:completion-delay (default: 30s), it executes the action in spawn:on-complete.
Typical pattern:
# At the end of your script
touch /tmp/SPAWN_COMPLETESpored sees the file, sends the completion notification, waits 30 seconds, then terminates the instance.