AWS EC2: Start a Jupyter (IPython) Notebook Server

Michael Galarnyk
2 min readDec 23, 2016

--

If you are having trouble following this tutorial or want to use JupyterHub on AWS, I made an updated tutorial (YouTube, blog).

A while ago, I wrote a post, “Setup and use Jupyter Notebook (IPython) Notebooks on AWS”. While that approach benefits from being easy to setup, but requires you to have key to access. This approach allows for multiple people to access the server with just a password. With that, let’s just started.

If you get lost, I recommend opening the video in a separate tab.

  1. Install Anaconda. If you don’t have it installed already, please see AWS EC2: Install Anaconda on Linux Instance.
  2. ssh to your EC2 instance. If you don’t know how to do this, please see the tutorial AWS EC2: Connect to Linux Instance using SSH.
ssh -i /path_to_key/my_key.pem user_name@public_dns_name

2a. Type ipython into the terminal. This will open ipython.

2b. The following lines are used for password authentication to the jupyter server we will launch.

from IPython.lib import passwdpasswd()
Out[2] will be different for you. It depends on what you enter for your password.

2c. After you verify your password, Be sure to save the output.

2d. Type exit() to exit out of ipython

3. In the terminal, type

jupyter notebook --generate-configmkdir certscd certssudo openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pemcd ~/.jupyter/nano jupyter_notebook_config.py

4. Type

c = get_config()c.IPKernelApp.pylab = 'inline'c.NotebookApp.certfile = u'/home/ubuntu/certs/mycert.pem'c.NotebookApp.ip = '*'c.NotebookApp.open_browser = False# Your password below will be whatever you copied earlier
c.NotebookApp.password = u'sha1:941c93244463:0a28b4a9a472da0dc28e79351660964ab81605ae'
c.NotebookApp.port = 8888

5. Exit out of the .py file and type the following into the terminal

nohup jupyter notebook

6. To access your server, enter

https://ip-address:port/

There is also alternative approach to do roughly the same thing here that I would recommend if you can’t get this to work for you. Please let me know if have any questions either here or on youtube.

--

--