0

Have four instances in GCLOUD with SO: Linux (Ubuntu). I have to replicate the files uploaded through ftp to one machine and then to the remaining 3 machines. I have been thinking to use Rsync, but I would like to know if there is another option or configuration integrated in GCLOUD that allows me to do that. Thank you !!!

Django
  • 422
  • 2
  • 5
Luis Lopez
  • 133
  • 1
  • 9

1 Answers1

2

gcloud compute scp command permits to copy files or directories between two Google Compute Engine instances.
Here are some examples on how to do this:

The following example copies a file from your workstation to the home directory of the active user on the remote instance.

gcloud compute scp [LOCAL_FILE_PATH] [INSTANCE_NAME]:~/

or

You can also copy files from an instance to your local workstation by reversing the source and destination variables. The following example copies a file from a remote instance to your workstation.

 gcloud compute scp [INSTANCE_NAME]:[REMOTE_FILE_PATH] [LOCAL_FILE_PATH]

Also, you can pass a --recurse argument which will recursively copy all files and directories under the specified directory:

gcloud compute scp --recurse SRC_PATH DEST_PATH

Here is the command reference.

N.B: Make sure that each instance that initiates the copy has Compute Engine access scope set to read/write in its configuration. Also as SSH protocol is used in Gcloud SCP command, there must be a firewall rule that allows SSH access to the remote host

Other extensive information on Google Cloud Docs.

Django
  • 422
  • 2
  • 5