Issue
I have a cloud 9 instance set up on my AWS account. I am using poetry as my package manager and have installed jupyter notebook.
When I run the command poetry run jupyter notebook
it runs as it usually does, but when I press the links they say that the site can't be reached.
Some things I have noticed is that in some AWS documentation there is mention of using port 8080, I have tried that but it doesn't work.
I also see something about http vs https, so could it be that it won't display because the link is not https?
Regardless any help on how to open up a notebook running on the cloud 9 instance would be very helpful, thanks
Solution
When you start a jupyter notebook, by default it will start running on the localhost (http://127.0.0.1:8888
), which implies that the notebook will be running locally and will therefore not be accessible from outside the instance.
As far as I can tell, it's not possible to configure Jupyter to use a public ip address, so that it will be accessible to the internet.
Thus as this stage, the question becomes: how do I use a public ip address to access an application running on a private ip address?
Well, for this you can use an application like localtunnel. From the website:
Localtunnel will assign you a unique publicly accessible url that will proxy all requests to your locally running webserver.
Here's how you can get things working. First of all, configure the security group of the EC2 instance to allow inbound traffic to port 8888 for your IP address.
Then, in the EC2 instance, configure jupyter to allow external connections:
$ sed -i 's/# c.NotebookApp.allow_remote_access = False/c.NotebookApp.allow_remote_access=True/' ~/.jupyter/jupyter_notebook_config.py
then, start the jupyter notebook:
$ poetry run jupyter notebook --port 8888
N.B. take a note of the token, you'll need it later.
Then, install and run localtunnel:
$ npm install -g localtunnel
$ lt --port 8888
this will give you a url like this:
your url is: https://green-wolverine-71.loca.lt
you can now use this url to access the Jupyter Notebook (after you click the "click to continue" button), where you can specify the token to login.
Answered By - Paolo
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.