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
What are we trying to achieve?
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:
- PyCharm Pro installed on your Mac/Linux machine
- An active GCP account
Let’s Do It
Step 1: Set up a ssh key on your Mac 
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:
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.