AWS AMI available for testing

Not sure if this is a good palce to post this… I keep getting dropped from my ssh connection to my instance of the AMI, with “Connection reset by (whatever the current IP address is) port 22”. Is there any solution to this?

I am not sure if this is directly related to your question. But I use a program called tmux that you can run in the ami…Just type tmux. It will give you a new terminal there and that’s always on even if your ssh connection is lost. So I run Jupyter notebook inside the tmux session and you can re-connect to the notebook and continue from there. I am not sure if it’s directly related, just sharing my process. When I reconnect, I just run tmux a (Attach to the running session that I was dropped from). Here’s more hints, if you choose to use tmux - https://robots.thoughtbot.com/a-tmux-crash-course

If this doesn’t help your question, just reply back and I am sure someone else might have other suggestions.

2 Likes

Well, this time I tried reconnecting, in order to follow your advice and run tmux, it connects, but but now I am getting these error messages continuously:

channel 3: open failed: connect failed: Connection refused
channel 4: open failed: connect failed: Connection refused

This is not the first time I have experienced getting my connection dropped, but the Open failed message is new…

I am going to reset the server and try again.

This might be because you are tunneling port 8888, but there’s no application running at that port in your remote AWS server. You may need to start Jupyter Notebook there. try jupyter notebook list and see if you see any currently running servers.

One other option might be is to stop your computer from going to sleep. May be that also drops the networks connections when you don’t use your computer for few minutes. Check your energy saver settings.

1 Like

THanks for replying Ramesh.

My “Sleep” setting is never. I couldn’t see anything obvious in advanced settings.

Regarding whether I have Jupyter Notebook running - I already did have it running, it was in the middle of a session of editing that it happened. However I was inactive for some minutes so even though I have no Sleep setting, maybe something I don’t easily see in the settings made this happen. I note that I had a message in the terminal about notebook1 not being trusted, which was the last message before the disconnect…

Ok…If you are still getting disconnected, it might be worthwhile to open up port 8888 on your AWS Server and directly connect to it via the Browser.

Configure Jupyter to accept connections from everywhere - $jupyter notebook --generate-config

  • To create a password run $jupyter notebook password

Then update the config via -

$echo "c.NotebookApp.ip = '*'" >> $HOME/.jupyter/jupyter_notebook_config.py
$echo "c.NotebookApp.open_browser = False" >> $HOME/.jupyter/jupyter_notebook_config.py

Then if the port 8888 is open and you run jupyter notebook in your tmux session, you can access it from browser via the http://:8888 and you are no longer bound to your ssh connection. You can even remove the tunneling from your ssh connection.

1 Like

Thanks. I will give this a try. Should I have a static IP address on the server for this to work?

Regarding tmux. I actually read this crash course and tried tmux out, but I really don’t understand how to manage it. All that happened is that my terminal window was now a tmux window, but I couldn’t figure out how to make another window. Is there a magic key combination to activate “command mode” like in the vi editor?

Yes, there is! By default it is ctrl+b follow by c. ctrl+b followed by number will take you to a specified pane. ctrl+b followed by x kills a pane.

1 Like

If you press ‘ctrl+b’ followed by ‘?’ then it will display you help pane with all key shortcuts. You can exit it by pressing ‘q’ key

2 Likes

Speaking of Tmux on the official AWS AMI, does anybody know how to copy/paste text between Tmux and the local Ubuntu clipboard?

Thanks for sharing.

On the fastai AWS AMI, tmux mouse mode is enabled, so hold down shift while selecting to copy to your local clipboard.

Hey… Did you get that resolved? I’m not sure how to go about that.

It’s only necessary on crestle, where you won’t get that error.

ah, thank you.

Thank you! I had previously checked a couple of Tmux ninja-cheat sheets without finding any hint about this shift-mouse combination

Hi @ramesh, thought I would try this, but stuck on first base. Can you send instructions on adding port 8888? Is this screen snapshot here what I should be doing?

Hi Chris - This is right. Once you update your security group with the 8888 port set to open as you have above, the instance will be able to receive and send on port 8888. Then run the previous commands I listed - AWS AMI available for testing and it should allow you to access the Jupyter notebook via the browser.

http://<ec2 address>:8888

Make sure you run jupyter notebook inside a tmux session. That way the notebook keeps running even if your ssh session gets disconnected.

All working as you described - thank-you very much for such clear and thorough instructions! :smiley: