SkillSprout
Chapter 3 · Lesson 1
Beginner
5 min read

IAM: Users, Groups, Roles and Policies

Overview

AWS Identity and Access Management (IAM) controls who (authentication) can do what (authorization) on which resources in your AWS account. It is a global, free service and the foundation of AWS security.

Imagine an office building with a security desk. Each employee gets a badge (an IAM user or role), badges are grouped by department (IAM groups), and a rulebook (IAM policies) says which rooms each badge can enter. The building owner (the root user) has a master key that should be locked away and almost never used.

IAM is covered in nearly every Cloud Practitioner exam. Know the building blocks, the principle of least privilege, and why MFA matters.

Key Concepts

  • The root user is created with the account, has unrestricted access, and should be protected with MFA and used only for a few account-level tasks.
  • An IAM user represents a person or application with long-term credentials (password and/or access keys).
  • An IAM group is a collection of users; attach policies to the group to manage permissions at scale. Groups cannot contain other groups.
  • An IAM role provides temporary credentials and is assumed by users, applications or AWS services (for example an EC2 instance role).
  • An IAM policy is a JSON document that allows or denies actions on resources; an explicit Deny always wins.
  • Least privilege: grant only the permissions needed for a task, and nothing more.
  • MFA adds a second factor (virtual app, FIDO2 security key or hardware token) to protect sign-in.
  • IAM Identity Center provides single sign-on (SSO) to multiple accounts and applications using workforce identities.

Detailed Notes

Core identity types

EntityPurposeCredentials
Root userOwner of the accountEmail + password (+ MFA)
IAM userOne person or applicationPassword, access keys (long-term)
IAM groupPermission management for usersNone (not an identity itself)
IAM roleTemporary access for users, services, other accountsTemporary STS credentials

Policy anatomy

IAM policies are JSON documents with Effect, Action, Resource and optional Condition.

json
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Action": ["s3:GetObject", "s3:ListBucket"],
    "Resource": [
      "arn:aws:s3:::reports-bucket",
      "arn:aws:s3:::reports-bucket/*"
    ]
  }]
}

Policy evaluation in plain words

  1. By default, everything is denied.
  2. An explicit Allow in an attached policy permits the action.
  3. An explicit Deny anywhere overrides any Allow.

Policy types

TypeAttached toNotes
AWS managed policyUsers, groups, rolesCreated and maintained by AWS (for example ReadOnlyAccess)
Customer managed policyUsers, groups, rolesYou write and version it
Inline policyA single user, group or roleEmbedded one-to-one; harder to reuse
Resource-based policyA resource such as an S3 bucketNames a principal, enables cross-account access

Roles in practice

A role has no password. An EC2 instance, Lambda function or another account assumes the role and receives temporary credentials via the AWS Security Token Service (STS). This avoids storing access keys in code.

bash
# Show who you are
aws sts get-caller-identity

# Create a user and enable MFA from the console, then attach a managed policy
aws iam create-user --user-name analyst
aws iam attach-user-policy --user-name analyst \
  --policy-arn arn:aws:iam::aws:policy/ReadOnlyAccess

Strong authentication practices

PracticeWhy
MFA on root and all human usersStops stolen-password attacks
Password policyEnforces length, complexity and rotation rules
No root access keysRoot keys are extremely powerful
Rotate and remove unused access keysReduces exposure
Use roles instead of long-term keysCredentials expire automatically

Tools that help

  • IAM Credential Report: CSV of all users and credential status.
  • IAM Access Advisor: shows which services a user last accessed to trim permissions.
  • IAM Access Analyzer: finds resources shared externally and helps generate least-privilege policies.
  • IAM Identity Center: central SSO and permission sets across accounts, replacing many individual IAM users for workforce access.
  • Amazon Cognito: sign-up and sign-in for application customers, separate from workforce IAM.

Real World Example

A data-analytics team needs read access to reports in S3. Instead of sharing the account password, the admin creates an IAM group called Analysts with a policy allowing only s3:GetObject on the reports bucket, and adds each analyst with MFA enforced.

The reporting application on EC2 uses an IAM role instead of embedded access keys. Quarterly, the team reviews Access Advisor and removes permissions no one has used.

Architecture Diagram

IAM building blocks
Architecture
AWS Account
IAM user
IAM group
IAM policyAllow / Deny
IAM roleTemporary creds
S3 bucket
  1. 1Create users and put them in groups that match job functions.
  2. 2Attach policies to groups to allow only needed actions.
  3. 3Give applications and AWS services roles instead of long-term keys.
  4. 4Review usage with Access Advisor and tighten permissions regularly.

Best Practices

  • ✓Lock away the root user: enable MFA, delete its access keys and do not use it day to day.
  • ✓Apply least privilege and start from read-only, adding permissions as needed.
  • ✓Manage human access with groups or IAM Identity Center, not per-user policies.
  • ✓Use roles for applications and AWS services rather than embedding access keys.
  • ✓Enable MFA for every human user and review credentials with the credential report.

Common Interview Questions

Exam Tips

CLF-C02 focus

  • "Grant only the permissions required" = least privilege.
  • "Application on EC2 needs to access S3" = IAM role, not access keys.
  • IAM is global and free.
  • The first task on a new account: enable MFA on the root user.

Finished this lesson?

0 of 43 lessons done · 0% of the course