Course contentsShow
← Cloud and Infrastructure
Lesson 393 of 2,9897. Identity and Access ManagementFree lesson

GCP Service Accounts

Creating and managing service accounts for GCP resources and applications to authenticate.

GCP Service Accounts

What You'll Learn

You'll learn how GCP service accounts work as special identities for applications and resources to authenticate securely without human credentials.

Why Service Accounts Matter

In GCP, service accounts are non-human identities designed for applications, VMs, and automated processes—not people. Think of them as robot employees: they need access to do their jobs, but they don't log in like humans do.

Where user accounts represent actual people (you), service accounts represent workloads—a Compute Engine VM, a Cloud Function, or a custom application running in your project.

How Service Accounts Work

Every GCP project automatically creates a default service account (looks like PROJECT_NUMBER-compute@developer.gserviceaccount.com). Resources can use this identity, but best practice is creating custom service accounts with specific, limited permissions.

Creating a Service Account

You define:

  • Name: descriptive identifier (e.g., inventory-app-sa)
  • Display name: human-readable label
  • Roles: what permissions it has (using IAM roles you already know)

Using Service Accounts

Applications authenticate by:

  1. Attaching the service account to a GCP resource (like a VM)
  2. Downloading a service account key (JSON file) for external applications
  3. Using Workload Identity to link Kubernetes pods to service accounts

The service account then acts on behalf of the application, accessing only what its assigned roles permit.

Analogy

A service account is like an employee badge for robots. Human employees swipe their personal badges; automated systems use service account badges—each with exactly the permissions needed for their tasks, no more.

Key Takeaway: GCP service accounts are non-human identities that let applications and resources authenticate securely, following the principle of least privilege you learned earlier.