Waking an EC2 host on demand and stopping it after an idle lease and activity fence Draft
A shared EC2 host should cost almost nothing while nobody needs it, and still accept work within about a minute. Always-on is simple but expensive. Stop-on-idle is cheap but races with new work. The design that stuck starts from four hard constraints: keep waiting jobs in the database, distinguish auto-stop from manual stop, seal admission on the host before StopInstances, and never replay an engine write while the VM is waking.