
format="value((key:ssh-keys).firstof(value))" Making use of the filter() and firstof() transforms available for gcloud, we are able to grab just those project-wide SSH keys: gcloud compute project-info describe \ Use the following command to check all project-wide SSH keys for $GCP_PROJECT_NAME: gcloud compute project-info describe -format=json Make sure the public and private key files for your RSA-based key still exist: ls -1 ~/.ssh/id_rsa* If not, switch to $GCP_PROJECT_NAME with: gcloud config set project $GCP_PROJECT_NAME Make sure you're connected to $GCP_PROJECT_NAME with: gcloud config list -format="value(core.project)" Make sure you're logged-in as the correct user: gcloud config list -format="value(core.account)" If you want to add your RSA-based SSH key to your Google Cloud Project (GCP) project ( $GCP_PROJECT_NAME): Warning is because the: gcloud compute project-info add-metadataĬommand expects SSH keys to be presented as: $USERNAME: $(cat ~/.ssh/id_rsa.pub) How would I accomplish the same thing with the GCP SDK ( gcloud)? With a warning, but unable to connect to a GCP Compute instance with it.Īnd I paste it into the GCP Console, I am able to use it. WARNING: The following key(s) are missing the at the front


metadata-from-file ssh-keys=./.ssh/id_rsa.pub I am able to add it to my Google Cloud Platform (GCP) project's ( $GCP_PROJECT_NAME) Compute metadata: gcloud compute project-info add-metadata \ Your public key has been saved in /./.ssh/.id_rsa.pub. Your identification has been saved in /./.ssh/.id_rsa. After generating an RSA-based SSH key: ssh-keygen -t rsa -f ~/.ssh/id_rsa -C id_rsaĮnter passphrase (empty for no passphrase):
