GCP cheat sheet

GCP provides scalable services and SRE-friendly operations tooling.

On this page

Table of contents

Use this page for fast recall. Use Full documentation when you want the complete end-to-end path.

Quick workflow

A simple 5-step flow you can follow when using GCP in real work.

1) Setup

Install/run the tool and confirm version. Create a minimal config.

2) Small change

Do one small action end-to-end to prove the workflow.

3) Validate

Check output, logs, and status. Catch mistakes early.

4) Automate

Convert it into a repeatable script or pipeline step.

5) Productionize

Add safety: secrets, rollback, observability, and docs.

Workflows you will actually reuse

These are practical sequences you can copy into your own checklist or runbook.

Project setup to deployment

Goal: Get a clean project with permissions and a first deploy.

- Set the project and enable required APIs.

- Use service accounts for workloads (least privilege).

- Deploy to Cloud Run or GKE depending on runtime needs.

- Add logging/monitoring and basic alerts.

- Document the deploy and rollback steps.

Key Concepts

- Projects

- IAM

- Managed platforms

Learning path (high-level):

- Project setup

- Service deployment

- Reliability operations

Quick Start

Init CLI

Command

gcloud init

Set project

Command

gcloud config set project <project-id>

List compute

Command

gcloud compute instances list

Common Commands

Short descriptions and practical intent. Search, filter, copy, and reuse.

Showing 10

Basics
gcloud auth list

List authenticated accounts.

Basics
gcloud projects list

List available projects.

Basics
gcloud config set project <project-id>

Set the current project.

Compute
gcloud compute instances list

List VM instances.

Kubernetes
gcloud container clusters list

List GKE clusters.

Kubernetes
gcloud container clusters get-credentials <cluster> --region <region>

Configure kubectl for GKE.

Platforms
gcloud run services list

List Cloud Run services.

Platforms
gcloud run deploy <svc> --image <img> --region <region>

Deploy to Cloud Run.

Observability
gcloud logging read 'severity>=ERROR' --limit=20

Read recent error logs.

IAM
gcloud iam service-accounts list

List service accounts.

Copyable snippets

Small blocks you can drop into your terminal, config, or runbook.

Set project and list services

bash

gcloud auth list
gcloud config set project <project-id>
gcloud run services list

Troubleshooting checklist

When things break, follow this order to stay calm and move fast.

- If gcloud fails: check active account, project, and API enablement.

- If deploy fails: check build logs, IAM permissions, and region settings.

Pitfalls

The common mistakes that slow people down when using GCP.

- Copy-pasting commands without understanding inputs/outputs and side effects.

- Not documenting defaults (ports, paths, credentials) and then getting stuck in prod.

- Skipping logs and metrics when troubleshooting; always collect evidence first.

Mini lab (practice)

Do these tasks in order. You will feel the tool instead of just reading about it.

- Install or run the tool locally (or in Docker) and verify it works with a hello-world action.

- Create a minimal config and run the most common command 3 times (with a small change each time).

- Break something on purpose and document how you debugged it in your Notes.

Interview prompts

Use these to test if you truly understand the basics (and can explain them clearly).

- Explain the tool’s role in a real CI/CD pipeline from commit to production.

- Describe the most common failure you’ve seen with this tool and how you fixed it.

- What would you monitor/alert on for this tool in production?

Official Docs

https://cloud.google.com/docs