Reputation: 2048
I have set up an AWS account on their free tier and after installing Anaconda and Jupyter Notebooks I am unable to connect to Jupyter notebooks through my browser. I get the below screen:
The process I have gone about t set this up is mostly summarised at the link below:
There are a few changes I have made to the above medium article process due to it not working. The main one is that my certificate has the below commands in it
# Configuration file for jupyter-notebook.
c = get_config()
# Notebook config this is where you saved your pem cert
c.NotebookApp.certfile = u'/home/ubuntu/certs/mycert.pem'
# listen on all IPs
c.NotebookApp.ip = '0.0.0.0'
# Allow all origins
c.NotebookApp.allow_origin = '*'
# Don't open browser by default
c.NotebookApp.open_browser = False
# Fix port to 8888
c.NotebookApp.port = 8888
Everything seems to go as expected until I get to typing the necessary link in the browser. When I type Jupyter notebooks into my console I get the below (X's are alpha- numerics I don't think I should share):
[I 07:28:56.291 NotebookApp] Writing notebook server cookie secret to /run/user/1000/jupyter/notebook_cookie_secret
[I 07:28:57.297 NotebookApp] JupyterLab extension loaded from /home/ubuntu/anaconda3/lib/python3.7/site-packages/jupyterlab
[I 07:28:57.297 NotebookApp] JupyterLab application directory is /home/ubuntu/anaconda3/share/jupyter/lab
[I 07:28:57.299 NotebookApp] Serving notebooks from local directory: /home/ubuntu
[I 07:28:57.299 NotebookApp] The Jupyter Notebook is running at:
[I 07:28:57.299 NotebookApp] https://(ip-XXX-XX-XX-XXX or XXX.X.X.X):8888/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[I 07:28:57.299 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 07:28:57.303 NotebookApp]
To access the notebook, open this file in a browser:
file:///run/user/1000/jupyter/nbserver-29637-open.html
Or copy and paste one of these URLs:
https://(ip-XXX-XX-XX-XXX or XXX.X.X.X):8888/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
In the browser as well as typing what the tutorial says:
https://XXX-X-XX-X-XXX.us-east-2.compute.amazonaws.com:8888
I have also tried the below:
https://XXX-X-XX-X-XXX.us-east-2.compute.amazonaws.com
https://(ip-XXX-XX-XX-XXX or XXX.X.X.X):8888/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
https://ip-XXX-XX-XX-XXX:8888/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
https://ip-XXX.X.X.X:8888/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
None of these seem to work.
If anyone has any suggestions it would be greatly appreciated.
Thanks
Edit
After recreating the instance and this time putting the security setting to All Traffic rather than just SSH (Thanks to Lamanus) the browser now just continually trying to connect while the console gives the the output below:
Exception in callback BaseAsyncIOLoop._handle_events(5, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(5, 1)>
Traceback (most recent call last):
File "/home/ubuntu/anaconda3/lib/python3.7/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/platform/asyncio.py", line 138, in _handle_events
handler_func(fileobj, events)
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/netutil.py", line 273, in accept_handler
callback(connection, address)
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/tcpserver.py", line 288, in _handle_connection
do_handshake_on_connect=False,
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/netutil.py", line 605, in ssl_wrap_socket
context = ssl_options_to_context(ssl_options)
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/netutil.py", line 574, in ssl_options_to_context
ssl_options["certfile"], ssl_options.get("keyfile", None)
PermissionError: [Errno 13] Permission denied
Exception in callback BaseAsyncIOLoop._handle_events(5, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(5, 1)>
Traceback (most recent call last):
File "/home/ubuntu/anaconda3/lib/python3.7/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/platform/asyncio.py", line 138, in _handle_events
handler_func(fileobj, events)
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/netutil.py", line 273, in accept_handler
callback(connection, address)
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/tcpserver.py", line 288, in _handle_connection
do_handshake_on_connect=False,
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/netutil.py", line 605, in ssl_wrap_socket
context = ssl_options_to_context(ssl_options)
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/netutil.py", line 574, in ssl_options_to_context
ssl_options["certfile"], ssl_options.get("keyfile", None)
PermissionError: [Errno 13] Permission denied
Upvotes: 0
Views: 2391
Reputation: 2048
I worked it out with some help from Lamanus.
As i said in my edit I had to recreate my instance making sure to change the security settings from SSH to All Traffic.
Then the next time I activated my terminal I had to go to the certs folder and modify some of the certificates with the below commands:
cd certs
sudo chmod 777 mycert.pem
After that I went to a screen where it asked me for a token. The one I provided was the token the console provided me on the end of the below
https://ip-XXX-XX-XX-XXX:8888/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
So I copied and pasted the xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx part into the token area.
Thanks
Upvotes: 1