AWS in 1 Min · Episode 21

How to read an AWS IAM policy

How to read a policy. Watch the one-minute video, then read the details.

David Gomez1:24 video · 3 min read

"IAM policies are unreadable JSON." They look that way the first time. But every policy follows the same small pattern, and once you know it you can read any of them, including the dangerous ones that give away far more than intended. This is part one of two: how to read a policy. Part two covers how AWS evaluates several policies together.

A policy is a list of statements

An IAM policy is a JSON document that lists permissions. It has a Version (use "2012-10-17", the current policy language version) and a Statement section holding one or more statements. Each statement is one rule.

{
  "Effect": "Allow",
  "Action": "s3:GetObject",
  "Resource": "arn:aws:s3:::docs/*"
}

Read it as a sentence: allow reading objects in the bucket named docs.

The three core elements

  • Effect is the decision: Allow or Deny. Nothing else is possible.
  • Action is what can be done, written as service:Operation. s3:GetObject reads an object from S3; ec2:StartInstances starts servers. A statement can list several actions.
  • Resource is what the action applies to, written as an ARN. Here it's every object inside one bucket.

If you can find those three, you understand most of the statement.

Condition and Principal

Condition is optional and narrows the rule: it applies only when something is true. Typical examples are requests coming from your office IP range, requests made with MFA, or resources carrying a certain tag.

Principal says who the statement applies to. You'll only see it in resource-based policies, the ones attached to a resource such as an S3 bucket policy, and in a role's trust policy. Identity-based policies, attached to a user, group or role, don't have it: the principal is whoever the policy is attached to.

There's also an optional Sid, a label for the statement, which is handy for humans and has no effect on permissions.

The red flags

A * is a wildcard that means "everything". That's where most over-permissive policies come from.

  • "Action": "" with "Resource": "" and "Effect": "Allow" is full administrator access.
  • "Action": "s3:*" allows every S3 operation, including deleting buckets, when the job only needed to read.
  • "Principal": "*" in a resource policy means anyone, possibly anyone on the internet, unless a condition limits it.

Also look twice at NotAction and NotResource: "allow everything except…" grants much more than it seems. When you review a policy, read the wildcards first.

Where AI fits

Writing a policy from scratch is where an assistant saves time. You can ask the AWS assistant in the AWS console (formerly Amazon Q Developer in the console), in plain English, for something like "a policy that lets a role read objects from one bucket and nothing else", and get a draft back. Treat it as a draft. Generative tools can produce actions that are broader than needed or simply wrong.

Before attaching it, run IAM Access Analyzer policy validation. It's built into the policy editor in the IAM console and checks the policy against the policy grammar and AWS best practices, reporting errors, security warnings and suggestions. Then test with the real workload.

Quick recap

  • Every statement has an Effect, an Action and a Resource.
  • Condition narrows it; Principal (who) appears in resource-based policies.
  • Watch for stars: wildcards are where over-permission hides.
AWS in 1 Min #21 · 1:24

Need an AWS expert on your team?

I'm David, an AWS expert and fractional cloud consultant. I work alongside your team to run your cloud and infrastructure: architecture, security, cost and day-to-day operations. You get senior AWS experience when you need it, without the cost of a full-time hire.

  • Architecture reviews and a clear plan for what to fix first
  • Security hardening: IAM, networking, audits
  • Lower AWS bills without slowing your team down
  • Hands-on help with AI workloads on AWS