A developer uses Cloud Shell to run `gcloud` commands that modify production resources. As a Cloud Architect, what control should you implement to prevent accidental production changes from Cloud Shell?

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

Correct Answer: Use IAM Conditions to restrict the developer's permissions based on resource labels (e.g., `env=prod`) or use separate service accounts with least-privilege roles per environment

IAM Conditions allow granting permissions only when specific resource attributes (like labels, resource names, or time-of-day) match. A condition like `resource.labels["env"] != "p...

๐Ÿ“‹Part of Professional Cloud Architect ยท GCP Certification Practice
Real Exam Scenario

A developer uses Cloud Shell to run `gcloud` commands that modify production resources. As a Cloud Architect, what control should you implement to prevent accidental production changes from Cloud Shell?

โœ“ Correct Answer & Explanation

Correct Answer

Use IAM Conditions to restrict the developer's permissions based on resource labels (e.g., `env=prod`) or use separate service accounts with least-privilege roles per environment

Why This Answer Is Correct

IAM Conditions allow granting permissions only when specific resource attributes (like labels, resource names, or time-of-day) match. A condition like `resource.labels["env"] != "prod"` prevents the developer from modifying production resources even from Cloud Shell. Separately, developers should use non-prod service accounts with restricted roles. Disabling Cloud Shell organization-wide harms productivity. VPC Service Controls restrict service APIs, not IAM permissions on labeled resources.