IAM Fundamentals: Users, Roles and Least Privilege
Identity and access management decides who can do what in your cloud account. This guide covers users versus roles, how permission decisions resolve, and how to apply least privilege without blocking work.
Identity and access management is the control that decides every other control. A firewall rule, an encryption setting and a backup policy are all only as strong as the permission model that governs who can change them. Get the identity model right and most other mistakes are recoverable. Get it wrong and a single leaked credential can reach everything.
The subject has a reputation for being tedious, and the reputation is earned. But the core ideas are small in number, and once you can describe them accurately the provider-specific syntax stops being intimidating.
The vocabulary worth being precise about
Four terms carry most of the meaning, and people routinely conflate them.
An identity is a thing that can make a request: a person, an application, a service. A credential is the proof attached to that identity, such as a password, an access key or a short-lived token. A policy is a written statement of what actions an identity may take against which resources. A permission is the result of evaluating all applicable policies for one specific request.
The distinction between credential and identity matters more than it sounds. Rotating a credential does not change what the identity can do. Deleting a policy does not revoke a token that is already issued. Treating the two as one thing is why incident response so often misses a step.
Users are not roles, and the difference is the point
A user is a long-lived identity with a credential attached, usually meant for a human. A role is a set of permissions that an identity can temporarily assume, receiving short-lived credentials for the duration.
The practical consequence is lifetime. A user’s access key works until someone revokes it, which could be years after the laptop holding it was lost. A role’s credentials expire on their own, typically within hours, which means a leaked token has a short window of usefulness. That single property removes a large class of problems.
The working rule is simple. Humans sign in as users with multi-factor authentication, then assume roles to do anything of consequence. Applications and compute instances are given roles directly rather than being handed long-lived keys at all. Where you do need a long-lived key for a machine, treat it as an exception with an owner and an expiry, and manage it as described in our guide to secrets management for keys, tokens and rotation.
How a permission decision actually resolves
Providers differ in syntax but converge on the same evaluation logic, and knowing it stops most debugging guesswork.
- Start from an implicit deny. Nothing is permitted by default.
- Collect every policy that applies: attached to the identity, attached to the group it belongs to, attached to the resource, and any organisation-level boundary above it.
- If any of them contains an explicit deny for this action, the request fails. Deny always wins.
- If at least one allow matches and no deny does, the request succeeds.
- If nothing matches, the implicit deny stands and the request fails.
When someone reports that access is not working, walk the list in order rather than adding a broader policy. The overwhelmingly common cause is a missing allow on one specific action, not a need for wider rights. The second most common is an organisation-level boundary that no amount of identity-level permission can override.
Writing least privilege without stopping the team
Least privilege means an identity holds exactly the permissions required for its job and nothing more. Applied naively it produces a week of tickets and a team that routes around it. Applied in the right order it is almost invisible.
Start permissive and tighten with evidence. Grant a broad but not unlimited policy, turn on access logging, let the identity work for a couple of weeks, then read the log and write a policy that matches what was actually called. This is far more reliable than predicting the API calls an application will make, and it produces a policy you can defend.
Scope by resource as well as by action. Permission to read objects from one storage bucket is a different risk from permission to read every bucket in the account. Wildcards in the resource field are where broad access hides, and they are easy to miss because the action list looks tight.
Separate the dangerous actions out. Deleting resources, changing IAM itself, modifying logging configuration and altering billing settings deserve their own role with a deliberate step to assume it. Most engineers need those rights occasionally and almost never by accident.
Groups, boundaries and where policies attach
Attach policies to groups rather than to individuals. The moment permissions are granted person by person, the account stops being auditable, because answering “who can delete production storage” requires reading every identity. With groups, the question has a short answer.
Define groups by job, not by seniority. A group called “deployment” that holds the rights to run a release is more durable than one called “senior engineers”, because the second drifts into a catch-all as people are promoted into it.
Above the identity layer, most providers offer an organisation-level control that caps what any identity in an account may do regardless of its own policies. This is the right place for rules such as blocking the disabling of audit logs or preventing use of regions you do not operate in. It is also the control that makes an account boundary meaningful, which is the argument developed in separate cloud accounts per environment.
The root or owner identity
Every account has a founding identity that owns the billing relationship and cannot be fully constrained by policy. It is not a working account and should not be used as one.
Secure it, enrol a strong second factor on it, remove any access keys attached to it, create your first administrative identity through it, and then stop using it. Store its credentials where two people are needed to retrieve them. A handful of operations genuinely require it, so you will log in once or twice a year, and that is the correct frequency.
This identity is also the first thing to examine on any account you did not create yourself. The post-handover security checklist gives the full sequence, and it should be completed before you place any workload on the account.
Reviewing access on a schedule
Permissions accumulate. Someone needs temporary access for a migration, gets it, and keeps it for three years. The only reliable fix is a recurring review that someone owns.
Quarterly is a workable cadence for most teams. In each review, list every identity with administrative rights and justify each one in writing. Find credentials that have not been used in ninety days and disable rather than delete them, so a mistake is reversible. Check that every identity maps to a current person or a current service, and remove the ones that do not. Confirm that no new policy has introduced a wildcard on both action and resource.
Make the review produce an artefact. A dated list with names against it is the thing an auditor asks for, and it is also what tells you whether the last review changed anything. Compliance frameworks expect exactly this evidence, as covered in GDPR, HIPAA and SOC 2 requirements for cloud deployments.
IAM patterns that cause trouble
A few habits show up repeatedly in accounts that later have an incident.
- Shared logins. One set of credentials used by several people destroys attribution, and attribution is the whole value of an audit log.
- Administrator by default. Granting full rights to get someone unblocked, intending to narrow it later. Later does not arrive.
- Long-lived keys in application configuration. They end up in version control, in container images and in backups.
- Contractors without an end date. If the engagement has a last day, the identity should have one too.
- Policies written by copying from a forum. Understand every line, particularly the resource field.
How much of this you can enforce depends partly on the provider. The hyperscalers offer fine-grained policy languages with a steep learning curve, while several developer-focused platforms offer a simpler model that is quicker to reason about and harder to misconfigure. The AWS vs DigitalOcean comparison covers that trade-off directly. If a simpler model suits your team, a Buy Digital Ocean Account listing gets you there, and if you need the depth, a Buy AWS Account gives you the full policy engine along with the obligation to learn it.