Here’s how to connect to a remote Jupyter notebook.

Create an ssh tunnel to your remote machine:

ssh -L 8080:localhost:8080 user@

# or use a .pem file to connect to ec2
ssh -L 8080:localhost:8080 -i "aws.pem"

Start Jupyter on that machine in headless mode:

jupyter notebook --no-browser --port=8080

Use a browser to open one of the urls that Jupyter presents: