AWS Solutions Architect Handbook SAA-C03, from zero Bipin Singh
Security & identity

IAM fundamentals

3 min readChapter 05 of 48By Bipin Singh

AWS Identity and Access Management (IAM) controls who can do what on which resources. Every API call to AWS is checked against IAM. It is the heart of Domain 1, and misunderstanding it causes more wrong answers than any other topic.

The building blocks

Concept What it is Use it for
Root user The email/password that created the account; unrestricted access Almost nothing — lock it away
IAM user A long-term identity with a password and/or access keys Rare today; legacy tools, break-glass access
IAM group A collection of users that share policies Assign permissions to teams of users
IAM role An identity with permissions but no long-term credentials; assumed temporarily Applications, AWS services, cross-account and federated access
Policy A JSON document that allows or denies actions Attach to users, groups, roles or resources
Key idea

Prefer roles over users with access keys wherever possible. Roles give temporary credentials that expire automatically, so there's nothing long-lived to leak.

Protecting the root user

Policies in detail

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "ReadReports",
      "Effect": "Allow",
      "Action": ["s3:GetObject", "s3:ListBucket"],
      "Resource": ["arn:aws:s3:::company-reports", "arn:aws:s3:::company-reports/*"],
      "Condition": { "IpAddress": { "aws:SourceIp": "203.0.113.0/24" } }
    }
  ]
}
Element Meaning
Effect Allow or Deny
Action API operations, e.g. s3:GetObject; wildcards allowed
Resource The ARNs the statement applies to
Condition Optional rules: source IP, MFA present, tags, VPC endpoint, time, encryption…
Principal Who the policy applies to — only in resource-based policies

Types of policies

Type Attached to Purpose
Identity-based (AWS managed, customer managed, inline) Users, groups, roles What this identity can do
Resource-based Resources (S3 bucket policy, SQS queue policy, KMS key policy, Lambda resource policy) Who can access this resource — including other accounts
Permissions boundary Users or roles The maximum permissions an identity can ever have
Service control policy (SCP) Organization root, OUs, accounts The maximum permissions for accounts in an organization
Session policy A role session Further restricts a single session

How AWS evaluates a request

  1. By default, everything is implicitly denied.
  2. An explicit Deny in any applicable policy always wins.
  3. Otherwise, the request is allowed only if an Allow exists and nothing caps it — SCPs, permissions boundaries and session policies must all permit the action too.
Explicit DENY anywhere?          → DENIED
Allowed by SCPs (if in an org)?  no → DENIED
Allowed by a resource policy or identity policy?  no → DENIED
Within permissions boundary / session policy (if set)?  no → DENIED
                                  → ALLOWED
Watch out

SCPs and permissions boundaries never grant permissions — they only set limits. An identity still needs an Allow from an identity- or resource-based policy.

Least privilege in practice

Credentials and MFA

Tip

Never put access keys in code or on EC2 instances. Give the instance an IAM role (via an instance profile), and the SDK picks up temporary credentials automatically.

Exam patterns

Bipin Singh
Written by Bipin Singh

Senior Full-Stack Engineer · AI & AWS. I design and run production systems on AWS — serverless, data and AI.

Work with me