Last active
February 15, 2021 23:09
-
-
Save sean-smith/f6bd44f0f9eb785e944e7fd999d7b076 to your computer and use it in GitHub Desktop.
iPython using EC2 and LetsEncrypt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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