GCP ACE Practice / Study guide / Topics / Infrastructure as Code & Cloud Shell
Infrastructure as Code & Cloud Shell
What actually gets tested on the Google Cloud Associate Cloud Engineer exam,
the traps to know, and 6 free sample questions with full explanations.
Cloud Shell is a free, browser-based shell with the Cloud SDK, kubectl, Terraform, and most common tools preinstalled — genuinely useful for interactive admin work without setting up a local environment. The exam-relevant detail is what persists and what doesn't: Cloud Shell provisions an ephemeral VM per session, but mounts a persistent 5 GB $HOME, so files, scripts, and configs saved there survive between sessions while anything installed outside $HOME does not. Sessions also end after roughly 20 minutes of inactivity and are subject to weekly usage limits, which makes Cloud Shell wrong for long-running jobs — those belong on a VM, Cloud Build, or another durable compute option.
Cloud Shell also includes a full graphical code editor over your persistent $HOME, plus a Web Preview feature that proxies a port from the Cloud Shell VM to your browser — useful for quickly checking a locally-running web app without deploying it anywhere first.
On infrastructure as code more broadly: the exam doesn't expect deep Terraform authorship, but it does expect you to recognize IaC as the right answer whenever a scenario is about repeatable, version-controlled infrastructure changes rather than manual console clicks — the same instinct that favors instance templates + managed instance groups over hand-created VMs, or Deployment Manager/Terraform over a one-off gcloud command typed once and never recorded anywhere.
Exam tips for this topic
- Cloud Shell's VM is ephemeral per session, but $HOME (5 GB) persists — anything installed outside $HOME is gone at the next session.
- Cloud Shell sessions end after ~20 minutes idle and have weekly usage limits — wrong tool for long-running jobs; use a VM, Cloud Build, or another durable option instead.
- "Repeatable" or "version-controlled" infrastructure changes point toward IaC (Terraform/Deployment Manager) over manual console clicks or one-off commands.
Sample questions — Infrastructure as Code & Cloud Shell
These 6 questions are drawn from our full bank of 658 to show the style and
depth you'll get in the app. Each comes with the full explanation you'd see after answering
in a real practice session.
Cloud Shell
You need a machine with gcloud, kubectl, and terraform pre-installed to run a few admin commands, without installing anything locally. What is the fastest option?
- Use Cloud Shell from the Google Cloud consoleCorrect
- Create a Compute Engine VM and install the tools
- Use the Cloud Mobile App
- Install Docker locally and pull the SDK image
Why: Cloud Shell is a free, browser-based shell with the Cloud SDK, kubectl, terraform, and many tools preinstalled, plus 5 GB of persistent home storage — ideal for quick admin work. A VM or local Docker adds setup time, and the mobile app is for monitoring and basic management, not full CLI work.
IaC
Your team wants all infrastructure declared in versioned code with plan/preview before changes. The de-facto standard tool on Google Cloud today is:
- Terraform with the Google provider (Infrastructure Manager as the managed runner)Correct
- Bash scripts of gcloud commands
- Deployment Manager (recommended for all new work)
- Editing the console faster
Why: Terraform is the dominant IaC on Google Cloud (Google's Infrastructure Manager runs it as a service); it previews plans and stores state. Deployment Manager is legacy/deprecated-adjacent for new projects, and script piles have no state or plan.
Cloud Shell
Which statement about Cloud Shell is true?
- Your $HOME directory persists between sessions, but the VM itself is ephemeralCorrect
- The entire VM persists indefinitely, including installed system packages
- Nothing persists between sessions
- It requires you to attach your own persistent disk
Why: Cloud Shell provisions an ephemeral VM per session, but mounts a persistent 5 GB $HOME so files, scripts, and configs survive. Software installed outside $HOME is lost when the session recycles, and no disk management is needed or possible.
IaC
A teammate reviewing your CI pipeline asks what its terraform plan and terraform apply steps do respectively. What is the answer?
- plan previews changes between config and real state; apply executes themCorrect
- plan applies changes; apply schedules them
- Both only validate syntax
- plan destroys unmanaged resources
Why: plan computes an execution diff (create/update/destroy) without touching anything; apply performs it (showing the plan again first by default). Nothing is destroyed unless the plan says so.
Cloud Shell
Which is a limitation of Cloud Shell you should plan around?
- Sessions time out with inactivity and the VM is recycled, so long-running jobs shouldn't run thereCorrect
- It cannot run gcloud commands that create or modify resources — only read-only operations
- It bills the project per minute of terminal activity, so idle sessions accumulate charges
- It has no outbound internet access, so installing packages or calling external APIs fails
Why: Cloud Shell is for interactive admin work: sessions end after inactivity (about 20 minutes) and there are weekly usage limits, so long jobs belong on a VM, Cloud Run job, or build service. It is free, has the SDK preinstalled, and has outbound internet access.
IaC
You are pitching IaC to a team at your company that manages everything by console clicking. Why is IaC preferred for production? (Choose two.)
- Changes are reviewable/versioned and environments are reproducibleCorrect
- Drift is detectable and deployments are repeatable across projectsCorrect
- It makes resources run faster
- It removes the need for IAM
Why: IaC buys review, history, reproducibility, and drift detection — governance benefits. It has zero effect on runtime performance and complements (never replaces) IAM.
Practice this for real
The app has dozens more questions on this and every other topic, with instant scoring,
spaced repetition of what you get wrong, and progress tracking across sessions.
Start practicing →
This topic shows up in
Other topics