📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials AWS Solutions Architect IAM Policy Structure and JSON Deep Dive

IAM Policy Structure and JSON Deep Dive

5 min read Quiz at the end
Master IAM policy JSON structure, resource ARNs, condition keys, and the policy evaluation logic including explicit vs implicit deny.

IAM Policy JSON — Understanding Every Field

IAM Policies are written in JSON and every field has a specific meaning. Understanding the policy structure is essential for writing correct permissions and debugging access issues.

Teacher Note: An IAM policy is like a legal contract. Every word matters. 'Allow s3:GetObject on arn:aws:s3:::my-bucket/*' means exactly: you are ALLOWED to perform the GET OBJECT action on ANYTHING inside MY-BUCKET. Missing the /* means you cannot get any objects — only the bucket itself.

Policy JSON Structure

{
  "Version": "2012-10-17",        // Always use this date - it is a policy language version
  "Statement": [                 // Array of permission rules
    {
      "Sid": "AllowS3Read",      // Optional: human-readable identifier
      "Effect": "Allow",         // Allow or Deny
      "Action": [                // What actions are permitted
        "s3:GetObject",
        "s3:ListBucket"
      ],
      "Resource": [              // Which resources does this apply to?
        "arn:aws:s3:::my-bucket",        // The bucket itself (for ListBucket)
        "arn:aws:s3:::my-bucket/*"       // All objects inside (for GetObject)
      ],
      "Condition": {             // Optional: additional constraints
        "IpAddress": {
          "aws:SourceIp": "203.0.113.0/24"  // Only from this IP range
        }
      }
    }
  ]
}

Common Policy Mistakes

MistakeProblemCorrect Approach
s3:* on *Grants ALL S3 actions on ALL buckets — too broadSpecify exact actions and bucket ARN
Missing /*s3:GetObject on bucket ARN won't work — needs bucket/* for objectsAdd /* for object-level permissions
No Condition blockAccess allowed from any IP, any timeAdd IP/MFA conditions for sensitive actions
Deny before AllowWrong order thinking — AWS evaluates ALL statementsOrder doesn't matter — explicit Deny always wins

Policy Evaluation Logic

Request comes in --> IAM evaluates all applicable policies

1. Is there an explicit DENY anywhere? --> DENY (stop)
2. Is there an explicit ALLOW? --> ALLOW
3. Default: IMPLICIT DENY

Note: SCPs, Permission Boundaries, and Resource Policies
are also evaluated — ALL must allow for access to succeed
Exam Tip: The most tested IAM policy concept: EXPLICIT DENY always wins over any Allow. If you have both an Allow and a Deny for the same action on the same resource, the Deny wins. Period. No exceptions.