0
0
GCPcloud~10 mins

SSH access and metadata in GCP - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to add an SSH key to the instance metadata.

GCP
gcloud compute instances add-metadata my-instance --metadata ssh-keys=[1]
Drag options to blanks, or click blank then click option'
A"user:ssh-rsa AAAAB3Nza... user@example.com"
B"zone=us-central1-a"
C"machine-type=n1-standard-1"
D"image-family=debian-11"
Attempts:
3 left
💡 Hint
Common Mistakes
Using zone or machine-type as metadata keys.
Not including the username before the SSH key.
2fill in blank
medium

Complete the code to enable OS Login on a Compute Engine instance.

GCP
gcloud compute instances add-metadata my-instance --metadata enable-oslogin=[1]
Drag options to blanks, or click blank then click option'
AFALSE
BTRUE
Cenabled
Dyes
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'yes' or 'enabled' instead of 'TRUE'.
Setting the value to 'FALSE' which disables OS Login.
3fill in blank
hard

Fix the error in the command to remove SSH keys from instance metadata.

GCP
gcloud compute instances remove-metadata my-instance --keys=[1]
Drag options to blanks, or click blank then click option'
Aclear-keys
Bremove-ssh-keys
Cdelete-keys
Dssh-keys
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect metadata key names like 'remove-ssh-keys'.
Trying to use commands that do not exist.
4fill in blank
hard

Fill both blanks to create a metadata entry that disables project-wide SSH keys on an instance.

GCP
gcloud compute instances add-metadata my-instance --metadata [1]=[2]
Drag options to blanks, or click blank then click option'
Ablock-project-ssh-keys
Benable-oslogin
CTRUE
DFALSE
Attempts:
3 left
💡 Hint
Common Mistakes
Using enable-oslogin instead of block-project-ssh-keys.
Setting the value to FALSE which does not block keys.
5fill in blank
hard

Fill all three blanks to add a custom SSH key metadata entry with a username and key.

GCP
gcloud compute instances add-metadata my-instance --metadata [1]=[2]:[3]
Drag options to blanks, or click blank then click option'
Assh-keys
Balice
C"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7... alice@example.com"
Denable-oslogin
Attempts:
3 left
💡 Hint
Common Mistakes
Using enable-oslogin as the metadata key.
Not including the username before the SSH key.