Intrigued by the art of cloud architecture? Discover how to design, develop, and manage robust, secure, scalable, and dynamic solutions on Google Cloud as you prepare for the Professional Cloud Architect exam!
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.
A lead cloud engineer uses Google Cloud Shell to perform administrative tasks, execute deployment scripts, and manage cloud resources using command-line tools. The engineer encounters a problem where custom system utilities installed via the Debian package manager are lost whenever the Cloud Shell session terminates due to 40 minutes of inactivity and a new virtual machine instance is provisioned.
The engineer has the following requirements:
gcloud CLI preferences persist across sessions and apply to new terminal tabs.Which approach should the engineer implement?
Google Cloud Shell is an on-demand, Debian-based virtual machine pre-loaded with developer and administrative utilities such as the gcloud CLI, Terraform, and Docker. While the underlying VM instance is ephemeral and gets recycled after 40 minutes of inactivity or a maximum session length of 12 hours, Cloud Shell provides a 5 GB persistent disk storage volume mounted at $HOME that survives across instance restarts and terminations.
$HOME/.customize_environment instructs Cloud Shell to run package installation commands (such as apt-get update && apt-get -y install ) with root privileges in the background during instance startup. Because this script executes once when the VM boots, required Debian packages are automatically restored.$HOME/.bashrc persist between sessions on the home disk and are sourced every time a new interactive subshell or tab is launched.$HOME ensures they are saved to the persistent 5 GB disk storage rather than the ephemeral root filesystem.$HOME/.customize_environment script runs automatically on boot without requiring manual re-installation steps.$HOME/.bashrc ensures environment variables and gcloud property overrides propagate across all newly opened tabs.This solution leverages built-in Cloud Shell lifecycle hooks and persistent storage primitives. It solves the ephemeral filesystem limitation cleanly by isolating customizations to the persistent home directory and boot scripts.
Keep the momentum going with these hand-picked practice scenarios
Want more questions like this?
Get a free certification question every week.