Wow, this works. Thanks a lot Diego.
I had this problem too and did some investigation.
If @dmenin 's port forwarding solution works, that can mean that even though your security group is set to listen on the right ports, jupyter isn’t. (That’s what it meant for me.)
I verified this by running
sudo netstat -nltp, which returned this:
$ sudo netstat -nltp Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1177/sshd tcp 0 0 127.0.0.1:8888 0.0.0.0:* LISTEN 1859/python
The first line is for ssh (port 22). The
0.0.0.0 means it listens for ssh on any IP. The second line is for port 8888, but there it only listens on its localhost IP,
If you want to dig further you can run
ifconfig and you will probably see two another IP. For me it’s 10.0.0.10, which must be somehow magically mapped back to my “elastic IP” from AWS.
OK so to solve it you make jupyter notebook listen on both its IPs. I used this stackoverflow solution, which says to: check for jupyter notebook configuration file, in ~/.jupyter/ . If it’s not there, run
jupyter notebook --generate-config. Then open the file in an editor and find the line to edit about IPs.
Then I realized that a better solution was to find the fast ai config file, which I found here (no guarantees that it’s up to date though):
Have the same problem, can’t connect to the jupyer notebook…
This worked for me as well! I had to figure out
<user@instance> were. For posterity,
<your_key> is the private key you created as part of a keypair to connect to AWS. You can follow this tutorial. In my case,
user@instance is the user and public IP address of your amazon AWS instance. In my case, this meant
firstname.lastname@example.org.***.***. Stars are for redaction.
In sum, my command was
ssh -i id_rsa email@example.com.***.***-L8888:localhost:8888. Hope this helps!
Solution for the same problem in Google Cloud
I had the exact same problem with Jupyter Notebooks in Google cloud. Everything was installed properly and things like firewall rules and the jupyter config file were all set properly, but it just wasn’t working.
The solution provided by @dmenin for AWS worked for me on Google Cloud too. Here’s the equivalent command (on your own pc/mac) -
gcloud compute ssh --ssh-flag="-L 8888:localhost:8888" --zone "<name-of-zone>" "example_instance_name"
For example, my command was-
gcloud compute ssh --ssh-flag="-L 8888:localhost:8888" --zone "asia-east1-b" "fastai-instance-1"
You can replace 8888 with whatever port number you’ve set.
Also posting my jupyter config file’s important lines here -
c.NotebookApp.password = '<my-key>' c.NotebookApp.ip = '0.0.0.0' c.NotebookApp.open_browser = False c.NotebookApp.allow_remote_access = True c.NotebookApp.port = 8888 c.NotebookApp.allow_origin = '*'
Worked for me, eventually. Thanks!