# IAM role vs IAM user

AWS comparisons · Updated 17 November 2026

**Short answer:** Use roles for almost everything: workloads on AWS (EC2 instance profiles, ECS task roles, Lambda execution roles), CI/CD through OIDC federation, cross-account access and people signing in through IAM Identity Center. Roles hand out temporary credentials that expire. Create IAM users only for the few cases AWS lists, such as emergency break-glass access or third-party tools that cannot use roles, and protect their long-term keys.

## IAM role vs IAM user compared

| Factor | IAM role | IAM user |
|---|---|---|
| Represents | A set of permissions anyone trusted can assume | One person or application |
| Credentials | Temporary (session) credentials from STS | Long-term password and/or access keys |
| Who uses it | AWS services, federated users, other accounts, workloads | A named identity signing in or using keys |
| Access control | Permissions policies plus a trust policy saying who can assume it | Permissions policies (directly or through groups) |
| Rotation | Automatic: credentials expire | Manual: you rotate access keys |
| Cross-account | Native via `sts:AssumeRole` | Not directly; users assume roles in other accounts |
| Leak impact | Limited by session duration | Valid until someone notices and deactivates the key |

## When to use a role

- Code on EC2, ECS, EKS (Pod Identity or IRSA) or Lambda: the SDK picks up credentials automatically.
- GitHub Actions and other CI systems: OIDC federation to a role, no stored keys.
- People: IAM Identity Center or another identity provider federates them into roles in each account.
- Cross-account access: a role in the target account trusts the source account or a specific principal.
- Workloads outside AWS with certificates: IAM Roles Anywhere issues temporary credentials.

## When an IAM user is still justified

- Emergency (break-glass) access if your identity provider is unavailable, with MFA and alarms on use.
- Third-party tools or appliances that only accept an access key ID and secret.
- Specific services that require IAM user credentials, such as service-specific credentials for some database protocols.
- An account where no identity provider and no IAM Identity Center are available.

If you must use access keys: scope the policy tightly, add conditions such as `aws:SourceIp` or VPC endpoint where possible, rotate them, and alarm on use from unexpected places with CloudTrail.

## Moving from users to roles

1. Find active keys: the IAM credential report shows each key's last use and service.
2. Move people to IAM Identity Center and give them permission sets instead of user policies.
3. Move workloads to instance profiles, task roles or OIDC federation; deploy, confirm the old key is unused, then deactivate it before deleting.
4. Add an SCP or alarm that flags new access key creation outside the approved break-glass path.

## Common wrong reasons

- **"A user with a narrow policy is just as safe."** The scope may be narrow, but the credential never expires.
- **"Roles are for services, users are for people."** AWS recommends federation into roles for people too.
- **"Groups are a kind of role."** Groups only bundle policies for users; nobody signs in as a group or assumes it.

## Questions

### What is the difference between an IAM role and an IAM user?

A user is a long-term identity with its own password or access keys. A role has no long-term credentials; trusted principals assume it and receive temporary credentials.

### Can an IAM user assume a role?

Yes, if the user's policies allow sts:AssumeRole on the role and the role's trust policy trusts that user or its account.

### Should I create IAM users for my team?

No. AWS recommends IAM Identity Center or federation with your identity provider for people, with IAM users kept for the few cases that require long-term credentials.

## When this happens away from your desk

A leaked access key is an incident you want to see within minutes: unfamiliar API calls, new Regions, new resources. CloudConsole is being built to show alarms and recent activity on a phone with production guardrails.

[About the CloudConsole app](https://cloudconsole.dev/aws-console-app) · [Download on the App Store](https://apps.apple.com/app/cloudconsole-for-aws/id6835419710)

## Sources

- [IAM roles](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html)
- [Use cases for IAM users](https://docs.aws.amazon.com/IAM/latest/UserGuide/gs-identities-iam-users.html)
- [Security best practices in IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html)

## Related

- [IAM Identity Center vs IAM users](https://cloudconsole.dev/vs/iam-identity-center-vs-iam-users)
- [SCP vs permissions boundary](https://cloudconsole.dev/vs/scp-vs-permission-boundary)
- [How to rotate IAM access keys](https://cloudconsole.dev/how-to/rotate-iam-access-keys)
- [How to find unused IAM access keys](https://cloudconsole.dev/how-to/find-unused-iam-access-keys)
- [AccessDenied: User is not authorized to perform: sts:AssumeRole](https://cloudconsole.dev/errors/not-authorized-to-perform-sts-assumerole)
- [How to switch role with the AWS CLI](https://cloudconsole.dev/how-to/switch-role-aws-cli)

---

Source: https://cloudconsole.dev/vs/iam-role-vs-iam-user

CloudConsole is an independent iPhone and Android app for Amazon Web Services by Cloudconcur Ltd. It is not affiliated with Amazon Web Services.
