DEV Community

Cover image for How to Run Jupyter In Any Cloud With One Command
Casper da Costa-Luis
Casper da Costa-Luis

Posted on • Originally published at


How to Run Jupyter In Any Cloud With One Command

Two pain points often faced by scientists and engineers are:

  • Installing and maintaining your entire software stack (including GPU drivers and dependencies) is difficult and time-consuming, and
  • Being limited by the hardware you own (laptop or desktop specs).

Here's a solution!


  1. Download the terraform CLI tool and say goodbye to ClickOps (free)
  2. Get an ngrok account for port forwarding convenience (free)
  3. Have cloud credentials, of course! (AWS, Azure, GCP, or K8s.)

Lift off! πŸš€

Using this GitHub repository and TPI to do all the heavy lifting:

git clone
cd blog-tpi-jupyter
export NGROK_TOKEN="..."  # Signup for free at
terraform init    # Setup local dependencies
terraform apply   # Create cloud resources & upload workdir
terraform refresh # Get URLs (rerun if blank)
Enter fullscreen mode Exit fullscreen mode

It takes a few minutes to launch cloud resources and upload your working directory, so you might have to wait a bit before running terraform refresh again. Soon, you'll see:

urls = [
  "Jupyter Lab: https://{id}",
  "Jupyter Notebook: https://{id}",
  "TensorBoard: https://{id}",
Enter fullscreen mode Exit fullscreen mode

Click on those URLs to get to your dev environment! ✨

Image description

Download & Cleanup πŸ“₯

When done experimenting, download the shared workdir, delete the cloud storage, and terminate the cloud instance with one simple command:

terraform destroy
Enter fullscreen mode Exit fullscreen mode

Benefits 🎩

It uses Terraform Provider Iterative (TPI) under-the-hood. There are a few distinct advantages to TPI:

πŸ’° Lower cost: use your preferred cloud provider's existing pricing, including on-demand per-second billing and bulk discounts.

πŸ”„ Auto-recovery: spot/preemptible instances are cheap but unreliable. TPI reliably and automatically respawns such interrupted instances, caching & restoring the working directory in the cloud even when you are offline.

πŸ‘“ Custom spec: full control over hardware & software requirements via a single config fileβ€Š-β€Šincluding machine types (CPU, GPU, RAM, storage) & images.

Happy coding!

Top comments (0)