Accessing your deep learning cloud environment

We don't really want to sit and code in the Terminal on the server all the time. Since we want to leverage Jupyter Notebooks for interactive development, we will access the Notebooks on our cloud server from our local system. For this, we first need to kickstart our Jupyter Notebook server on our remote instance.

Log in to your virtual server and start the Jupyter Notebook server:

[DIP.DipsLaptop]> ssh -i my-dl-box.pem [email protected]
===================================
Deep Learning AMI for Ubuntu
===================================
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-121-generic x86_64)
Last login: Sun Feb 25 18:23:47 2018 from 10x.xx.xx.xxx

# navigate to a directory where you want to store your jupyter notebooks
ubuntu@ip:~$ cd notebooks/
ubuntu@ip:~/notebooks$ jupyter notebook
[I 19:50:13.372 NotebookApp] Writing notebook server cookie secret to /run/user/1000/jupyter/notebook_cookie_secret
[I 19:50:13.757 NotebookApp] Serving notebooks from local directory: /home/ubuntu/notebooks
[I 19:50:13.757 NotebookApp] 0 active kernels
[I 19:50:13.757 NotebookApp] The Jupyter Notebook is running at: https://[all ip addresses on your system]:8888/
[I 19:50:13.757 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

We now need to enable port-forwarding on our local instance for accessing our server Notebooks from the browser of our local machine. Leverage the following syntax:

sudo ssh -i my-dl-box.pem -N -f -L local_machine:local_port:remote_machine:remote_port [email protected]

This will start forwarding your local machine's port (8890, in my case) to port 8888 of the remote virtual server. The following is what I used for my setup:

[DIP.DipsLaptop]> ssh -i "my-dl-box.pem" -N -f -L localhost:8890:localhost:8888 [email protected]

This is also known as SSH tunneling. Thus, once you start forwarding, head over to your local browser and navigate to the localhost address, https://localhost:8890, which we are forwarding to the remote Notebook server in our virtual server. Make sure that you use https in the address, otherwise you'll get an SSL error.

If you have done everything correctly so far, you should see a warning screen in your browser, and if you follow the steps depicted in the following screenshot, you should see the familiar Jupyter user interface that comes up whenever you work on any Notebooks:

You can safely ignore the Your connection is not private warning; it shows up because we generated the SSL certificate ourselves and it hasn't been verified by any trusted authority.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset