How to stop a specific instance?

From what I see, I can see list of instances somehow but not restart/suspend/remove it. The scaling down can also take down a random instance that’s busy making some calculation.

To make things worse, I see autoscale is marked as deprecated and no normal way to access the api to handle this matter with my own implementation.

There’s no way to stop a specific instance. Usually scaling the count down will stop the newest one.

Your best bet is to scale down, but make sure your app drains gracefully: https://fly.io/blog/graceful-vm-exits-some-dials/

Autoscaling uses the same mechanism as flyctl scale count <x>, so you’d want graceful drains either way!

How about shutting down an instance from inside the instance?

Our supervisor will just restart it in that case. :slight_smile:

What are you trying to do with these? Right now, we don’t give very granular control over VMs, but we are working on some features to quick launch and exit specific VMs for one off work. There’s a chance we’ll be able to solve this for you soon.

2 Likes

Yes, I’m talking about none off work with some autoscale to have it as an alternative for lambda with “infinite timeout”. If this is implemented properly, fly.io can be a game changer for serverless. :grin:

The only way I see right now is to close the vm from inside and then a new one will be created but I can probably scale it down as the newest one will be destroyed as per your reply.

Seems a bit weird workaround but at least it will work if the scaling up/down doesn’t take much time.