DEV Community

Start a Jupyter notebook server in an AWS AMI to run python

Note: This notebook is considered a continuation of the previous post. You can see it on dev from here, or on medium from here

Introduction

  • A Jupyter notebook server must be running in order to create and run Jupyter notebooks.
  • The AWS Deep Learning AMI that the virtual machine is built from includes the Jupyter notebook server, in addition to many commonly used packages for machine learning.
  • In this post, you will start a Jupyter notebook server.

Start a Jupyter notebook

Step 1

In your SSH shell, enter the following command to start the Jupyter notebook server in the background:

nohup jupyter notebook &
Enter fullscreen mode Exit fullscreen mode
  • The nohup command, stands for no hangup and allows the Jupyter notebook server to continue running even if your SSH connection is terminated.
  • After a couple seconds a message about writing output for the process to the nohup.out file will be displayed:

Image description

  • Press enter to return to the shell prompt.
  • This will allow you to continue to enter commands at the shell prompt.

Step 2

Press enter to move to a clean command prompt, and tail the notebook's log file to watch for when the notebook is ready to connect to:

tail -f nohup.out
Enter fullscreen mode Exit fullscreen mode

The notebook is ready when you see The Jupyter Notebook is running at:...

Image description

Step 3

Press ctrl+c to stop tailing the log file.

Step 4

Enter the following to get an authenticated URL for accessing the Jupyter notebook server:

jupyter notebook list
Enter fullscreen mode Exit fullscreen mode
  • By default, Jupyter notebooks prevent access to anonymous users. - After all, you can run arbitrary code through the notebook interface.

Image description

  • The token URL parameter is one way to authenticate yourself when accessing the notebook server.
  • The /home/ubuntu at the end of the command indicates the working directory of the server.
  • The Jupyter notebook server is now up and running.



GitHub
LinkedIn
Facebook
Medium

Top comments (0)