Skip to content

Instantly share code, notes, and snippets.

@shaystrong
Last active August 28, 2016 02:34
Show Gist options
  • Save shaystrong/e66719ddb809fed124067ee6d558bb8a to your computer and use it in GitHub Desktop.
Save shaystrong/e66719ddb809fed124067ee6d558bb8a to your computer and use it in GitHub Desktop.
jupyter notebook on EC2

##Using Jupyter Notebook with AWS EC2 Thanks to http://blog.impiyush.me/2015/02/running-ipython-notebook-server-on-aws.html #Ensure your EC2 aws security settings are set appropriately: SSH TCP 22 Anywhere HTTPS TCP 443 Anywhere CustomTCPRule TCP 8888 Anywhere

#Create a sha1 key for ipython:

$ ipython
In [1]:from IPython.lib import passwd
In [2]:passwd()

the return will be an sha1 key. Note it for reuse.

$ jupyter notebook --generate-config

$ mkdir certs
$ cd certs
$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem
$ cd ~/.jupyter/
$ vi jupyter_notebook_config.py

Edit the file:

c = get_config()

# Kernel config
c.IPKernelApp.pylab = 'inline'  # if you want plotting support always in your notebook

# Notebook config
c.NotebookApp.certfile = u'/home/ubuntu/certs/mycert.pem' #location of your certificate file
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False  #so that the ipython notebook does not opens up a browser by default
c.NotebookApp.password = u'sha1:68c136a5b064...'  #the encrypted password we generated above
# It is a good idea to put it on a known, fixed port
c.NotebookApp.port = 8888

#Start the noteboook server

$ cd ~
$ mkdir Notebooks
$ cd Notebooks
$ jupyter notebook  (or in the background: nohup jupyter notebook &)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment