5

I need to replace the existing SSH key with a new one, but I don't see such options in Cloud admin panel. What is the right way to do this?

kasperd
  • 30,455
  • 17
  • 76
  • 124
Alexey Kosov
  • 155
  • 1
  • 7

2 Answers2

11

Just replace ~/.ssh/google_compute_engine with the new key and use gcloud compute ssh as you normally would to get access to your VM instances; the key will be automatically propagated to the instances that don't already have it.

If you want to remove the previous key(s), remove them from the metadata for all of the instances where it might have been used; the entry attribute/sshKeys has a list of ssh keys. See the docs for Default metadata for more info.

See the docs for Setting custom metadata for how you can use gcloud to script changes to either project-wide or per-VM-instance metadata.

Misha Brukman
  • 768
  • 8
  • 22
0

You can edit the metadata option to in VM menu options. You can delete, add or remove SSH Keys from there. For step by step process read this article. Add SSH Keys on Google Cloud VM