Users, Groups, Roles & Policies
The four building blocks of IAM and when to use each one.
IAM has only four core ideas. Once these click, the rest is detail.
| Building block | What it is | Everyday comparison |
|---|---|---|
| User | A long-term identity for one person or app, with a password and/or access keys. | A named employee badge. |
| Group | A collection of users that share permissions. | A department, like "Developers". |
| Role | An 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. |
| Policy | A 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.
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.
- 1Identity
User, or a service like Lambda
- 2Assumes a role
Gets temporary credentials
- 3Policy checked
Is this action allowed?
- 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. Your Lambda function needs to read files from S3. What should you give it?
2. What is special about the root user?