Prepare and test your skills
Prepare and test your skills
Free sample question, answered and explained below. The Professional Cloud DevOps Engineer practice bank has 1,455 more like it. Try 10 free: instant score, no account.
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?
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.
gcloud cloud-shell ssh --ssh-flag="-A" to enable OpenSSH agent forwarding.-A) isThe -A parameter passes an SSH agent forwarding directive to the underlying OpenSSH client, allowing remote hosts to use local SSH private keys for authenticating downstream SSH connections (e.g., to remote Git repositories).
gcloud CLI access tokens, OAuth profiles, or Google identity contexts.--authorize-session, the remote Cloud Shell instance will not inherit the local gcloud authentication state, forcing the user to re-authenticate manually inside the remote container.The engineer specifically needed to authenticate from Cloud Shell to a private third-party Git server using an SSH key resident only on the local machine.
gcloud compute ssh cloudshell --tunnel-through-iap from the local workstation.gcloud compute ssh isThe gcloud compute ssh command is designed for connecting to standard Google Compute Engine virtual machine (VM) instances residing inside user-managed Virtual Private Cloud (VPC) networks, optionally leveraging Identity-Aware Proxy (IAP) TCP forwarding.
gcloud compute command group.gcloud compute ssh does not provide built-in authorization flags to propagate user session credentials into the environment.roles/iap.tunnelResourceAccessor) and firewall configurations allowing port 22 traffic from Google IP blocks.The target environment were a custom backend Compute Engine VM instance located inside a private VPC subnet requiring IAP-based bastion connectivity.
gcloud auth print-access-token locally and export it to CLOUDSDK_AUTH_ACCESS_TOKEN over standard SSH.CLOUDSDK_AUTH_ACCESS_TOKEN isSetting the CLOUDSDK_AUTH_ACCESS_TOKEN environment variable manually overrides the gcloud CLI's default credential discovery mechanism by supplying a short-lived OAuth 2.0 access token generated via gcloud auth print-access-token.
--authorize-session flag, making manual token passing complex and error-prone.You were building custom curl-based REST API automation scripts targeting Google Cloud APIs where an active gcloud installation is unavailable.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated