rocksNwaves
rocksNwaves

Reputation: 6164

Persistent disk missing when I SSH into GCP VM instance with Jupyter port forwarding

I have created a VM instance on Google Cloud, and also set up a Notebook instance. In this instance, I have a bunch of notebooks, python modules as well as a lot of data.

I want to run a script on my VM instance by using the terminal. I tried running it in a Jupyter Notebook, but it failed several hours in and crashed the notebook. I decided to try from the command line instead. However, when I used the commands found in the docs to ssh into my instance:

gcloud beta compute ssh --zone "<Zone>" "<Instance Name>" --project "<Project-ID>",

or

gcloud compute ssh --project <Project-ID> --zone <Zone> <Instance Name>

or

gcloud compute ssh --project $PROJECT_ID --zone $ZONE $INSTANCE_NAME -- -L 8080:localhost:8080

I successfully connect to the instance, but the file system is missing. I can't find my notebooks or scripts. The only way I can see those files is when I use the GUI and select 'Open Jupyter Lab' from the AI Platform > Notebooks console.

How do I access the VM through the command line so that I can still see my "persistent disk" that is associated with this VM instance?

Upvotes: 0

Views: 324

Answers (1)

rocksNwaves
rocksNwaves

Reputation: 6164

I found the answer on the fast.ai getting started page. Namely you have to specify the user name as jupyter in the ssh command:

Solution 1: Default Zone and Project Configured:

gcloud compute ssh jupyter@<instance name>

or if you want to use port forwarding to have access to your notebook:

gcloud compute ssh jupyter@<instance name> -- -L 8080:localhost:8080

Solution 2: No Default Zone or Project:

Note that I left out the zone and project id from both of these commands. They are not necessary if you set a default zone and project during your initial gcloud init stage. If you did not do this, then the commands become:

gcloud compute ssh --project <project ID> --zone <zone> jupyter@<instance name>

or if you want to use port forwarding to run a notebook:

gcloud compute ssh --zone <zone> jupyter@<instance name> -- -L 8080:localhost:8080

Upvotes: 3

Related Questions