All guides
Practice now
D2 · Security and compliance
Icon-Architecture/48/Arch_AWS-Identity-and-Access-Management_48

IAM: identity and access control

AWS Identity and Access Management (IAM) is AWS's central security service. It controls who can authenticate and what actions they can perform. It's global, free, and critical for the CLF-C02 exam.

IAM Overview

lets you manage access to AWS services and resources securely. With IAM, you can create and manage AWS users and groups, and use permissions to allow or deny their access to resources.

Free

Cost

No additional cost

Global

Scope

Not region-scoped

Identity

Type

AuthN + AuthZ

Deny all

Default

No permission = denied

Users, Groups, Roles, and Policies

👤

IAM Users

An identity within your AWS account that represents a person or service that interacts with AWS. It has permanent credentials (a password for the console, Access Keys for CLI/API).

When to use

  • • A developer accessing the AWS console
  • • A script or application calling AWS APIs with fixed credentials (not recommended — use Roles instead)

When NOT to use / Watch out

  • • Applications on EC2 — use IAM Roles instead
  • • Temporary access — use Roles or STS
👥

IAM Groups

A collection of IAM users. You can specify permissions for a group, which makes it easier to manage permissions for multiple users. Groups CANNOT contain other groups.

When to use

  • • Development team: a "Developers" group with access to EC2 and S3
  • • Operations team: an "Ops" group with access to CloudWatch and SSM

When NOT to use / Watch out

  • • A group can't sign in — only users can
  • • Groups can't be referenced in resource-based policies
🎭

IAM Roles

An identity with specific permissions. Unlike a user, a role has no permanent credentials — its credentials are temporary and are generated automatically when someone assumes the role.

When to use

  • • An AWS service that needs to access another (EC2 → S3)
  • • Users from other AWS accounts who need access (cross-account)
  • • Federated users (SSO, SAML) accessing AWS

When NOT to use / Watch out

  • • Not for regular users who need permanent console access
📋

IAM Policies

JSON documents that define permissions. A policy specifies which actions are allowed or denied on which resources and under what conditions. They're attached to users, groups, or roles.

When to use

  • • Defining specific access: "can read from S3 bucket X but not write to it"
  • • Creating reusable policies that can be attached to multiple identities

Structure of an IAM policy (JSON)

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",          // Allow or Deny
      "Action": "s3:GetObject",   // Which action
      "Resource": "arn:aws:s3:::my-bucket/*",  // On which resource
      "Condition": {              // Optional: conditions
        "IpAddress": {"aws:SourceIp": "203.0.113.0/24"}
      }
    }
  ]
}

Root account — when to use it and when NOT to

⚠️ Don't use root for day-to-day operations

The root account has unlimited access to everything in your AWS account. Compromising root is catastrophic — it has no permission limits.

Never use root for:

  • • Day-to-day operations
  • • Deploying applications
  • • Creating users (except the very first one)
  • • Programmatic access (API/CLI)

✓ When root IS required

There are tasks that ONLY the root account can perform. The exam tests these specifically:

  • • Changing the AWS support plan
  • • Closing the AWS account
  • • Changing the root account's email or password
  • • Restoring permissions for an IAM user
  • • Configuring MFA on the root account
  • • Viewing certain billing reports (once enabled)
  • • Enabling IAM access to billing

Critical best practice for the exam

After creating an AWS account: (1) enable MFA on root, (2) create an IAM user with admin permissions, (3) use that user for everything. The root account is used only for the specific tasks listed above.

MFA and authentication

Multi-Factor Authentication (MFA)

MFA adds a layer of security beyond the password. With MFA, users must provide two authentication factors: something they know (password) + something they have (an MFA token).

Virtual MFA

A smartphone app (Google Authenticator, Authy). Generates a 6-digit TOTP code. The most common option on the exam.

E.g.: Google Authenticator, Microsoft Authenticator

Hardware MFA

A physical hardware device that generates codes. More secure than virtual MFA but more expensive.

E.g.: Gemalto, YubiKey

U2F Security Key

A USB security key that connects physically. Authenticates with a physical touch.

E.g.: YubiKey, Google Titan

Related labD2 · Security and Compliance

Enable MFA on an IAM user

Assign a virtual MFA device to an admin user and understand why it's critical for privileged accounts.

Understand what MFA is and why it combines two factors from different categories
Assign a virtual MFA device to an IAM user

+1 more...

6 min7 steps

Principle of least privilege

Principle of Least Privilege: grant only the permissions required to perform the specific task, nothing more. If a user only needs to read files from S3, don't give them administrator permissions.

❌ Bad approach

  • • Giving AdministratorAccess to every developer
  • • Creating a user with full permissions "to keep it simple"
  • • Using the root account for daily tasks
  • • A Lambda function with account-wide permissions

✓ Good approach

  • • Backend developer: access only to the project's EC2, RDS
  • • Lambda function: only s3:GetObject on the specific bucket
  • • Monitoring: only CloudWatch:ReadOnly
  • • Review and adjust permissions periodically with Access Analyzer

Access Keys vs Roles for EC2

DimensionAccess Keys (avoid)IAM Roles (recommended)
TypePermanent credentials (Key ID + Secret)Temporary credentials (STS tokens)
DurationPermanent until rotated/deletedExpire automatically (15min–12h)
If compromisedCompromise persists until rotatedExpires on its own, minimal impact
RotationManual — many teams forgetAutomatic — handles it
StorageRisk of ending up in code, S3, logsNo credentials to store
AuditingHard to tell which process used which key shows the role that performed the action
Ideal use caseLocal development (when there's no alternative)EC2, Lambda, ECS, EKS — any AWS service

Golden rule for the exam

If the scenario says "an application on EC2 needs to access S3" → the correct answer is always to create an IAM Role and attach it to the EC2 instance. Never hardcode Access Keys in code or environment variables.

Identity Federation

Identity federation lets users from external identity systems (a corporate Active Directory, Google, Facebook) access AWS without creating individual IAM users.

SAML 2.0

Integration with a corporate Active Directory or any SAML provider. Enables SSO for thousands of employees without creating individual IAM users.

E.g.: Microsoft AD, Okta, PingFederate

Web Identity Federation

Lets users authenticated with web identity providers (Cognito, Google, Facebook) assume IAM roles to access AWS.

E.g.: Amazon Cognito for mobile apps

AWS SSO (IAM Identity Center)

A centralized SSO solution for managing access to multiple AWS accounts and business applications.

E.g.: Centralized access across every account in an AWS organization

AWS IAM Identity Center (formerly AWS SSO)

centralizes access management across multiple AWS accounts and business applications. It removes the need to create IAM users in each individual account.

Key features

  • •
    Multiple accounts: manages access to every AWS Organizations account from a single place
  • •
    Identity Providers (IdP): integrates with Microsoft Active Directory, Okta, Azure AD, and others via SAML 2.0
  • •
    Permission Sets: reusable permission collections applied to users or groups in specific accounts
  • •
    Access portal: employees log in once to reach all of their assigned AWS accounts

When to use IAM Identity Center

  • • A company with multiple AWS accounts (dev, staging, prod, teams)
  • • Employees using a corporate Active Directory (Okta, Azure AD)
  • • You want to avoid creating IAM users in every account
  • • You need SSO: a single login for all AWS accounts
  • • Centralized auditing of who accessed which account

For the exam

IAM Identity Center = SSO across multiple AWS accounts. It integrates with AWS Organizations for centralized management.

Advanced identity in AWS

Cross-Account Roles — cross-account access

A user or service in account A can assume a role in account B to access its resources — no need to create additional users. Credentials are temporary and revoked automatically.

Use case

A company with a production account and a separate security account. The audit team in the security account assumes a read-only role in production.

How it works

Account B creates a role with a trust policy that allows account A. A user in A calls sts:AssumeRole and receives temporary credentials for B.

Amazon Cognito — auth for web/mobile applications

Cognito provides authentication, authorization, and user management for web and mobile applications. It's not for AWS console access — it's for the users of your applications.

User Pools

A user directory for authentication. Manages sign-up, login, passwords, MFA, email verification. Returns JWT tokens.

Identity Pools

Grants authenticated users temporary AWS credentials to access services (S3, DynamoDB) directly from the app.

Service Control Policies (SCPs) — AWS Organizations

are permission-boundary policies applied to member accounts in . They define the maximum permissions that users and roles in that account can have.

Critical exam point

SCPs do NOT grant permissions — they only restrict them. If a user has Allow in their IAM policy but their account's SCP has Deny, the user CANNOT perform the action. SCPs apply even to the root user of a member account.

Related labD2 · Security and Compliance

Create an IAM user

Learn to manage identities and access with IAM, following the principle of least privilege.

Understand what AWS IAM is
Create an IAM user with console access

+1 more...

12 min6 steps
Related labD2 · Security and Compliance

Create a custom IAM policy

Create an IAM policy with granular permissions using the visual editor.

Understand the structure of IAM policies
Create a policy with specific permissions

+1 more...

12 min6 steps

Did you get this topic?

Test what you just learned

A systems administrator has just created a new AWS account for the company. According to AWS best practices, what should be the first action regarding the root account?

Ready to test "IAM: identity and access control"?

Put what you learned to the test with original CLF-C02 exam questions.

Start CLF-C02 mock exam

Unlimited mock exams with the Pro plan

Log in to track your progress.