Learn R Programming

googleComputeEngineR (version 0.1.0)

gce_ssh_setup: Setup a SSH connection with GCE from a new SSH key-pair

Description

Uploads ssh-keys to an instance

Usage

gce_ssh_setup(instance, key.pub = NULL, key.private = NULL, ssh_overwrite = FALSE, username = Sys.info()[["user"]])

Arguments

instance
Name of the instance of run ssh command upon
key.pub
The filepath location of the public key, only needed first call per session
key.private
The filepath location of the private key, only needed first call per session
ssh_overwrite
Will check if SSH settings already set and overwrite them if TRUE
username
The username you used to generate the key-pair

Value

TRUE if successful

Details

This loads a public ssh-key to an instance's metadata. It does not use the project SSH-Keys, that may be set seperatly.

You will need to generate a new SSH key-pair if you have not connected to an instance before.

Instructions for this can be found here: https://cloud.google.com/compute/docs/instances/connecting-to-instance. Once you have generated run this function once to initiate setup.

If you have historically connected via gcloud or some other means, ssh keys may have been generated automatically. These will be looked for and used if found, at file.path(Sys.getenv("HOME"), ".ssh", "google_compute_engine.pub")

See Also

https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys

Other ssh functions: gce_ssh_browser, gce_ssh