Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can not Connect to Jupyter Notebook on AWS EC2 Instance

Tags:

I'm running Ubuntu 14.04 LTS on an AWS EC2 instance. I'm trying to connect to Jypter in Safari from my MacBookPro. I opened https port 443 and TCP 8888 in my security group.

ubuntu@ip-10-0-1-62:~$ netstat -a  | grep 8888 tcp        0      0 localhost:8888          *:*                     LISTEN      tcp        0      0 localhost:8888          localhost:36190         TIME_WAIT   ubuntu@ip-10-0-1-62:~$ netstat -a  | grep 443 unix  3      [ ]         STREAM     CONNECTED     12443     ubuntu@ip-10-0-1-62:~$  

I can't connect to Jupyter from my Safari browser on my Mac. (I can connect to Tensorboard on port 6006).

ubuntu@ip-10-0-1-62:~$ jupyter notebook [W 20:40:14.909 NotebookApp] Unrecognized JSON config file version, assuming version 1 [I 20:40:14.921 NotebookApp] Writing notebook server cookie secret to /run/user/1000/jupyter/notebook_cookie_secret [I 20:40:15.224 NotebookApp] JupyterLab alpha preview extension loaded from /home/ubuntu/anaconda/lib/python2.7/site-packages/jupyterlab [I 20:40:15.230 NotebookApp] Serving notebooks from local directory: /home/ubuntu [I 20:40:15.230 NotebookApp] 0 active kernels  [I 20:40:15.230 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/?token=c08a71a48c6e159bdbdcc95837c4e2e053349382c681899b [I 20:40:15.231 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 20:40:15.232 NotebookApp]       Copy/paste this URL into your browser when you connect for the first time,     to login with a token:         http://localhost:8888/?token=c08a71a48c6e159bdbdcc95837c4e2e053349382c681899b 

enter image description here

$ telnet 52.8.16.250 8888 Trying 52.8.16.250... telnet: connect to address 52.8.16.250: Connection refused telnet: Unable to connect to remote host $ telnet 52.8.16.250 6006 Trying 52.8.16.250... telnet: connect to address 52.8.16.250: Connection refused telnet: Unable to connect to remote host $ telnet 52.8.16.250 8080 Trying 52.8.16.250... telnet: connect to address 52.8.16.250: Connection refused telnet: Unable to connect to remote host $ telnet ec2-52-8-16-250.us-west-1.compute.amazonaws.com 8888 Trying 52.8.16.250... telnet: connect to address 52.8.16.250: Connection refused telnet: Unable to connect to remote host $ telnet ec2-52-8-16-250.us-west-1.compute.amazonaws.com 20 Trying 52.8.16.250...  telnet: connect to address 52.8.16.250: Operation timed out telnet: Unable to connect to remote host 
like image 915
dbl001 Avatar asked Apr 05 '17 20:04

dbl001


People also ask

Why is my AWS instance not connecting?

The following are common reasons why EC2 Instance Connect might not work as expected: EC2 Instance Connect doesn't support the OS distribution. The EC2 Instance Connect package isn't installed on the instance. There are missing or incorrect AWS Identity and Access Management (IAM) policies or permissions.


1 Answers

Okay, found the issue:

Edit your jupyter configuration:

jupyter notebook --generate-config  vim /home/ubuntu/.jupyter/jupyter_notebook_config.py 

Make sure that

c.NotebookApp.ip = '*' 

Also make sure you opened the relevant security group in your EC2 server (for example port 8888)

Run Jupyter:

jupyter notebook 

Now you can access it remotely with the right port

like image 59
Nathan B Avatar answered Sep 21 '22 12:09

Nathan B