On MAC, terminal app can be used to connect to Google Cloud VM with the below steps:
1. open terminal console, and generate the key pair with your user name (for example, student), and save it to a particular folder when promoted
ssh-keygen -C student
2. open Google Cloud console, and open VM instance, click the edit link, and Add a new SSH Key section. Open the public key file generated in last step, copy and past the content to the public key text box in Google Cloud Console. The user name should show on left side of the text box. Save the change.
3. From the mac terminal, interactively connect to Google Cloud VM instance with ssl, with the parameter of private keyfile (master) and username (student) and VM public ip address as below
ssh -i /Users/mpro2/Documents/master student@35.224.168.51
ssh mynode -t bash
to execute a single command run below
ssh -i /Users/mpro2/Documents/master student@35.224.168.51 ifconfig
ssh -i /Users/mpro2/Documents/master student@35.224.168.51 ip link
Note, by default, the ip address of VM in GCP will change each time when VM restarts.