Professional Cloud DevOps Engineer
Prepare and test your skills
Prepare and test your skills
Worked example. The correct answer is already marked and every option is explained below, so there is nothing to select here. To answer questions yourself, start the free trial.
Keep the momentum going with these hand-picked practice scenarios
Want more questions like this?
Get a free certification question every week.
Last updated
A DevOps engineer needs to use Google Cloud Shell as a remote sandbox for running infrastructure orchestration scripts. To streamline development, the engineer connects to Cloud Shell directly from their local terminal using the Google Cloud CLI (gcloud) and mounts their persistent home directory.
Which command should the engineer use to establish an interactive SSH session to Cloud Shell while ensuring their local gcloud credentials are automatically propagated and authorized inside the remote Cloud Shell environment?
Execute gcloud compute ssh cloudshell --tunnel-through-iap from the local workstation.
Execute gcloud cloud-shell ssh --ssh-flag="-A" to enable OpenSSH agent forwarding.
Execute gcloud cloud-shell ssh --authorize-session from the local workstation.
Execute gcloud auth print-access-token locally and export it to CLOUDSDK_AUTH_ACCESS_TOKEN over standard SSH.
Execute gcloud compute ssh cloudshell --tunnel-through-iap from the local workstation.
Execute gcloud cloud-shell ssh --ssh-flag="-A" to enable OpenSSH agent forwarding.
Execute gcloud cloud-shell ssh --authorize-session from the local workstation.
gcloud cloud-shell ssh --authorize-session isThe gcloud cloud-shell ssh command creates an interactive SSH tunnel from a local workstation directly into the user's allocated Google Cloud Shell virtual machine instance. Cloud Shell provides a persistent $HOME directory backed by a Persistent Disk alongside pre-installed developer tools.
--authorize-session flag automatically forwards and synchronizes the local gcloud authentication context to the remote Cloud Shell instance. This allows remote scripts and CLI commands to execute under the authenticated identity without requiring manual gcloud auth login steps inside the session.$HOME directory.Alternative SSH methods or generic compute commands cannot properly target the managed, ephemeral Cloud Shell container or propagate user credentials into its specialized runtime profile.
Execute gcloud auth print-access-token locally and export it to CLOUDSDK_AUTH_ACCESS_TOKEN over standard SSH.