Q: 1
You have a number of compute instances belonging to an unmanaged instances group. You need to
SSH to one of the Compute Engine instances to run an ad hoc script. You’ve already authenticated
gcloud, however, you don’t have an SSH key deployed yet. In the fewest steps possible, what’s the
easiest way to SSH to the instance?
Options
Discussion
C or B, but B is what Google expects since gcloud compute ssh does everything if no key yet.
B
Doesn’t creating a key with ssh-keygen then using gcloud compute ssh actually save time since you need the key first? I thought C would be faster than letting gcloud handle it all. Maybe I’m missing something about how gcloud automates the process though?
I actually pick C here. Since you don’t have a key yet, I thought you’d need to generate one first before using gcloud compute ssh. A feels like a trap because ssh won't work without the key. Disagree?
B
Its B, A looks tempting but fails when no SSH key exists. B auto-creates and uploads so it's easier.
Seriously, Google could make this a bit clearer in their docs. Its B since
gcloud compute ssh will handle key creation and upload if you don't have one set up. That's way fewer steps than messing with manual keys. Someone correct me if I'm off.If you already authenticated gcloud but haven't set up keys, it's gotta be B.
B , A will fail without an SSH key set up and B does that for you automatically.
Yeah, A is a common way but you need a key set up first or you'd get blocked. B actually handles the key setup for you if one isn't there yet, so that's fewer steps just like they want. If we're going by minimum hassle, B is right. Anyone disagree?
Be respectful. No spam.