Users, Groups, Roles & Policies

The four building blocks of IAM and when to use each one.

1 min read

IAM has only four core ideas. Once these click, the rest is detail.

Building blockWhat it isEveryday comparison
UserA long-term identity for one person or app, with a password and/or access keys.A named employee badge.
GroupA collection of users that share permissions.A department, like "Developers".
RoleAn identity anyone trusted can temporarily take on. It has no password, and its credentials expire automatically.A visitor pass handed out at the desk and returned at the end of the day.
PolicyA JSON document listing what is allowed or denied. Attached to users, groups, or roles.The list of doors a badge opens.

Roles are the star of the show

When a Lambda function needs to read from S3, you don't give it a username and password. You give it a role. AWS hands the function short-lived credentials that rotate automatically. Nothing gets hard-coded and nothing can leak into Git.

Tip

Rule of thumb: people sign in through IAM Identity Center (single sign-on), and AWS services and apps use roles. Long-lived IAM users with access keys should be rare.

The root user

The email address you signed up with is the root user. It can do everything, including closing the account. Turn on MFA for it, then lock it away and use it almost never.

How it flows
  1. 1Identity

    User, or a service like Lambda

  2. 2Assumes a role

    Gets temporary credentials

  3. 3Policy checked

    Is this action allowed?

  4. 4Request runs

    Or is denied

Key takeaways

  • Users are long-term identities, groups bundle users, roles are temporary, and policies hold the rules.
  • AWS services such as Lambda should always use roles, never stored access keys.
  • Protect the root user with MFA and avoid using it day to day.

Check your understanding

Pick an answer to see the explanation.

  1. 1. Your Lambda function needs to read files from S3. What should you give it?

  2. 2. What is special about the root user?