Skip to content

Instantly share code, notes, and snippets.

@sean-smith
Last active February 15, 2021 23:09
Show Gist options
  • Save sean-smith/f6bd44f0f9eb785e944e7fd999d7b076 to your computer and use it in GitHub Desktop.
Save sean-smith/f6bd44f0f9eb785e944e7fd999d7b076 to your computer and use it in GitHub Desktop.

Revisions

  1. sean-smith revised this gist Apr 2, 2017. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions ec2_ipython.md
    Original file line number Diff line number Diff line change
    @@ -61,6 +61,18 @@ c.NotebookApp.password = u'sha1:bcd259ccf...<put output from above here>'
    c.NotebookApp.open_browser = False
    c.NotebookApp.port = 443
    ```
    ### Run iPython in background
    ```bash
    sudo su
    jupyter notebook &> /dev/null &
    ```
    Now you can connect to the url: `https://ec2-54-148-64-44.us-west-2.compute.amazonaws.com/`

    If you have a self signed certificate you'll get a warning that your connection is unsafe. Click `advanced` and then `proceed anyways`.

    You'll then be prompted for the password you set in the `Configure iPython and get Password` step. Enter that and click continue.

    Now you have an iPython notebook running on AWS! 🤓

    # References
    * http://jupyter-notebook.readthedocs.io/en/latest/public_server.html
  2. sean-smith revised this gist Apr 2, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ec2_ipython.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@

    # Setup an iPython Notebook on AWS with LetsEncrypt Certificate:
    # Setup an iPython Notebook on AWS with LetsEncrypt Certificate

    The first step is to setup an EC2 `Ubuntu 16.04` instance that you can ssh into. I won't go into detail here but you should be able to easily google it.

  3. sean-smith revised this gist Apr 2, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions ec2_ipython.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@

    # Setup a EC2 instance running `Ubuntu 16.04`:
    # Setup an iPython Notebook on AWS with LetsEncrypt Certificate:

    The first step is to setup an EC2 Ubuntu instance that you can ssh into. I won't go into detail here but you should be able to easily google it.
    The first step is to setup an EC2 `Ubuntu 16.04` instance that you can ssh into. I won't go into detail here but you should be able to easily google it.

    You can get free AWS credit here https://education.github.com/pack

  4. sean-smith revised this gist Apr 2, 2017. 1 changed file with 21 additions and 2 deletions.
    23 changes: 21 additions & 2 deletions ec2_ipython.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,14 @@

    # Setup a EC2 instance running `Ubuntu 16.04`:

    The first step is to setup an EC2 Ubuntu instance that you can ssh into. I won't go into detail here but you should be able to easily google it.

    You can get free AWS credit here https://education.github.com/pack

    A better guide w/ pictures is here: https://chrisalbon.com/jupyter/run_project_jupyter_on_amazon_ec2.html (Note this doesn't include LetsEncrypt, so it only has self signed certificates)

    Once you've setup an instance and ssh'd in, do the following:

    ### Install Anaconda:

    ```bash
    @@ -10,8 +18,9 @@ wget https://repo.continuum.io/archive/Anaconda3-4.3.1-Linux-x86_64.sh
    bash Anaconda3-4.3.1-Linux-x86_64.sh
    . ~/.bashrc
    ```
    If you have your own domain you can link it so you don't have type in the IP address each time you want to access your notebook.

    ### Install Certbot
    ### Install Certbot (if you have your own domain)
    ```bash
    sudo add-apt-repository ppa:certbot/certbot
    sudo apt-get update
    @@ -24,14 +33,24 @@ mkdir -p /root/.key
    certbot certonly --webroot /root/.key -d YOURDOMAIN.com
    ```

    If you don't have your own domain, create a self signed certificate.

    ### Self Signed Certificate
    ```
    mkdir -p /root/certs
    cd /root/certs
    sudo openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout privkey.pem -out cert.pem
    ```

    ### Configure iPython and get Password
    ```bash
    cd ~
    jupyter notebook --generate-config # Create jupyter config
    printf "from notebook.auth import passwd\nprint(passwd())" | python
    ```
    Enter your password and confirm. Copy the result as we'll use it in the next step.

    ### Edit .jupyter/jupyter_notebook_config.py
    ### Edit ~/.jupyter/jupyter_notebook_config.py

    ```python
    # Set options for certfile, ip, password, and toggle off
  5. sean-smith revised this gist Mar 29, 2017. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion ec2_ipython.md
    Original file line number Diff line number Diff line change
    @@ -45,4 +45,5 @@ c.NotebookApp.port = 443

    # References
    * http://jupyter-notebook.readthedocs.io/en/latest/public_server.html
    * https://certbot.eff.org/#ubuntuxenial-other
    * https://certbot.eff.org/#ubuntuxenial-other
    * https://gist.github.com/iamatypeofwalrus/5183133
  6. sean-smith revised this gist Mar 29, 2017. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion ec2_ipython.md
    Original file line number Diff line number Diff line change
    @@ -41,4 +41,8 @@ c.NotebookApp.ip = '0.0.0.0'
    c.NotebookApp.password = u'sha1:bcd259ccf...<put output from above here>'
    c.NotebookApp.open_browser = False
    c.NotebookApp.port = 443
    ```
    ```

    # References
    * http://jupyter-notebook.readthedocs.io/en/latest/public_server.html
    * https://certbot.eff.org/#ubuntuxenial-other
  7. sean-smith revised this gist Mar 29, 2017. No changes.
  8. sean-smith revised this gist Mar 29, 2017. 1 changed file with 14 additions and 15 deletions.
    29 changes: 14 additions & 15 deletions ec2_ipython.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@

    Setup a EC2 instance running `Ubuntu 16.04`:
    # Setup a EC2 instance running `Ubuntu 16.04`:

    # Install Anaconda:
    ### Install Anaconda:

    ```bash
    sudo su
    @@ -11,35 +11,34 @@ bash Anaconda3-4.3.1-Linux-x86_64.sh
    . ~/.bashrc
    ```

    # Install Certbot
    ### Install Certbot
    ```bash
    sudo add-apt-repository ppa:certbot/certbot
    sudo apt-get update
    sudo apt-get install certbot
    ```
    # Get Certificate

    ### Get Certificate
    ```bash
    mkdir -p /root/.key
    certbot certonly --webroot /root/.key -d YOURDOMAIN.com
    ```
    # Configure iPython

    ### Configure iPython and get Password
    ```bash
    cd ~
    jupyter notebook --generate-config # Create jupyter config
    printf "from notebook.auth import passwd\nprint(passwd())" | python
    ```
    # Edit .jupyter/jupyter_notebook_config.py

    ### Edit .jupyter/jupyter_notebook_config.py

    ```python
    # Set options for certfile, ip, password, and toggle off
    # browser auto-opening\n
    c.NotebookApp.certfile = u'/root/.key/cert.pem'\n
    c.NotebookApp.certfile = u'/root/.key/cert.pem'
    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
    c.NotebookApp.ip = '0.0.0.0'
    c.NotebookApp.password = u'sha1:bcd259ccf...<put output from above here>'
    c.NotebookApp.open_browser = False
    c.NotebookApp.port = 443
    ```
  9. sean-smith revised this gist Mar 29, 2017. 1 changed file with 22 additions and 22 deletions.
    44 changes: 22 additions & 22 deletions ec2_ipython.md
    Original file line number Diff line number Diff line change
    @@ -3,38 +3,38 @@ 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
    ```bash
    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
    ```bash
    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
    ```bash
    mkdir -p /root/.key
    certbot certonly --webroot /root/.key -d YOURDOMAIN.com
    ```
    # Configure iPython
    ```
    cd ~
    jupyter notebook --generate-config # Create jupyter config
    printf "from notebook.auth import passwd\nprint(passwd())" | python
    ```bash
    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'
    ```python
    # Set options for certfile, ip, password, and toggle off
    # 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>'
  10. sean-smith revised this gist Mar 29, 2017. 1 changed file with 11 additions and 7 deletions.
    18 changes: 11 additions & 7 deletions ec2_ipython.md
    Original file line number Diff line number Diff line change
    @@ -3,31 +3,34 @@ 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
    @@ -38,4 +41,5 @@ Setup a EC2 instance running `Ubuntu 16.04`:
    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
    c.NotebookApp.port = 9999" >> .jupyter/jupyter_notebook_config.py
    ```
  11. sean-smith revised this gist Mar 29, 2017. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions ec2_ipython.md
    Original file line number Diff line number Diff line change
    @@ -2,27 +2,32 @@
    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
  12. sean-smith renamed this gist Mar 29, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  13. sean-smith created this gist Mar 29, 2017.
    36 changes: 36 additions & 0 deletions iPython using EC2
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@

    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