0
0
GCPcloud~30 mins

SSH access and metadata in GCP - Mini Project: Build & Apply

Choose your learning style9 modes available
SSH Access and Metadata Configuration on GCP
📖 Scenario: You are setting up a Google Cloud virtual machine (VM) to allow secure SSH access for a user. You will configure the VM's metadata to include the SSH public key for that user. This setup is common when you want to control who can connect to your VM securely.
🎯 Goal: Configure the SSH access by adding the correct SSH public key to the VM instance metadata on Google Cloud Platform.
📋 What You'll Learn
Create a metadata dictionary with the SSH keys entry
Add a specific SSH public key string to the metadata
Assign the metadata to the VM instance configuration
Ensure the SSH key is correctly formatted in the metadata
💡 Why This Matters
🌍 Real World
Setting SSH keys in VM metadata is a common way to control who can securely connect to cloud virtual machines without sharing passwords.
💼 Career
Cloud engineers and system administrators often configure VM metadata to manage access and automate instance setup securely.
Progress0 / 4 steps
1
Create the initial metadata dictionary
Create a dictionary called metadata with a key "ssh-keys" and an empty string as its value.
GCP
Need a hint?

Use curly braces to create a dictionary and set the value of "ssh-keys" to an empty string.

2
Add the SSH public key string to metadata
Add the SSH public key string "user:ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7examplekey user@example.com" as the value for the "ssh-keys" key in the metadata dictionary.
GCP
Need a hint?

Replace the empty string with the exact SSH public key string including the username and key.

3
Create the VM instance configuration dictionary
Create a dictionary called vm_instance with a key "metadata" and assign the metadata dictionary as its value.
GCP
Need a hint?

Use the metadata dictionary as the value for the metadata key inside vm_instance.

4
Add the final SSH access enable flag
Add a key "enable-ssh" with the value "true" to the metadata dictionary inside vm_instance to enable SSH access.
GCP
Need a hint?

Add the enable-ssh key with the string value "true" inside the metadata dictionary.