`fly ssh console` error connecting to SSH server

Hi. I etablished a SSH cert, issued a new SSH credential and could connect to my instance.
I tried running bin/rails c in the root of my app. It hung and I kill -9 the process because nothing else worked.

Now, whenever I try to fly ssh console -a myappname I get this:

❯ fly ssh console -a myappname
Connecting to top1.nearest.of.myappname.internal... complete
Error error connecting to SSH server: connect tcp [tcp-address-stuff-i-guess:2]:22: operation timed out

What can I do?

Hey there – for how long has this behavior persisted? If the instance exited after you killed the rails process, it’s definitely possible that fly ssh console wouldn’t work for a bit, as a new instance is spun up (or if the existing instance keeps crashing).

A few commands that might come in handy for digging into this: fly status --all will display all instances over the past 7 days; fly logs -i and fly vm status <alloc-i> will give you more detailed info per-instance

If it’s been more than a few minutes you might have luck with restarting the fly agent with fly agent restart.

Thanks for your quick feedback, @eli. I had to work on some other stuff within the app and made some subsequent deploys. It works again, now.

But I’ll keep this handy, in case it comes up again.


1 Like

It seems that the ssh command sometimes tries to connect to an instance that isn’t running anymore.

A possible workaround is explicitly specifying an instance ID.

  1. Run fly status -a <app> to obtain an instance ID
  2. fly ssh console -a <app> -s <instance-id>
1 Like