Remotely Accessing Jupyter Notebooks

Last updated:
Table of Contents

If you want to use a remote server (for example, the AWS Deep Learning AMI), one easy way to do it is to start up a jupyter notebook on the remote server and then set up an SSH tunnel from your machine to the rmeote server, so that you can use that as if it were on your local machine.

Here are the steps to get you started.

SSH to the instance and start Jupyter

On the remote machine do:

use nohup at the beginning and & at the end to stop the server from being killed if you log out

$ nohup jupyter notebook --no-browser --port=8888 &

Set up an SSH tunnel

On your local machine do:

This example uses key-based authentication (the -i flag). You should point to the private key you chose when you initaliazed the EC2 instance.

$ ssh -i ~/.ssh/my-private-key.pem -N -f -L localhost:8889:localhost:8888 my-user-name@my-remote-server
Twitter Linkedin YC Hacker News Reddit

Open the local url

If you used the example line above to set up the tunnel, you need to open your browser at http://localhost:8889.

jupyter notebook Enter the Token that was output on the log
when you started Jupyter on the remote server

After inserting your token, you should be able to use Jupyter:

jupyter-noteboo-remote Great Success!


Dialogue & Discussion