Policy Structure: Elements, Syntax, and Evaluation Logic
You'll learn: How IAM policies are constructed from fundamental building blocks and how the cloud evaluates them to make access decisions.
The Anatomy of a Policy
Think of an IAM policy as a formal contract that answers: "Who can do what to which resources under what circumstances?" Every policy is built from statements—individual permission rules that work together.
Each statement contains essential elements:
- Effect: Either
AlloworDeny—the decision outcome - Principal: Who the rule applies to (in resource-based policies)
- Action: What operations are permitted or blocked (e.g.,
s3:GetObject,ec2:TerminateInstance) - Resource: Which specific resources the actions apply to (ARNs, wildcards)
- Condition: Optional filters that must be true for the statement to apply (IP ranges, time windows, MFA status)
Example Structure (Conceptual)
{
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my-bucket/*",
"Condition": {
"IpAddress": {"aws:SourceIp": "203.0.113.0/24"}
}
}
Evaluation Logic
When a request arrives, the cloud IAM engine evaluates all applicable policies:
- Default deny: Start by denying everything
- Explicit deny wins: If any policy explicitly denies, access is blocked—no exceptions
- Explicit allow required: At least one policy must explicitly allow the action
- Conditions are AND gates: All conditions in a statement must be satisfied
This hierarchical logic ensures that deny rules act as security guardrails that cannot be accidentally overridden.
Key Takeaway: IAM policies use structured statements with Effect, Action, Resource, and Condition elements, evaluated with a "default deny, explicit deny wins" logic to make secure, deterministic access decisions.