Course contentsShow
← Cloud and Infrastructure
Lesson 380 of 2,9897. Identity and Access ManagementFree lesson

AWS IAM Policy Structure and Syntax

Deep dive into AWS policy JSON structure including Effect, Action, Resource, and Condition blocks.

AWS IAM Policy Structure and Syntax

You'll learn: How AWS IAM policies are written using JSON documents with four essential building blocks that control who can do what with which resources.

The JSON Blueprint for Permissions

Think of an IAM policy like a recipe card with specific sections. Every AWS IAM policy is written in JSON format and contains structured blocks that the AWS system reads to make access decisions. You've already learned about Effect, Action, and Resource conceptually—now we'll see how they fit together in actual policy documents.

The Four Core Building Blocks

Effect

Either "Allow" or "Deny"—this declares whether the policy grants or blocks permission.

Action

Specifies what operations are permitted, like "s3:GetObject" or "ec2:DescribeInstances". You can use wildcards: "s3:*" means all S3 actions.

Resource

Defines which AWS resources the actions apply to, using Amazon Resource Names (ARNs). For example: "arn:aws:s3:::my-bucket/*" targets all objects in a specific bucket.

Condition (optional)

Adds context-based rules, like time of day, source IP address, or MFA requirement. This makes policies dynamic and context-aware.

A Simple Example Structure

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::my-bucket/*",
      "Condition": {
        "IpAddress": {
          "aws:SourceIp": "203.0.113.0/24"
        }
      }
    }
  ]
}

This policy allows reading S3 objects only from a specific IP range.

Key Takeaway: AWS IAM policies are JSON documents with Statement blocks containing Effect, Action, Resource, and optional Condition elements—mastering this syntax lets you precisely control AWS permissions.