Scale to zero question

You don’t have to explicitly use Fly APIs to stop machines (though, you could); just exiting the process that’s keeping the VM up is all you need to impl (ref).

Finally, the trick we have up our sleeve: it spawns a code-server, with the /project folder open, listening on port 9090—but we don’t expose this port directly. Tired Proxy maps port 8080 to 9090, and if there’s no incoming HTTP connection for $TIME_TO_SHUTDOWN seconds, it exits. That’s it. That’s the whole trick.

From: Fly blog.


Yep. But don’t forget to assign a public-ip to your machine app, though.

Machines are also the spawning ground for new platform features like wake-on-request (also known as scale-to-zero). You can stop a running machine to save on compute costs. It then may be started automatically when a request arrives at the Fly proxy.

From: Fly docs.


Note, flyctl makes is easier to experiment with Fly Machine apps if you are already familiar with regular Fly apps.