# IAM Users, Groups, Roles and Policies

> Learn the building blocks of AWS identity and why roles with temporary credentials beat users with long-term keys. Free notes, key concepts, resources and a...

Canonical: https://www.internhack.in/roadmaps/tracks/cloud-engineer/iam-fundamentals
Last updated: 2026-11-28

Learn the building blocks of AWS identity and why roles with temporary credentials beat users with long-term keys.

Beginner · about 5 hours · difficulty 2/5

Learn first: [AWS CLI, CloudShell and SDKs](https://www.internhack.in/roadmaps/tracks/cloud-engineer/aws-cli)

Every AWS API call is checked by IAM: who is calling (the **principal**), what are they trying to do (the **action**), on what (the **resource**), and is it allowed (the **policy**). The Azure equivalent is Entra ID plus Azure RBAC; in GCP it is Cloud IAM.

### Identities

- **IAM users**: long-term identities with passwords and optional access keys. Use sparingly; prefer Identity Center for humans.
- **Groups**: collections of users to attach policies to. You cannot log in as a group.
- **Roles**: identities with no long-term credentials. Something **assumes** the role and receives temporary credentials from STS. EC2 instances, Lambda functions, ECS tasks, CI pipelines and other accounts all use roles.

### Policies

- A policy is a JSON document with **Effect** (Allow or Deny), **Action** (s3:GetObject), **Resource** (an ARN) and optional **Condition**.
- **AWS managed policies** are convenient but often too broad. **Customer managed policies** let you scope exactly.
- **Inline policies** are attached to one identity; use them only for strict one-to-one cases.

### Least privilege

Start with nothing and add what is needed. **IAM Access Analyzer** can generate policies from real CloudTrail activity and flag resources shared outside your account.

### Pitfalls

- Giving every developer AdministratorAccess.
- Creating access keys for humans when SSO would work.
- Using "Resource": "\*" when you know the exact bucket or table.

You are ready to move on when you can explain user vs role, read a policy and say what it allows, and describe why an EC2 instance should use a role instead of stored keys.

## Key concepts

- **Principals, actions, resources**
- **Users and groups**
- **Roles and temporary credentials**
- **Policy JSON structure**
- **ARNs**
- **AWS managed vs customer managed policies**
- **Least privilege**
- **IAM Access Analyzer**

## Mini project

Create a group 'readonly-students' with a customer managed policy that only allows listing and reading one specific S3 bucket. Add a test user, sign in as them and confirm they cannot read any other bucket or launch EC2. IAM itself is free; delete the test user afterwards.

## Check yourself

What is the difference between an IAM user with access keys and an IAM role, and which would you give a Lambda function?

## Free resources

- [IAM User Guide](https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction.html) (AWS)
- [Security best practices in IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html) (AWS)
- [AWS Skill Builder](https://skillbuilder.aws/) (AWS)

Previous: [AWS CLI, CloudShell and SDKs](https://www.internhack.in/roadmaps/tracks/cloud-engineer/aws-cli) · Next: [Policy Evaluation, Conditions and Resource Policies](https://www.internhack.in/roadmaps/tracks/cloud-engineer/iam-policy-evaluation)

## More in Identity and Access Management in Depth

- [IAM Users, Groups, Roles and Policies](https://www.internhack.in/roadmaps/tracks/cloud-engineer/iam-fundamentals)
- [Policy Evaluation, Conditions and Resource Policies](https://www.internhack.in/roadmaps/tracks/cloud-engineer/iam-policy-evaluation)
- [STS, Assume Role and Federation](https://www.internhack.in/roadmaps/tracks/cloud-engineer/iam-roles-federation)
- [Multi-Account Strategy with AWS Organizations](https://www.internhack.in/roadmaps/tracks/cloud-engineer/organizations-scps)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Cloud Engineer (AWS) Roadmap](https://www.internhack.in/roadmaps/tracks/cloud-engineer)
