Run a Jupiter Notebook on Google Cloud platform in 5 mins

Source: Deep Learning on Medium


No Fancy lines to start with. Lets get to work

They are lot cloud service out there like AWS, Floyed, IBM Clould etc.But I personally prefer Google Cloud Platform(GCP) for no reason

It is very difficult to run machine learning/Deep learning models on our personal system with 8gb RAM. And it is very expensive to buy a GPU.Hence it is better to use cloud services with affordable price. Google is offering $300 free credit to every new user who signs up for GCP!

Step 1: Go to google cloud to grab free trial

Login to your google account and Go to https://cloud.google.com/ and click try GCP for free. If you are using GCP for the first time you will be credited with $300! You can use it to run most of the basic machine learning models.

Step 2: Create a new project

After step 1 you will end up at google cloud console home page.In dashboard page create a new project.

Step 3 : Create a new VM instance

Click on menu item to find google compute engine and go to compute engine and select VM instance(Virtual Machine instance) to create a VM instance of our requirements.

  • Give instance name and select region as us-east1(South Carolina) and zone us-east1-b or us-east1-c.
  • In Machine Type select Virtual CPUs and Memory. We can change this anytime as per our requirements. In free trial period one can select maximum of 8-cpu and 52 GB memory.
  • Select Boot disk to choose Operating system. Deep learning based OS images are available in GCP with inbuilt libraries like Numpy, Scikit-learn,Scipy etc.
  • Select Ubuntu or Debian based Deep Learning Image with required memory.

select both HTTP and HTTPS traffic in firewall.

In you make Preemptibility on the cost will almost decreases by half.But it is recommended to choose Off. For more info about Preemptibility. And click on create.

And click on create, a news VM instance is created.Make sure you stop the machine you are not using.

Step 5: Create a new Firewall rule

Go to menu >VPC network> Sclick on Firewall rules.

Click on Create new firewall rule.

Enter source IP range value as 0.0.0.0/0 and select tcp in Specified Protocols and ports.

Enter 8888 or any number as port number and create new firewall rule

Step 6: Make your external IP as static

Make your external IP as static by going to Menu>Networking>External IP addresses. And select the type as static.

Step 7: Launch Virtual Machine

Now it is time to launch your Virtual Machine. In VM instance tab select the Virtual Machine and click on the start.

The green tick means that your VM is up and running. you will be charged as long as it is up. Hence do not forget to STOP the VM instance once you are done with your work.

If you close the GCP window without stopping VM you are still chargeable

As a final step click on the SSH button a new command prompt will open.Type the following command and enter

jupyter notebook — ip=0.0.0.0 — port=8888 — no-browser &

To open Jupiter notebook in your browser type <external ip displayed>/<port number>. It will ask for a token paste the token from the command line prompt.

Now you can run your models with almost 8cpus and 52gb memory.You can install any other libraries you want and download datasets directly to your VM. you can even add GPUs to your VM depending on availability and cost.

If you get permission denied errors while downloading any libraries, use sudo and relative path like :

sudo /opt/anaconda3/bin/conda install -c anaconda gensim

This is my first writing on Medium, hope you will find it helpful .

Lets connect : https://in.linkedin.com/in/mahesh-varada-145648b3