MORTIMERDEV LABS / AWS / IAM FREE · BETA

What does this IAM policy allow?
In plain English.

Paste an identity policy, a bucket or queue policy, or a role trust policy. Each statement is explained in a sentence, risky patterns are flagged (admin access, PassRole on any role, public principals, GitHub roles any repository can assume), and you can check whether it allows a specific action. You also get it as CDK in TypeScript and Python.

Runs in your browser. Nothing is stored or sent. Policies rarely contain secrets, but swap in 123456789012 for real account IDs if you prefer.
Take the 10-question IAM quiz

Explain a policy

Try:

Can it do this?

Checks the policy above on its own: an explicit Deny wins, then an Allow, otherwise it’s denied by default.

What is an IAM policy?

An IAM policy is a JSON document that says who can do what to which AWS resources, and when. Every request to AWS is checked against the policies that apply to it. Each statement in a policy allows or denies some actions on some resources:

{ "Effect": "Allow", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::my-app-assets/*", "Condition": {"Bool": {"aws:SecureTransport": "true"}} }
Effect
Allow or Deny. A Deny always wins.
Action
What can be done, as service:Action
Resource
Which resources, by ARN
Condition
Optional: only when this is true (here, over HTTPS)

Where you’ll use them

  • Identity policies attach to a role, user or group and say what it can do. Lambda functions, ECS tasks and CI pipelines all get their permissions this way.
  • Resource policies attach to a bucket, queue, topic or key and add a Principal: who else may use it, including other accounts and AWS services.
  • Trust policies say who can assume a role: a service like lambda.amazonaws.com, another account, or GitHub Actions through OIDC.
  • In CDK you rarely write JSON: bucket.grantRead(role) and new iam.PolicyStatement(…) generate it for you.

Easy to confuse

  • No Allow means no: everything is denied by default, so a missing permission fails even with no Deny anywhere.
  • Permission boundaries and SCPs don’t grant anything: they cap what other policies can allow.
  • A role isn’t a user: nobody logs in as a role; people and services assume it and get temporary credentials.

TEST YOURSELF

How well do you know IAM policies?

Ten questions on statements, evaluation, conditions and common traps, with an explanation and a link to the reference after each one. Three are “can this policy do this?” questions answered by the same checker as above.

IAM REFERENCE

IAM policies, in plain English.

Policy elements

StatementEach statement says Effect (Allow or Deny), Action, Resource and optionally Condition. Resource policies add Principal.

A policy is {"Version": "2012-10-17", "Statement": [ … ]}. Element names are case-sensitive. Sid is an optional label; in identity policies it may only contain letters and numbers.

VersionAlways "2012-10-17": it’s the policy language version, not today’s date.

Leaving it out means the 2008 version, where policy variables like ${aws:username} are treated as literal text.

Action and NotActionservice:Action, like s3:GetObject. Wildcards work (s3:Get*), and action names aren’t case-sensitive.

NotAction matches every action except those listed, in every service, including actions AWS adds later. With Allow that’s very broad; with Deny it’s a common way to say “deny everything except…”.

ResourceThe ARNs a statement applies to. "*" means every resource, for actions that support it.

Some actions don’t support resource-level permissions and need "*". S3 is a common trip-up: bucket actions (s3:ListBucket) need the bucket ARN, object actions (s3:GetObject) need bucket/*. Trust policies have no Resource.

PrincipalWho the statement applies to, in resource policies and trust policies only: AWS accounts, roles, users, services or federated users.

{"AWS": "arn:aws:iam::123456789012:root"} means the account, which must also allow its users through their own policies. {"Service": "lambda.amazonaws.com"} is an AWS service. "*" is anyone, including anonymous callers.

How AWS decides

How AWS decidesDenied by default; an Allow is needed; any explicit Deny wins over every Allow.

AWS gathers every policy that applies: SCPs and RCPs from Organizations, resource policies, identity policies, permission boundaries and session policies. A matching Deny anywhere ends it. Otherwise the request needs an Allow, and boundaries, SCPs and session policies can only narrow what’s allowed, never add to it.

Identity, resource and trust policiesIdentity policies attach to a user, group or role; resource policies attach to a bucket, queue or key; trust policies say who can assume a role.

Within one account, either an identity policy or a resource policy can allow access. Across accounts, both sides must allow it: the resource’s policy must trust the other account, and that account must allow its role.

Conditions

AND and OR in conditionsSeveral values for one key are OR. Several keys, or several operators, are AND.

{"StringEquals": {"aws:RequestedRegion": ["eu-west-2", "eu-west-1"]}} is either Region. Adding a second key in the same block, or a second operator, means both must match.

Condition operatorsStringEquals is exact; StringLike allows * and ?; Bool, Numeric, Date, IpAddress and Arn operators compare their own types.

Add IfExists (StringEqualsIfExists) to pass when the key isn’t in the request. Negated operators like StringNotEquals also pass when the key is missing. Null checks whether a key is present: "Null": {"aws:TokenIssueTime": "true"} means it’s absent.

ForAnyValue and ForAllValuesFor keys with several values in one request, like aws:TagKeys. ForAllValues is also true when there are no values.

ForAnyValue passes if at least one request value matches; ForAllValues passes if every value matches, which includes having none at all. Pair ForAllValues with a Null check when the key must be present.

Useful condition keysaws:SecureTransport, aws:SourceIp, aws:PrincipalOrgID, aws:SourceArn, aws:MultiFactorAuthPresent, and tag keys.

aws:PrincipalOrgID limits access to your AWS Organization. aws:SourceArn and aws:SourceAccount stop other accounts’ resources using a service on your behalf. aws:ResourceTag/… and aws:PrincipalTag/… enable tag-based access control.

Common traps

iam:PassRoleNeeded to hand a role to a service (Lambda, EC2, ECS). On "*" it lets someone use any role in the account.

Someone who can create a Lambda function and pass any role can run code as the most powerful role you have. Limit Resource to specific role ARNs and add iam:PassedToService.

Privilege escalationSome IAM actions let a user grant themselves more: attaching or editing policies, creating access keys, changing trust policies.

iam:AttachRolePolicy, iam:PutRolePolicy, iam:CreatePolicyVersion, iam:UpdateAssumeRolePolicy and iam:CreateAccessKey on broad resources are effectively admin. Restrict them to specific principals, or use permission boundaries.

Principal "*"In a resource policy, "*" means anyone on the internet, signed in or not, unless a condition narrows it.

It’s fine in a Deny (like denying non-HTTPS requests to everyone) and with conditions like aws:PrincipalOrgID. On its own with Allow, it makes the resource public. S3 Block Public Access stops this for buckets by default.

GitHub Actions OIDC trustTrust token.actions.githubusercontent.com with sts:AssumeRoleWithWebIdentity, and always limit the sub claim to your repository.

Without a sub condition like repo:my-org/my-repo:ref:refs/heads/main, a workflow in any GitHub repository could assume your role. Also require aud to be sts.amazonaws.com.

Confused deputyWhen a service principal (like sns.amazonaws.com) can use your resource, add aws:SourceArn or aws:SourceAccount.

Otherwise another customer could point the same service at your resource and have it act on their behalf.

Least privilegeGrant only the actions and resources a job needs, and tighten over time.

IAM Access Analyzer can generate a policy from CloudTrail activity and flag unused access. Start from AWS managed policies only for experiments, then replace them with specific ones.

An explainer, not a full simulator.

The checker reads this one policy. In AWS, SCPs, permission boundaries, session policies and the resource’s own policy can also allow or deny. Use the IAM policy simulator or Access Analyzer in your account to test the whole picture.

Nothing leaves this page.

Policies are explained in your browser and nothing is saved. We count anonymous page views and button use, never what you enter.