Skip to content

Instantly share code, notes, and snippets.

@sean-smith
Last active February 15, 2021 23:09
Show Gist options
  • Select an option

  • Save sean-smith/f6bd44f0f9eb785e944e7fd999d7b076 to your computer and use it in GitHub Desktop.

Select an option

Save sean-smith/f6bd44f0f9eb785e944e7fd999d7b076 to your computer and use it in GitHub Desktop.
iPython using EC2 and LetsEncrypt
Setup a EC2 instance running `Ubuntu 16.04`:
# Install Anaconda:
sudo su
cd ~
wget https://repo.continuum.io/archive/Anaconda3-4.3.1-Linux-x86_64.sh
bash Anaconda3-4.3.1-Linux-x86_64.sh
. ~/.bashrc
# Install Certbot
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install certbot
# Get Certificate
mkdir -p /root/.key
certbot certonly --webroot /root/.key
# Configure iPython
cd ~
jupyter notebook --generate-config # Create jupyter config
printf "from notebook.auth import passwd\nprint(passwd())" | python
# Edit .jupyter/jupyter_notebook_config.py
# Set options for certfile, ip, password, and toggle off\n
# browser auto-opening\n
c.NotebookApp.certfile = u'/root/.key/cert.pem'\n
c.NotebookApp.keyfile = u'/root/.key/privkey.pem'
# Set ip to '*' to bind on all interfaces (ips) for the public server
c.NotebookApp.ip = '*'
c.NotebookApp.password = u'sha1:bcd259ccf...<your hashed password here>'
c.NotebookApp.open_browser = False
# It is a good idea to set a known, fixed port for server access
c.NotebookApp.port = 9999" >> .jupyter/jupyter_notebook_config.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment