← Back to Home

AWS Identity & Access Management

AWS CLF-C02 — Domain 2: Security & Compliance

IAM Overview

Key Point:

IAM is a global service. Users, groups, roles, and policies you create are available across all AWS Regions.

IAM Components

Users

Groups

Roles

Policies

Exam Tip:

"How do you grant an EC2 instance permission to access S3?" → Create an IAM Role and attach it to the EC2 instance. Never use access keys on an EC2 instance.

Root User vs IAM User

FeatureRoot UserIAM User
Created whenAWS account is first createdCreated by root or IAM admin
AccessFull, unrestricted access to everythingOnly what policies allow
Can be restrictedNo — cannot be limited by IAM policiesYes — controlled by policies
Best practiceLock it away, enable MFA, don't use for daily tasksUse for everyday tasks

Tasks Only the Root User Can Do

Exam Tip:

If a question asks what can ONLY be done by the root user, remember: closing the account, changing support plans, and configuring MFA Delete on S3 are root-only tasks.

IAM Policy Structure (JSON)

An IAM policy is a JSON document with these key elements:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AllowS3ReadAccess",
      "Effect": "Allow",
      "Action": [
        "s3:GetObject",
        "s3:ListBucket"
      ],
      "Resource": [
        "arn:aws:s3:::my-bucket",
        "arn:aws:s3:::my-bucket/*"
      ],
      "Condition": {
        "IpAddress": {
          "aws:SourceIp": "203.0.113.0/24"
        }
      }
    }
  ]
}
ElementDescriptionRequired?
VersionPolicy language version. Always use "2012-10-17"Yes
StatementArray of individual statements (permissions)Yes
SidStatement ID — optional identifier for the statementNo
Effect"Allow" or "Deny"Yes
ActionList of API actions the policy allows or deniesYes
ResourceARN of the resource(s) the actions apply toYes
ConditionConditions for when the policy is in effectNo
Key Point:

An explicit Deny always overrides an Allow. If any policy denies an action, it is denied regardless of any Allow statements.

IAM Policy Types

TypeDescriptionUse Case
AWS Managed PoliciesPre-built policies created and maintained by AWSCommon use cases (e.g., AmazonS3ReadOnlyAccess)
Customer Managed PoliciesPolicies you create and manage yourselfCustom, fine-grained permissions specific to your needs
Inline PoliciesPolicies embedded directly in a single user, group, or roleStrict one-to-one relationship; deleted when the entity is deleted
Exam Tip:

AWS recommends using Customer Managed Policies over inline policies because they are reusable and easier to manage. AWS Managed Policies are great starting points but may be overly permissive.

Multi-Factor Authentication (MFA)

MFA adds an extra layer of security beyond just a password: something you know (password) + something you have (MFA device).

MFA TypeDescription
Virtual MFA DeviceApps like Google Authenticator, Authy, or Microsoft Authenticator. Supports multiple tokens on a single device.
Universal 2nd Factor (U2F) Security KeyPhysical device like YubiKey. Supports multiple root and IAM users with a single key.
Hardware Key Fob MFAPhysical token device (e.g., Gemalto). Generates a 6-digit code.
Hardware Key Fob for GovCloudSpecial key fob provided by SurePassID for AWS GovCloud (US).
Exam Tip:

MFA should be enabled on the root account and all IAM users with console access. This is a critical best practice and frequently tested.

Access Keys vs Console Password

FeatureConsole PasswordAccess Keys
Used forAWS Management Console (web browser)AWS CLI & SDK (programmatic access)
ComponentsUsername + password (+ optional MFA)Access Key ID + Secret Access Key
Generated bySet during user creationGenerated separately; can only be viewed once
SecurityCan enforce password policyTreat like passwords — never share or commit to code
Key Point:

Access keys are not the same as a password. A user can have up to two active access keys. The Secret Access Key is shown only once at creation — if lost, you must create new keys.

IAM Security Tools

ToolScopeDescription
IAM Credentials ReportAccount-levelLists all IAM users and the status of their credentials (passwords, access keys, MFA). Useful for auditing.
IAM Access AdvisorUser-levelShows the services a user has accessed and when they last accessed them. Helps you identify and remove unused permissions.
Exam Tip:

"Which tool helps you identify unused permissions?" → IAM Access Advisor. "Which tool provides a credential audit for all users?" → IAM Credentials Report.

IAM Best Practices

Key Point:

The Principle of Least Privilege means giving a user only the access they need to perform their job — nothing more. This is the single most important IAM best practice.