nerdexam
GoogleGoogle

ASSOCIATE-CLOUD-ENGINEER · Question #343

ASSOCIATE-CLOUD-ENGINEER Question #343: Real Exam Question with Answer & Explanation

The correct answer is B: Use the gcloud compute ssh command.. gcloud compute ssh 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 and added to the project's metadata. This is similar to the other option where we copy the key explicitly

Submitted by saadiq_pk· Mar 30, 2026

Question

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

  • ARun gcloud compute instances list to get the IP address of the instance, then use the ssh
  • BUse the gcloud compute ssh command.
  • CCreate a key with the ssh-keygen command. Then use the gcloud compute ssh command.
  • DCreate a key with the ssh-keygen command. Upload the key to the instance. Run gcloud compute

Explanation

gcloud compute ssh 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 and added to the project's metadata. This is similar to the other option where we copy the key explicitly to the project's metadata but here it is done automatically for us. There are also security benefits with this approach. When we use gcloud compute ssh to connect to Linux instances, we are adding a layer of security by storing your host keys as guest attributes. Storing SSH host keys as guest attributes improve the security of your connections by helping to protect against vulnerabilities such as man-in-the-middle (MITM) attacks. On the initial boot of a VM instance, if guest attributes are enabled, Compute Engine stores your generated host keys as guest attributes. Compute Engine then uses these host keys that were stored during the initial boot to verify all subsequent connections to the VM instance.

Community Discussion

No community discussion yet for this question.

Full ASSOCIATE-CLOUD-ENGINEER PracticeBrowse All ASSOCIATE-CLOUD-ENGINEER Questions