GCP (Google Cloud Platform)
Overview
Google Cloud Platform offers compute (Compute Engine, Cloud Run, GKE), storage (Cloud Storage), databases, networking, and IAM across Google's global infrastructure. The Google Cloud CLI (gcloud, part of the Google Cloud SDK) is the unified tool for managing and scripting these resources. Read this when you need to provision, manage, or automate GCP infrastructure.
Official sources
Install / setup
Linux, copied verbatim from the official install page:
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-linux-x86_64.tar.gz
tar -xf google-cloud-cli-linux-x86_64.tar.gz
./google-cloud-sdk/install.sh
Core concepts
- Projects: the top-level container for resources, billing, and permissions; nearly everything belongs to a project.
- IAM: roles and policies binding members (users, service accounts) to permissions on resources.
- Service accounts: non-human identities used by workloads to call GCP APIs.
- Regions & zones: resources are deployed to zones within regions for locality and redundancy.
- Compute options: Compute Engine (VMs), Cloud Run (containers, serverless), and GKE (managed Kubernetes).
- gcloud config: the active project, account, and region/zone are stored in a CLI configuration.
Best practices
- Set the active project/region in your gcloud config (or pass
--project) so commands target the intended resources.
- Grant least-privilege IAM roles and use service accounts for workloads instead of personal credentials (per GCP IAM docs).
- Use Workload Identity / short-lived credentials for CI rather than downloading long-lived service-account key files.
- Separate environments into distinct projects to isolate billing, quotas, and blast radius.
Common pitfalls
- Forgetting to set the active project → commands fail or hit the wrong project.
- Downloading and committing service-account JSON keys → credential leakage; prefer keyless/short-lived auth.
- Over-broad primitive roles (Owner/Editor) → use predefined or custom least-privilege roles instead.
Examples
# Authenticate and select the active project
gcloud auth login
gcloud config set project my-project-id
# List compute instances
gcloud compute instances list
Further reading
Related skills
- ../aws — comparable hyperscale cloud platform
- ../kubernetes — container orchestration often run on GCP (GKE)
1---2name: gcp3description: Google Cloud Platform and the gcloud CLI; consult for compute, storage, networking, IAM, and scripting GCP resources.4domain: stack5category: infra6tags: [cloud, gcp, gcloud, iam, compute, cli]7official_sources:8 - https://cloud.google.com/docs9 - https://cloud.google.com/sdk/docs/install10verified: 2026-06-1611metadata:12 source: https://skillmd.com/skills/gabriel7silva/gcp13---1415# GCP (Google Cloud Platform)1617## Overview18Google Cloud Platform offers compute (Compute Engine, Cloud Run, GKE), storage (Cloud Storage), databases, networking, and IAM across Google's global infrastructure. The Google Cloud CLI (`gcloud`, part of the Google Cloud SDK) is the unified tool for managing and scripting these resources. Read this when you need to provision, manage, or automate GCP infrastructure.1920## Official sources21- Docs: https://cloud.google.com/docs22- CLI install: https://cloud.google.com/sdk/docs/install23- Note: the gcloud CLI / Google Cloud SDK is a Google-distributed product without a single canonical public source repo; install from the official download above. The GoogleCloudPlatform GitHub org (https://github.com/GoogleCloudPlatform) hosts samples and tooling such as the cloud-sdk-docker image.2425## Install / setup26Linux, copied verbatim from the official install page:27```bash28curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-linux-x86_64.tar.gz29tar -xf google-cloud-cli-linux-x86_64.tar.gz30./google-cloud-sdk/install.sh31```3233## Core concepts34- Projects: the top-level container for resources, billing, and permissions; nearly everything belongs to a project.35- IAM: roles and policies binding members (users, service accounts) to permissions on resources.36- Service accounts: non-human identities used by workloads to call GCP APIs.37- Regions & zones: resources are deployed to zones within regions for locality and redundancy.38- Compute options: Compute Engine (VMs), Cloud Run (containers, serverless), and GKE (managed Kubernetes).39- gcloud config: the active project, account, and region/zone are stored in a CLI configuration.4041## Best practices42- Set the active project/region in your gcloud config (or pass `--project`) so commands target the intended resources.43- Grant least-privilege IAM roles and use service accounts for workloads instead of personal credentials (per GCP IAM docs).44- Use Workload Identity / short-lived credentials for CI rather than downloading long-lived service-account key files.45- Separate environments into distinct projects to isolate billing, quotas, and blast radius.4647## Common pitfalls48- Forgetting to set the active project → commands fail or hit the wrong project.49- Downloading and committing service-account JSON keys → credential leakage; prefer keyless/short-lived auth.50- Over-broad primitive roles (Owner/Editor) → use predefined or custom least-privilege roles instead.5152## Examples53```bash54# Authenticate and select the active project55gcloud auth login56gcloud config set project my-project-id5758# List compute instances59gcloud compute instances list60```6162## Further reading63- https://cloud.google.com/sdk/gcloud — gcloud command reference64- https://cloud.google.com/iam/docs — IAM documentation6566## Related skills67- ../aws — comparable hyperscale cloud platform68- ../kubernetes — container orchestration often run on GCP (GKE)