AWS Builder Center
AWS IAM Explained Simply: Users, Roles and Policies with a Hotel Keycard Analogy

AWS IAM Explained Simply: Users, Roles and Policies with a Hotel Keycard Analogy

IAM confuses almost every AWS beginner. This plain-English guide uses a hotel analogy to explain users, groups, roles, and policies, then walks you through a 10-minute hands-on test you can try yourself.

If you are new to AWS, one service shows up everywhere and confuses almost everyone: IAM. Users, roles, policies, permissions, "Access Denied"... it can feel like a maze.
The good news: IAM is much simpler than it looks. In this article, we will explain it with one easy picture: a hotel and its keycards. At the end, you will do a 10-minute test to see IAM working with your own eyes.
Time: about 20 minutes | Cost: IAM itself is free



What is IAM?

IAM stands for Identity and Access Management. It answers two questions:
  1. Who is trying to do something? (this is the identity)
  1. What are they allowed to do? (this is the access)
Every time you click a button in AWS or run a command, IAM quietly checks: "Is this person allowed to do this?"



The hotel analogy

Imagine your AWS account is a hotel. Here is how IAM fits:
In the hotel
In AWS
What it means
The hotel
AWS account
Everything you own lives here
The owner with a master key
Root user
Can open every door, including the safe, and can close the hotel
A staff member with their own card
IAM user
One person, with their own login
A department (housekeeping, kitchen)
IAM group
A set of users who share the same access
A temporary visitor card
IAM role
Access that is handed out for a short time
The list printed on a card: "opens floors 1 and 2"
IAM policy
The rules that say what is allowed
ID check at the front desk
MFA
A second proof that you really are you
Once you see it this way, most of IAM makes sense.



The five building blocks

1. Root user: the master key

When you create an AWS account, you get a root user. It can do everything. That is powerful and dangerous. So:
  • Turn on MFA for it
  • Do not use it for daily work
  • Never create access keys for it
Think of it as the master key kept in a safe. You use it only for rare jobs.

2. IAM users: one card per person

An IAM user is one person (or one program) with their own sign-in. Never share one login between several people. If something goes wrong, you will not know who did it.

3. Groups: cards for a whole department

Instead of giving permissions to each person one by one, put people in a group (like "Developers" or "Readers") and give the permissions to the group. When someone joins the team, you just add them to the group.

4. Roles: temporary visitor cards

A role is like a visitor card. It is not tied to one person. Someone (or something) borrows it for a short time and gets temporary access.
Roles are very important in AWS, because services also need access:
  • A Lambda function that reads files from S3
  • An EC2 server that writes to a database
Those services use roles, not passwords or access keys written in code. This is safer, because temporary access expires on its own.

5. Policies: the list on the card

A policy is the written rule. It says what is allowed. Here is a tiny example:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my-photos-bucket/*"
}
]
}
Read it like a sentence:
  • Effect: Allow means "this is permitted"
  • Action: s3:GetObject means "reading (downloading) files from S3"
  • Resource means "but only in the bucket called  my-photos-bucket "
So this card says: "You may read files from my-photos-bucket. Nothing else."



The three rules that explain almost everything

Rule 1: Everything is denied by default. A new user can do nothing at all until you give permission. A new keycard opens no doors.
Rule 2: An explicit "Deny" always wins. If one policy says Allow and another says Deny for the same action, Deny wins.
Rule 3: Give only what is needed (least privilege). A cleaner needs access to the rooms, not the safe. In AWS, give each person or service the smallest set of permissions that gets the job done. If it turns out they need more, add it later.



Try it yourself (10 minutes)

Let us prove that IAM works. You will create a user who can read S3 but cannot create anything.
  1. Open the IAM console and go to User groups. Create a group named  readers .
  1. Attach the AWS managed policy AmazonS3ReadOnlyAccess to the group.
  1. Go to Users and create a user named  test-reader . Add it to the  readers  group. Give it console access and a password.
  1. Open a private (incognito) browser window and sign in as  test-reader , using your account's sign-in URL (the IAM dashboard shows it).
  1. Open S3. You can look at buckets and files.
  1. Now try to create a bucket. You will see an Access Denied message.
That message is IAM doing its job. Your user has a card that opens the "reading" doors, but not the "creating" doors.
When you are done, delete the  test-reader  user and the  readers  group.
Real-world note: For real teams, AWS recommends using IAM Identity Center for people who sign in, instead of creating many IAM users. IAM users are still fine for learning how things work.



Common beginner mistakes

  • Using the root user every day. Create a separate user or Identity Center login instead.
  • Giving everyone full admin access because it is easier. It works, until a mistake or a leaked password costs you a lot.
  • Putting access keys in code or on GitHub. Use roles instead, and never upload keys to a public repository.
  • Skipping MFA. It is one of the best protections you can switch on.
  • Never cleaning up. Delete users, roles, and keys you no longer use.

Quick summary

  • IAM decides who can do what in your AWS account
  • Root user = master key. Lock it away.
  • Users = one card per person. Groups = cards for a team.
  • Roles = temporary cards, perfect for AWS services.
  • Policies = the rules printed on the cards.
  • Everything is denied by default, Deny always wins, and you should give only what is needed.

Conclusion

IAM looks scary only because of the new words. Behind them, the idea is simple: a hotel with keycards, where every card opens only the doors it should. Once you understand that, services like S3, Lambda, and EC2 get much easier to use safely.
What part of IAM confused you the most? Tell me in the comments, and I will try to explain it in a simple way!
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article