IAM & cloud security

Least privilege, roles vs users, instance profiles, secrets management. Security questions decide senior loops.

About 20 min read3-question knowledge check

The mental model

Think of a cloud account as a large office building with an electronic badge system.

  • An IAM user is a permanent employee badge with a photo and a password. It exists until someone deletes it, and if it is photocopied, the copy works forever.
  • An IAM role is a visitor badge at reception: you prove who you are, you are handed a badge that works for one hour, and it expires by itself. Nobody carries it home.
  • A policy is the list of doors the badge opens, written on the badge system rather than on the badge.
  • Least privilege is the rule that a badge opens only the doors that job actually requires — the accountant's badge does not open the server room, not because we distrust the accountant but because a stolen badge should be boring.

The single most important consequence for DevOps: workloads should never hold a permanent badge. An EC2 instance, an ECS task, a Kubernetes pod, or a GitHub Actions job should assume a role and receive credentials that expire in an hour. That converts "a leaked key is a breach" into "a leaked credential is already useless".

The second consequence is that permission evaluation is not a single list. Multiple systems get a vote — an explicit Deny anywhere always wins, an organisation-level guardrail can veto an account-level allow, and a resource (an S3 bucket, a KMS key) has its own opinion about who may touch it.

The full lesson continues with 15 more sections
  • Deep dive
  • Internal architecture
  • Real-world use cases
  • Best practices
  • Common mistakes
  • Performance
  • Security
  • Production troubleshooting
  • Advantages & disadvantages
  • Alternatives
  • Interview expectations
  • Interview questions
  • Facts to remember
  • Cheat sheet
  • Quick revision