A Cloud Architect needs to run a resource-intensive script (processing 10GB of data) that takes 2+ hours to complete. Cloud Shell sessions terminate after 20 minutes of inactivity. What is the best approach?

Direct Answer (Verified)Reviewed by Sunny (Senior Cloud Engineer)

Correct Answer: Use `gcloud alpha cloud-shell ssh` to connect and run the script in a `tmux` or `screen` session, or better — submit the job to Cloud Batch or a Compute Engine VM

Cloud Shell is designed for interactive, lightweight tasks — not long-running compute jobs. For resource-intensive scripts: (1) Cloud Batch is purpose-built for batch jobs with aut...

📋Part of Professional Cloud Architect · GCP Certification Practice
Real Exam Scenario

A Cloud Architect needs to run a resource-intensive script (processing 10GB of data) that takes 2+ hours to complete. Cloud Shell sessions terminate after 20 minutes of inactivity. What is the best approach?

✓ Correct Answer & Explanation

Correct Answer

Use `gcloud alpha cloud-shell ssh` to connect and run the script in a `tmux` or `screen` session, or better — submit the job to Cloud Batch or a Compute Engine VM

Why This Answer Is Correct

Cloud Shell is designed for interactive, lightweight tasks — not long-running compute jobs. For resource-intensive scripts: (1) Cloud Batch is purpose-built for batch jobs with auto-scaling and retry. (2) Compute Engine VMs persist indefinitely. (3) Connecting via `gcloud alpha cloud-shell ssh` with `tmux`/`screen` maintains the session even if the browser disconnects, but Cloud Shell still has resource and usage limits. `nohup` prevents hangup signals but doesn't prevent Cloud Shell's inactivity timeout.