Stay organized with collections Save and categorize content based on your preferences.
gcloud 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 …
]
gcloud compute config-ssh
makes SSHing to virtual machine instances easier by adding an alias for each instance to the user SSH configuration (~/.ssh/config
) file.
In most cases, it is sufficient to run:
gcloud 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, the remove command must be run to clear the existing configuration and then the command can set executed to set the configuration to the current state.
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).
gcloud compute config-ssh
To remove the change to the SSH config file by this command, run:
gcloud compute config-ssh --remove
--dry-run
--force-key-file-overwrite
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
--ssh-config-file
=SSH_CONFIG_FILE
~/.ssh/config
.
--ssh-key-file
=SSH_KEY_FILE
~/.ssh/google_compute_engine
.
--access-token-file
, --account
, --billing-project
, --configuration
, --flags-file
, --flatten
, --format
, --help
, --impersonate-service-account
, --log-http
, --project
, --quiet
, --trace-token
, --user-output-enabled
, --verbosity
.
Run $ gcloud help
for details.
gcloud alpha compute config-ssh
gcloud beta compute config-ssh
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-07 UTC."],[],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4