Policy Structure and Syntax
What you'll learn: How IAM policies are written in JSON format and what each part means.
The JSON Structure
IAM policies use JSON (JavaScript Object Notation) – a text format for organizing data with labels and values. Think of it like a recipe: it has ingredients (resources), actions (what you can do), and rules (whether it's allowed or denied).
Every policy document contains:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my-bucket/*"
}
]
}
Breaking Down the Components
Version: Identifies which policy language version to use. Always use "2012-10-17" (the current standard).
Statement: An array containing one or more permission rules. Each statement is like a single rule in your security rulebook.
Effect: Either "Allow" or "Deny" – does this statement grant or block access?
Action: What operations are permitted or denied (e.g., "s3:GetObject" means "read files from S3").
Resource: Which specific cloud resources this rule applies to, identified by their unique ARN (Amazon Resource Name).
Think of It Like a Permission Slip
Imagine a school permission slip: "I allow Sarah (identity) to take the bus (action) to the museum (resource)." IAM policies work the same way, just written in structured JSON.
Key Takeaway: IAM policies are JSON documents with a Version, Statement array, and each statement specifies Effect (Allow/Deny), Action (what operation), and Resource (which cloud resource) – together they define who can do what to which resources.