Jupyter Deep Learning AMI - amazon-web-services

I am having trouble setting up Jupyter Notebook in my EC2 Instance (Deep Learning AMI Linux). I followed the tutorial from this link. Imanaged to finish all without any problems except launching the notebook. In the SSH terminal, after I inputed the jupyter notebook command, it says my notebook is running in https://ip-172-*-*-*:8888/, but when I opened that link, it just says the site can't be reached. Same problem when I inputed my instance's public DNS with :8888 at the end.
Can someone tell my what I might be doing wrong?
Please help. Thank you in advance!

I havae found the solution, it turns out the links didn't specify that the EC2 instance has to allow HTTPS connection. So, I added a Custom TCP Rule, with prot range 443, and Souce 0.0.0.0/0 to the security group.

I can suggest you the following procedure:
jupyter notebook --ip=0.0.0.0 --no-browser
Access jupyter notebook index from your web-browser by visiting:
<IPv4 public IP address displayed on EC2 Dashboard> :8888/?token=...
Hope this helps.

Related

AWS Jupyter notebook can't find runnable browser - EC2 Ubuntu

Let me give the necessary context:
Security group details for Instance:
Jupyter Notebook Config File Snapshot:
When I run jupyter notebook this is what I get
And I cant connect to the Instance as I am getting this error:
Not sure what I am missing out or doing wrong. Any help would be appreciated.
You can run it in a headless mode, without browser:
jupyter notebook --no-browser
Then you can access it from your local workstation. Preferably over ssh tunnel for security reasons, rather then directly.

GCP VM instance hosted Website showing connectino refused error message

I am trying to fix a website that is hosted on Google Cloud Platform using VM instance. The website is giving me a connection refused error message. I have checked that the firewall rules are set up and are provided to the VM instance.
The VM external IP is static and the same IP is present on both cloud DNS and GoDaddy.
I'm also unable to SSH into the instance.
The SSH screen is stuck here and is not loading any further
I have given the necessary permissions to the instance and the user (Compute Admin, Compute Instance Admin (v1)), but still no luck.
As the instance is created from a custom image, so later, I tried creating another instance with the same config and I was able to SSH from it. So, please find some screenshots attached below if those could be of any help
netstat -a
route -n
df -h
I am new to this so any help to fix the issue and get the website up and running would be highly appreciated.
If it worked at the second attempt (2nd Instance I mean), I suspect that the SSH service hasn't started properly. I would recommend you to check the Serial Port Output, and Accessing into the Instance through the serial port in order to be able to troubleshoot it.
Note that you'll need a user to access through the serial port. If you don't have any user created, you will be able to do so using an startup-script.
Hope this helps!

How to start jupyter notebook on AWS

I am a beginner for Amazon Ec2 and recently I successfully ssh to EC2 instance. yet when I tried to activate jupyter before ssh:
jupyter notebook --no-browser --port=8888
I get the message:
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=????????????????????
I copied the URL as instructed to the browser (chrome and safari), but it did not work. How could I proceed to ssh jupyter notebook? Thanks!
I hope you just didn't copied the link as it is (locahost), it is running on ec2, not on your computer. So change the server name to IP address of your EC2 instance (assuming you allowed traffic on correct ports)
There are a few guides how to access jupyter notebooks on remote servers, e. g. see
https://jupyter-notebook.readthedocs.io/en/stable/public_server.html#notebook-public-server
If you are just playing along and don't care about security in this case, you may just update the binding IP in your jupyter_notebook_config.py :
c.NotebookApp.ip = '*'
You can start the jupyter server using the following command:-
jupyter notebook --ip=*
If you want to keep it running even after the terminal is closed then use:-
nohup jupyter notebook --ip=* > nohup_jupyter.out&
Remember to open the port 8888 in the AWS EC2 security group inbound to Anywhere (0.0.0.0/0, ::/0)
Then you can access jupyter using http://:8888
Hope this helps.

Is it possible to grant multiple users to Jupyter notebook?

I am working on a project in an EC2 isntance using jupyter notebook. It seems like jupyter notebook does not allow multiple ssh to its server at the same time, I have to log out if other people want to connect to jupyter notebook through the instance. Is it possible to make multiple access to jupyter notebook from the same instance?
Create/update jupyter_notebook_config.py file in ~/.jupyter folder with the below code. All jupyter notebook command calls post this file creation will infer configuration from the file.
from notebook.auth import passwd
c = get_config()
c.NotebookApp.open_browser=False
c.NotebookApp.ip='*' # Allows access from anywhere
c.NotebookApp.port=8885 # Jupyter runs in port 8885
c.NotebookApp.password=passwd('jupyter') # Password to access notebooks
Make sure you've opened 8885 (or any other port of your choice mentioned in the configuration file) allows connection requests from outside (update EC2 security groups appropriately). Not sure if you've tried this or what the issue at your end is but this works for me.
The juypter notebook is installed on a server in this case an EC2 machine.
Any number of people can SSH into this machine if they have the credentials using putty or some ssh client, this has no connection with jupyter notebook.
(assuming that the SSH port 22 is open for the other users and they are able to connect)
When you launch the jupyter notebook using the jupyter notebook command -> you start a local instance of the jupyter notebook on the default port (maybe 8888)
you will have a URL for this notebook interface and you can work on it.
Important to note -> This is a local instance of your notebook. It is not public and can only be accessed on your OS username as a localhost.
If other OS users run the jupyter notebook command they will get their local version of the notebook on a different port (maybe 8889 by default as the port number 8888 is already in use by you )
You can make your notebook public and then you will get a public URL for your notebook (serverip:8888 or the port you have specified)
This public link can be shared with others. Now multiple people have visibility to your notebook and can edit code in your notebook.
p.s -> for public notebooks the port in which you are running the notebook needs to accept connections from AWS end. This can be configured in AWS console under the security groups tab

How to connect same AWS EC2 instance from work and home?

I have EC2 instance running in AWS. I can access it using SSH client and private key at work. Now, I want to connect to same instance from home using Ubuntu 18.04 OS. So I copied the private key and tried using SSH commands from ubuntu terminal. But I didn't work and AWS was saying that access is denied.
I am not good with networking and security stuff. Can anyone help me on how I can access my AWS EC2 instance from ubuntu at home?
I managed to get it working finally. I went to the directory location where the key file is stored on Ubuntu terminal and then typed chmod 400 <yourPrivateKey.pem> and hit enter. Nothing happened. Then type SSH command to connect to my AWS EC2 instance. That's it, I got connected. Now, I really don't know what has happened there and how secure it is to connect this way. Any help is much appreciated.
Thanks.