Menu
Apache MXNet on AWS
Developer Guide

Step 2: Configure Jupyter Notebook on Your EC2 Instance

To configure the Jupyter notebook server on your EC2 instance, you create a configuration file. In the configuration file, you set some of the values to use for web authentication, including the SSL certificate file path, and a password.

Connect to the EC2 instance and then complete the following procedure. If you have set up a cluster of EC2 instances, connect to the master node.

Configure the Jupyter server

  1. Create an SSL certificate.

    Copy
    $ cd $ mkdir ssl $ cd ssl $ sudo openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout "cert.key" -out "cert.pem" -batch
  2. Create a password. You use this password to log in to the Jupyter notebook server from your client so you can access notebooks on the server.

    1. Open the iPython terminal.

      Copy
      $ ipython

      At the iPython prompt, run the passwd()command to set the password.

      Copy
      iPythonPrompt> from IPython.lib import passwd iPythonPrompt> passwd()

      You get the password hash (For example, sha1:examplefc216:3a35a98ed...).

    2. Record the password hash.

    3. Exit the iPython terminal.

      Copy
      $ exit
  3. Create a Jupyter configuration file.

    Copy
    $ jupyter notebook --generate-config

    The command creates a configuration file (jupyter_notebook_config.py) in the ~/.jupyter directory.

  4. Update the configuration file to store your password and SSL certificate information.

    1. Open the .config file.

      Copy
      $ vi ~/.jupyter/jupyter_notebook_config.py
    2. Paste the following text at the end of the file. You will need to provide your password hash.

      Copy
      c = get_config() # Get the config object. c.NotebookApp.certfile = u'/home/ubuntu/ssl/cert.pem' # path to the certificate we generated c.NotebookApp.keyfile = u'/home/ubuntu/ssl/cert.key' # path to the certificate key we generated c.IPKernelApp.pylab = 'inline' # in-line figure when using Matplotlib c.NotebookApp.ip = '*' # Serve notebooks locally. c.NotebookApp.open_browser = False # Do not open a browser window by default when using notebooks. c.NotebookApp.password = 'sha1:fc216:3a35a98ed980b9...'

      This completes Jupyter server configuration.

Next Step

Step 3: Configure the Client to Connect to the Jupyter Server