Google Cloud Platform – How to Upload a Folder onto a Virtual Machine

google-cloud-platformgoogle-cloud-storagegoogle-compute-enginescpvirtual-machines

I created a VM instance on the Compute Engine in a Google Cloud project. I want to upload a folder from my computer's local storage onto the boot disk of the virtual machine.

I tried using the scp command in the command line interface of my computer by typing scp /file/path/name external-ip-address-of-server:. But then I got the errorPermission denied (publickey). lost connection

I'm also aware that the wget command can be used to download a file from the internet onto a computer. I thought of using this, but that would require putting my folder online as a download link, which I don't know how to do.

What's the best way to put a folder from local storage onto the boot disk of a virtual machine?

Best Answer

The tool you are looking for is probably rsync.

A possible command line might be:

rsync -av /file/path/name external-ip-address-of-server:

Rsync uses ssh as its default transport, so before it will work easily for you, it looks like you need to get your ssh logins working. But that's another question, and one that StackExchange probably already has an answer for.