gcloud_alpha_compute_config-ssh (1)
NAME
- gcloud alpha compute config-ssh - populate SSH config files with Host entries from each instance
SYNOPSIS
-
gcloud alpha compute config-ssh [--dry-run] [--force-key-file-overwrite] [--remove] [--ssh-config-file=SSH_CONFIG_FILE] [--ssh-key-file=SSH_KEY_FILE] [GCLOUD_WIDE_FLAG ...]
DESCRIPTION
(ALPHA) gcloud alpha compute config-ssh makes SSHing to virtual
In most cases, it is sufficient to run:
- $ gcloud alpha compute config-ssh
Each instance will be given an alias of the form NAME.ZONE.PROJECT. For example, if example-instance resides in us-central1-a, you can SSH to it by running:
- $ ssh example-instance.us-central1-a.MY-PROJECT
On some platforms, the host alias can be tab-completed, making the long alias less daunting to type.
The aliases created interface with SSH-based programs like scp(1), so it is possible to use the aliases elsewhere:
- $ scp ~/MY-FILE example-instance.us-central1-a.MY-PROJECT:~
Whenever instances are added, removed, or their external IP addresses are changed, this command should be re-executed to update the configuration.
This command ensures that the user's public SSH key is present in the project's metadata. If the user does not have a public SSH key, one is generated using ssh-keygen(1) (if the --quiet flag is given, the generated key will have an empty passphrase).
FLAGS
-
- --dry-run
-
If provided, the proposed changes to the SSH config file are printed to standard
output and no actual changes are made.
- --force-key-file-overwrite
-
If enabled, the gcloud command-line tool will regenerate and overwrite the
files associated with a broken SSH key without asking for confirmation in both
interactive and non-interactive environments.
If disabled, the files associated with a broken SSH key will not be regenerated and will fail in both interactive and non-interactive environments.
- --remove
-
If provided, any changes made to the SSH config file by this tool are reverted.
- --ssh-config-file=SSH_CONFIG_FILE
-
Specifies an alternative per-user SSH configuration file. By default, this is
~/.ssh/config.
- --ssh-key-file=SSH_KEY_FILE
-
The path to the SSH key file. By default, this is
~/.ssh/google_compute_engine.
GCLOUD WIDE FLAGS
These flags are available to all commands: --account, --configuration, --flags-file, --flatten, --format, --help, --log-http, --project, --quiet, --trace-token, --user-output-enabled, --verbosity. Run $ gcloud help for details.
NOTES
This command is currently in ALPHA and may change without notice. If this command fails with API permission errors despite specifying the right project, you will have to apply for early access and have your projects registered on the API whitelist to use it. To do so, contact Support at cloud.google.com/support These variants are also available:
- $ gcloud compute config-ssh $ gcloud beta compute config-ssh