Connecting to Jupyter notebook with VS Code

Accessing your Jupyter notebook running on the DataCrunch server through VS Code may be handy to benefit from advanced code-editor features, such as static code analysis and AI-based co-pilots.

The easiest way to start an instance for use with Jupyter is to choose JupyterLab when selecting the Operating System:

Proceed to deploy your instance as usual. After your instance has been created, you will need to secure it by following the guide to Securing Your Instance.

To access your Jupyter server after securing the instance, you will need to forward the local port 8888 (or any other port that you would like to use for connecting to Jupyter) to the remote port 8888:

ssh -L 8888:localhost:8888 root@IP_OF_YOUR_INSTANCE

After this is done, you should have Jupyter access on your desktop at: http://127.0.0.1:8888/ The authentication token (password) for your Jupyter instance can be obtained from the Open JupyterLab link in your server description:

The link is of the form http://SERVER_IP:8888/?token=AUTHENTICATION_TOKEN. You will need this token to access your Jupyter kernel in the next step.

Now you can connect the VS Code to the local port you just configured. Make sure the Jupyter extension is installed. Then create a new *.ipynb notebook locally and select a remote kernel. Paste http://127.0.0.1:8888 into the kernel URL, and enter the authentication token when prompted for the password.

You should now be able to run code on your remote machine through VS Code.

Last updated