Skip to main content

Sailboxes vs. EC2 On-Demand: autosleep and billing

A sleeping Sailbox keeps its memory and files. A standard Sailbox can sleep after at least 30 seconds of idle time by default. The next command or file operation wakes it. Sail stops charging for CPU, RAM, and local disk during sleep. Separate Sail volumes still have storage charges. AWS charges the EC2 On-Demand instance rate while the instance runs, even when it is idle. Sail autosleep · Sail pricing · EC2 On-Demand pricing

Create the Sailbox

Install the Sail Python SDK on the machine that runs your controller. Run python -m pip install sail. Sign in with sail auth login. Create one Sailbox per session. This example saves its ID in a local file. In your application, store the ID with the agent session.

Transfer files

Replace SCP with the Sail filesystem API. Run this code from the directory that contains worker.py and job.json. The example worker reads /tmp/job.json and writes /tmp/result.json inside the Sailbox. Use the paths your worker needs.
Sail cannot import an AMI or an EBS snapshot as a Sailbox image. Rebuild the dependencies from your lockfile or Dockerfile. Stop writes before you copy the final data.

Run your existing worker

Replace the SSH command with a Sail SDK call. Use the same Python entry point. On EC2:
On Sail:
EC2 instance roles and private VPC routes do not transfer to Sail. Test AWS authentication and network access from the Sailbox. Let the EC2 worker finish its current jobs before you switch workers.

Reconnect after sleep

An idle Sailbox sleeps automatically by default. Use the saved ID to find the same Sailbox. Read the result file. This operation wakes a sleeping Sailbox.
Sleep preserves files and memory. Termination deletes the Sailbox.

Check the worker output

Run your worker with the same input on EC2 and on Sail. Compare the command output and the files from both runs.