Identity, Access and Least Privilege

Design who and what can access your systems: SSO for humans, workload identity for machines, scoped roles and auditable break-glass access.

Intermediate · about 5 hours · difficulty 3/5

Learn first: AWS Core Services, Configuration, Secrets, Storage and RBAC

Most serious cloud incidents come down to identity: a leaked key with admin rights, a role anyone could assume, a forgotten user. Getting IAM right is one of the highest-value things a DevOps engineer does.

Principles

  • Least privilege: grant only the actions and resources needed, then tighten further with conditions.
  • No long-lived credentials: humans use SSO with MFA and get temporary sessions; workloads use roles and workload identity (IRSA or EKS Pod Identity, Azure workload identity, GKE Workload Identity); CI uses OIDC federation.
  • Separate environments into different accounts, subscriptions or projects so a dev mistake cannot touch prod.
  • Audit everything: CloudTrail, Azure Activity Log, Cloud Audit Logs, and Kubernetes audit logs.

Reading and writing policies

Understand the pieces of a policy: principal, action, resource, condition, and effect (allow or deny). Know how explicit denies, permission boundaries and organisation-level guardrails (Service Control Policies, Azure Policy, Organization Policy) combine. Use access analysers and last-used data to remove unused permissions.

Kubernetes RBAC

Roles and ClusterRoles, bound to users, groups and service accounts. Avoid cluster-admin for apps, disable automounting service account tokens where not needed, and map cloud IAM groups to cluster roles.

Break-glass and reviews

Keep an emergency admin path that is locked away, alarmed and reviewed after use. Run periodic access reviews and remove leavers promptly; just-in-time elevation tools grant admin for an hour instead of forever.

Good enough to move on: you can write a scoped policy for an app that reads one bucket and one secret, give a Kubernetes pod cloud access with workload identity, and find unused permissions with an access analyser.

Key concepts

  • Least privilege and conditions
  • SSO and MFA for humans
  • Roles and workload identity
  • OIDC federation for CI
  • Policy evaluation and guardrails
  • Kubernetes RBAC and service accounts
  • Audit logs
  • Break-glass and access reviews

Mini project

Remove every static access key from one of your projects: SSO for your own access, OIDC for CI, and workload identity for the app's pods, each with a least-privilege policy, and verify with the audit log.

Check yourself

A policy allows s3:* on all resources, and an organisation guardrail denies s3:DeleteBucket. Can the role delete a bucket? Why?

Free resources