instance: Name of the instance of run ssh command upon
...: Shell commands to run. Multiple commands are combined with && so that execution will halt after the first failure.
key.pub: The filepath location of the public key
key.private: The filepath location of the private key
wait: Whether then SSH output should be waited for or run it asynchronously.
capture_text: Possible values are "", to the R console (the default), NULL or FALSE (discard output), TRUE (capture the output in a character vector) or a character string naming a file.
username: The username you used to generate the key-pair
local, remote: Local and remote paths.
verbose: If TRUE, will print command before executing it.
overwrite: If TRUE, will overwrite the local file if exists.
Details
Only works connecting to linux based instances.
On Windows you will need to install an ssh command line client - see examples for an example using RStudio's built in client.
You will need to generate a new SSH key-pair if you have not connected to the instance before via say the gcloud SDK.
To customise SSH connection see gce_ssh_setup
capture_text is passed to stdout and stderr of system2
Uploads and downloads are recursive, so if you specify a directory, everything inside the directory will also be downloaded.
Examples
## Not run: vm <- gce_vm("my-instance")## if you have already logged in via gcloud, the default keys will be used## no need to run gce_ssh_addkeys## run command on instance gce_ssh(vm,"echo foo")#> foo## if running on Windows, use the RStudio default SSH client## e.g. add C:\Program Files\RStudio\bin\msys-ssh-1000-18 to your PATH## then run: vm2 <- gce_vm("my-instance2")## add SSH info to the VM object## custom info vm2 <- gce_ssh_setup(vm2, username ="mark", key.pub ="C://.ssh/id_rsa.pub", key.private ="C://.ssh/id_rsa")## run command on instance gce_ssh(vm2,"echo foo")#> foo## End(Not run)