Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SFTP into Google Compute Engine

I have been playing around with Debian on Compute Engine and was wondering how I could SFTP into the server. I can't find any documentation on it and was hoping someone could point me in the right direction.

Thanks!

If this isn't possible, is the best way to manage static sites through SCP?

like image 470
user1156994 Avatar asked Mar 04 '14 04:03

user1156994


2 Answers

At a high level, these are the steps:

  1. Install and run the gcloud SDK ($ gcloud init)
  2. Generate SSH key ($ gcloud compute ssh)
  3. Setup the FTP client (install and add the key file)
  4. Connect to the VM using the SFTP client

Assuming this question was asked here before this documentation from Google was available.

Also, I have recorded this, it might be helpful:

https://www.youtube.com/watch?v=9ssfE6ODpak

And just an FYI .. if the files that you need to transfer are pretty small in size then maybe you don’t need a SFTP client. Transfer directly from the console as seen here https://youtu.be/HEdXEEYOynE

like image 131
Naresh MG Avatar answered Sep 23 '22 03:09

Naresh MG


ssh, scp and sftp should all work if you specify the instance's IP address. You can use DNS for this if you have a static IP address, or you can use the IP address from gcutil listinstances or the console.

Once you know the IP address of the instance, you'll also need your ssh private key, which is usually at ~/.ssh/google_compute_engine. Then you can connect via sftp as follows:

sftp -o IdentityFile ~/.ssh/google_compute_engine user@host
like image 37
E. Anderson Avatar answered Sep 23 '22 03:09

E. Anderson