Ultimate access to all questions.
You’ve been tasked with deploying all of your team’s public SSH keys to a specific Bastion host instance in a particular Google Cloud project. You’ve collected all the keys. What is the simplest method to deploy these keys with the fewest steps?
Explanation:
The most efficient method is to format all SSH keys into a single file according to Google Cloud's metadata requirements and then use the gcloud compute instances add-metadata
command to upload them to the specific Bastion host instance. This approach allows for the deployment of multiple keys in a single operation, ensuring they are securely stored and accessible to the VM without manual intervention for each key. Here’s a brief overview of the steps:
Create a Metadata File: Prepare a text file (e.g., metadata.txt
) formatted with the SSH keys according to Google Cloud’s specifications, including the key type and the public key itself.
Upload the Metadata: Execute the gcloud compute instances add-metadata
command to upload the metadata file to the designated instance, thereby adding the SSH keys to the instance’s metadata for VM access.