Volume 3 · Chapter 1 — Identity, Security and Compliance
IAM Fundamentals: Users, Groups, and Roles
1.1 Introduction
Identity and Access Management (IAM) is the control plane for everything in AWS - it decides who and what can do what, to which resources, under which conditions. It is the most important security service because every action, by every person and every workload, is authorized through it. It is also the customer’s responsibility under the shared responsibility model, which is why misconfigured IAM is behind a large share of cloud breaches. This chapter establishes the core building blocks - users, groups, and roles - and the principle that governs them all: least privilege.
1.2 What IAM Controls
Every request to AWS - launching an instance, reading an S3 object, writing to a database, calling any API - is made by an identity and checked against IAM before it’s allowed. IAM answers two questions: authentication (who are you?) and authorization (what are you allowed to do?). The answer to authorization comes from policies attached to identities and resources. Because IAM sits in front of every action, a correct IAM setup is the foundation of AWS security, and a wrong one - overly broad permissions, shared credentials, exposed keys - is the fastest route to a breach. The guiding principle throughout is least privilege: grant only the permissions genuinely required for a task, and nothing more.
1.3 Users and Groups
An IAM user represents a single person or, historically, an application, with long-term credentials - a password for console access and/or access keys for programmatic access. Groups are collections of users that let you attach permissions once and have them apply to every member - so you create a group like “Developers” or “Auditors,” attach the appropriate policies to the group, and add users to it, rather than managing permissions user by user. This makes access manageable and consistent. However, the modern best practice is to minimize standalone IAM users with long-lived credentials for people: instead, human access is federated through a central identity provider (single sign-on) so people use their existing corporate identity with multi-factor authentication, and they assume roles for temporary access - which is more secure and easier to govern than scattered users with permanent keys.
1.4 Roles: The Preferred Mechanism
An IAM role is an identity with permissions that is not tied to one person and has no long-term credentials of its own; instead, a trusted entityassumesthe role and receives temporary credentials that expire. Roles are the preferred way to grant access in AWS for two big reasons. First, for workloads: an EC2 instance, Lambda function, or container is given a role, and it automatically receives temporary, auto-rotating credentials to call AWS services - so there are no access keys stored in code or configuration to leak, which eliminates the single most common breach source. Second, for people and cross-account access: users assume roles for the specific access they need, temporarily, rather than holding standing permissions. The core idea is that roles replace long-lived stored credentials with short-lived assumed ones, which is both more secure and more flexible.
flowchart TB
subgraph People[Human access]
IdP[Corporate IdP / SSO + MFA] --> AssumeH[Assume role]
end
subgraph Workloads[Workload access]
EC2[EC2 / Lambda / container] --> RoleW[Attached IAM role]
end
AssumeH --> Temp[Temporary credentials\n(expire automatically)]
RoleW --> Temp
Temp --> AWS[(AWS services - authorized by policies)] 1.5 Least Privilege and MFA
Two disciplines make IAM safe. Least privilege means every identity gets only the permissions it needs for its job and no more - you start from nothing and grant specific actions on specific resources, rather than granting broad access and trying to claw it back. This limits the blast radius: if an identity is compromised, the attacker can do only what that identity was narrowly permitted to do. Multi-factor authentication (MFA) adds a second factor beyond a password for human logins, so a stolen password alone isn’t enough - essential for any privileged access and mandatory for the root user. Together, least privilege (limit what each identity can do) and MFA (make it hard to become an identity you’re not) are the two highest-leverage IAM practices.
1.6 Banking Production Scenario
A bank grants no standalone IAM users to its engineers. Instead they sign in through the corporate identity provider with MFA and assume roles scoped to their job - a developer assumes a role granting access only to the development account’s resources, an auditor assumes a read-only role. Applications on EC2, Lambda, and containers are each given a role granting only the specific services they use - the payments service’s role can read its own secret and write to its own queue, and nothing else - so no access keys exist anywhere in code. The root user is locked behind MFA and never used. Every permission is scoped to least privilege, so a compromise of any one identity or workload is tightly contained.
1.7 Troubleshooting: Access Denied and Over-Permissioning
IAM problems come in two opposite flavours. “Access Denied” errors mean the identity lacks a required permission, or an explicit deny or a boundary is blocking it - the fix is to identify the exact action and resource in the error and grant the minimal permission needed (using policy simulation tools to verify), never to over-grant broad access as a shortcut. The opposite problem - discovered in security reviews - is over-permissioning: identities with far more access than they use, wildcard permissions, or long-lived access keys. The fix is to tighten toward least privilege using access analyzers that show which permissions are actually used, remove unused keys, and replace users with role assumption. The recurring temptation to fix “Access Denied” by granting broad permissions is exactly what creates the over-permissioning problem, so the discipline is to grant precisely what’s needed and no more.
1.8 IAM Best Practices (Exam Checklist)
AWS’s IAM best practices recur throughout the exams and are worth holding as a checklist. Lock away theroot user- enable MFA, don’t create root access keys, and use it only for the few tasks that require it.Grant least privilege- start from no permissions and add only what’s needed, preferring specific actions and resources over wildcards.Use roles, not long-lived keys- for workloads (via instance profiles) and for humans (via federation/Identity Center), so credentials are temporary.Enable MFAfor privileged and all human access.Use groupsto assign permissions to people, andpermission boundaries/SCPsto cap delegated permissions.Rotate and audit- review with Access Analyzer and the credential report, remove unused users, keys, and permissions.Prefer temporary credentialseverywhere. The overarching modern guidance is to minimize IAM users entirely: federate humans through IAM Identity Center and give workloads roles, so there are almost no long-lived credentials in the environment at all.
Explain IAM users, groups, and roles, and why roles are preferred.
IAM is the service that controls who and what can do what in AWS, and its core building blocks are users, groups, and roles. An IAM user represents a single person (or, historically, an application) and has long-term credentials - a password for the console and/or access keys for programmatic access. A group is a collection of users that lets you manage permissions collectively: you attach policies to a group like “Developers” or “Auditors” and add users to it, so permissions are consistent and managed once rather than user by user. A role is different in a crucial way: it’s an identity with permissions but no long-term credentials of its own and not tied to a specific person; instead, a trusted entity assumes the role and receives temporary credentials that automatically expire. Roles are the preferred mechanism for granting access, for two main reasons. First, for workloads: you attach a role to an EC2 instance, Lambda function, or container, and it automatically receives temporary, auto-rotating credentials to call AWS services - which means there are no access keys stored in code or configuration to be leaked, eliminating the single most common source of cloud breaches. Second, for people and cross-account access: rather than giving users standing long-lived permissions, they assume a role to get the specific access they need, temporarily, often after signing in through a corporate identity provider with MFA. The reason this is better is that roles replace long-lived stored credentials with short-lived assumed ones: temporary credentials that expire are far safer than permanent keys that can leak and persist, access can be granted just-in-time and scoped tightly, and there’s nothing durable to steal. The modern best practice follows from this - minimize standalone IAM users with permanent credentials for humans, federate people through single sign-on, and give workloads roles instead of keys. So users and groups are how you traditionally represent and organize people’s access, but roles - assumed for temporary credentials - are preferred because they remove stored long-lived secrets, which is the biggest, most preventable security risk, and they enable secure workload identity and cross-account access.
What is least privilege, and how do you apply it in practice on AWS?
Least privilege is the principle that every identity - user, role, or workload - should have only the permissions genuinely required to do its job, and nothing more. The reason it matters is blast-radius containment: if an identity is compromised, the attacker can do only what that identity was narrowly permitted to do, so tight permissions turn a potential catastrophe into a limited incident, while broad permissions mean one compromised credential can reach far across your environment. In practice on AWS I apply it several ways. I start from zero and grant specific actions on specific resources rather than granting broad access and trying to remove it later - permissions are additive from nothing, scoped to the exact API actions and the exact resources needed, with conditions where appropriate. For workloads, I give each application its own role granting only the services it uses - the payments service can read its own secret and write to its own queue and nothing else - so a compromise of one service doesn’t grant access to others. For people, I avoid standing broad permissions and instead have them assume narrowly-scoped roles for the access they need, signing in through SSO with MFA. I avoid wildcards and overly broad managed policies where a tighter custom policy fits the actual need. I use tooling to keep permissions tight over time: access analyzers and “last accessed” data show which permissions are actually used, so I can remove the ones that aren’t, and policy simulators let me verify a policy grants exactly what’s intended before applying it. And I resist the very common anti-pattern of fixing an “Access Denied” error by granting broad permissions as a shortcut - instead I identify the specific action and resource the error names and grant just that. I also add guardrails like permission boundaries and organization-level service control policies so that even if someone writes an over-broad policy, an outer limit caps what’s actually possible. The net effect is that each identity can do precisely its job and no more, so the environment is resilient to the compromise of any single credential. Least privilege is ongoing discipline, not a one-time setup - you continually tighten toward the minimum as you learn what’s actually used - and it’s the single most important habit for keeping an AWS environment secure.
Chapter Revision Notes
- IAM authorizes every action by every identity; it’s the control plane and the customer’s responsibility to get right.
- Users = individual identities with long-term credentials; groups attach permissions to many users at once.
- Roles have no long-term credentials - a trusted entity assumes them for temporary, auto-expiring credentials.
- Roles are preferred: workloads get roles (no stored keys to leak); people assume roles via SSO+MFA for temporary access.
- Least privilege (grant only what’s needed) plus MFA are the two highest-leverage IAM practices.