Automatically destroy machines after they stop?

Hi!
Right now there isn’t a way to automagically destroy a machine - Instead, when a machine finishes (the process exists with a 0 status code), the machine goes into a “stopped” state - and can be started again quickly.

One other way to go about this is to make the machines re-usable, so they can re-run a task (and thus you wouldn’t need to create a new machine when a new task comes in). The viability of that depends on your use case.

I wonder if a Machine can make an API call to destroy itself against the API when it’s complete? It should be possible but there might be issues with that depending on what you’re orchestrating! For example, it would need to know about a Fly API key to do that.

Edit: Based on your other post, you might be running untrusted user code, so perhaps this isn’t the greatest idea!

1 Like