Course map

Topic 176 / Core

Cloud IAM and service identities

Chapter 11.1 · Cloud Fundamentals

What and why

Every request into a cloud account — a developer deploying, a service calling another service, an automated pipeline provisioning infrastructure — needs to be authenticated and authorized, or the account is one leaked credential away from total compromise. Cloud IAM is the provider's system of principals (users, groups, roles), permissions, and policies that decides who or what can do what to which resource. Service identities extend the same system to non-human callers — a running workload gets its own identity instead of a human's long-lived key embedded in config. Builds on: → 163 (RBAC and ABAC: resource-level authorization).

Diagram

Principal type Example Credential Rotation
Human user developer console login password + MFA periodic
Role "deploy-prod," assumed temporarily short-lived token automatic, minutes–hours
Service identity a running workload's own identity issued by the platform, no stored secret continuous

How it works

  1. Define principals: human users, groups, and roles — a role is a bundle of permissions a principal can assume, usually temporarily.
  2. Attach policies to principals or resources, stating allowed actions on specific resources — least privilege means granting only the actions a principal demonstrably needs, nothing broader "to be safe."
  3. For workload-to-workload calls, assign the workload a service identity native to the platform rather than embedding a human's or a static API key inside its config — the platform issues short-lived credentials automatically and rotates them with no code change.
  4. Permission checks happen on every API call to the cloud provider: a role without the write permission on a resource is denied, regardless of network access.
  5. Audit every grant: unused permissions accumulate; a periodic review that removes them keeps the blast radius of a compromised principal small.
  6. This is the cloud's concrete expression of zero trust (→ 169): no implicit trust from network location alone, every call is checked against an explicit policy.

Practical example

(numbers illustrative). A payment service needs to read from one specific queue and write to one specific table. A broad "admin" role would let a bug or a compromise touch every resource in the account; a scoped service identity with exactly read on that queue and write on that table bounds a worst-case compromise to those two resources — the blast radius drops from "entire account" to "one queue, one table."

When to use it

  • Use a dedicated service identity per workload, scoped to only what it calls — never share one broad identity across unrelated services.
  • Use roles with short-lived, automatically rotated credentials for human access instead of permanent keys.
  • Avoid embedding long-lived secrets (access keys) in service config or source — they don't rotate, they leak into logs and version history, and they outlive the service that needed them (→ 165 for what to do with any secret that must exist).
  • Failure scenarios: an overly broad role granted "temporarily" during an incident and never revoked; a service identity reused across services so compromising the least-trusted one compromises them all; stale permissions nobody remembers granting, discovered only during an audit or a breach.
  • Simpler alternative: for a single small account with few services, a small number of broad-but-reviewed roles is manageable; fine-grained per-workload identities earn their complexity once the number of services and people grows.

Practice

(process kind, 20 min, paper exercise). Take three services (a public API, a batch job, a CI pipeline) and write the minimal policy statement each needs (resource + action), then state what a compromise of each identity could reach under your policy versus under a single shared "admin" identity. Done when each service's blast radius is named and smaller than "the whole account."

Key takeaway

Cloud IAM extends familiar authorization models (→ 163) to cloud resources and non-human callers; least-privilege service identities bound the damage of any single compromise. Done when you can: write a least-privilege policy for a workload and explain why a shared broad identity is worse, not just lazier. Used next in → 177 (VPC, the network-layer complement to IAM's identity layer), → 190 (platform engineering templates safe IAM defaults).

References

None — this topic makes no external claims.

Source directory

Search the guide