Prepare and test your skills
Prepare and test your skills
Free sample question, answered and explained below. The Professional Cloud Architect practice bank has 2,335 more like it. Try 10 free: instant score, no account.
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?
/etc/cron.hourly to reinstall utilities.This option enables Ephemeral mode in Cloud Shell, attempts to mount a custom secondary disk for persistent files, and uses a system cron directory (/etc/cron.hourly) to handle utility installation.
$HOME disk. When a session in Ephemeral mode ends, all files and changes created during the session are immediately discarded./etc/cron.hourly directory exists on the ephemeral root disk and will not persist across instance restarts, rendering any scheduled cron jobs lost.The engineer specifically required a completely fresh, stateless environment with faster initial connection performance and had no need to persist files, keys, or scripts.
sudo apt-get installation commands directly inside $HOME/.bashrc, and set CLOUDSDK_CONFIG=/tmp/gcloud to persist gcloud settings.This approach places package manager commands (apt-get) directly inside $HOME/.bashrc and sets the CLOUDSDK_CONFIG environment variable to point to a folder inside /tmp.
$HOME/.customize_environment (which runs once at boot time as root), $HOME/.bashrc is evaluated every single time an interactive shell or new terminal tab is opened. Running apt-get on every tab launch causes substantial latency, permission issues (if run without non-interactive passwordless configuration), and unnecessary overhead.CLOUDSDK_CONFIG to /tmp/gcloud places CLI configuration files in a temporary directory that does not persist across session recycling, causing configuration properties to reset..bashrc execute as the standard user, requiring explicit privilege escalation, whereas .customize_environment is executed natively as root./tmp are wiped upon instance termination.The user only wanted to define lightweight user-space environment variables, paths, and shell aliases that do not require root package management.
$HOME/.customize_environment, configure CLI preferences and aliases in $HOME/.bashrc, and store scripts within the $HOME directory.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.
/etc/profile.d/startup.sh, set default CLI configurations in /tmp/.gcloud, and store scripts in /var/scripts.This option attempts to configure system-wide startup commands by writing a shell script inside /etc/profile.d/ and placing custom application scripts inside /var/scripts and /tmp/.gcloud.
$HOME—including /etc, /tmp, and /var—resides on the temporary root disk. When the session reaches 40 minutes of inactivity, the instance is destroyed, and all modifications made to these directories are permanently discarded./tmp: The /tmp directory is wiped across sessions and is unsuitable for persistent CLI preferences or project code./etc/profile.d/startup.sh is lost when the VM instance terminates, it will not exist when a new VM is provisioned on subsequent logins./home/ are not preserved on persistent storage.$HOME/.customize_environment boot trigger provided by the Cloud Shell platform.The workload ran on a dedicated, non-ephemeral Compute Engine VM where root filesystem modifications are written to a permanent boot disk attached to a single continuous instance.
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