Remote Coding with PyCharm and Google Cloud

A quick tutorial on how to configure your PyCharm to run on a remote GCP instance using an ssh remote interpreter

Gad Benram
5 min readJul 28, 2021


What are we trying to achieve?

Write code on your notebook but make it run on a remote Google Cloud machine with more RAM and CPU

When developing a Python application, it’s often convenient to run the code on a GCP instance (AI Notebook / Google Compute Engine). This is beneficial especially since running Machine Learning (ML) or data processing code often requires a high spec machine with multiple CPUs and RAM.

Another benefit is that running the code remotely makes it authenticate against other Google Cloud Platform services as the service account associated with the instance. Upon completing this tutorial, you will be able to run PyCharm from your Mac, with the code executed remotely on a GCP VM.


In order to get started, you will need the following:

  1. PyCharm Pro installed on your Mac/Linux machine
  2. An active GCP account

Let’s Do It

Step 1: Set up a ssh key on your Mac [1]

Execute the following command to generate a new ssh key pair on your Mac/Linux terminal:

ssh-keygen -t rsa -f ~/.ssh/[KEY_FILENAME]

I chose not to set up a passphrase for the key and named it temp_key

Format the Public Key

Print the content of the public key value of your ssh key pair that you created under by using the following command:

cat ./ssh/

Copy the content of the key to the clipboard starting from the ssh-rsa (including) phrase until the “=” sign (before the username).

Open any notepad and format the key starting in the following way:

ssh-rsa [KEY VALUE]= [USER_NAME]

Keep this text for later.

Step 2: Create or Edit a VM on GCP



Gad Benram

Machine Learning Architect and Google Developer Expert.