Skip to content

Menu

AWS IAM Policy Cheat Sheet: JSON Elements, Condition Operators and Evaluation Logic

Checked against AWS IAM IAM User Guide as published on 28 Nov 2026; policy language Version 2012-10-17 on 28 November 2026. Each section links to the official docs it was checked against.

This sheet is for developers who write or review IAM policies and need the grammar and the decision rules on one page. It follows the IAM User Guide as it read on 28 Nov 2026, and every policy uses language version 2012-10-17. Rows come from the docs; I could not call AWS from here, so they are marked untested.

When to use what

Default to identity-based policies on roles for your own workloads, and use resource-based policies (bucket policies, KMS key policies, role trust policies) when another account or an AWS service needs in. Within one account, either an identity-based or a resource-based allow is usually enough; across accounts, both sides must allow.

Reach for the guardrail types when you want a ceiling rather than a grant. Permissions boundaries, SCPs, RCPs and session policies never grant anything. They cap what the granting policies can give, so a missing allow in any of them is a deny.

Prefer Deny statements with conditions for rules that must hold everywhere, such as requiring TLS or MFA, because an explicit deny beats every allow no matter where the allow lives. Be careful with NotAction plus Allow: it grants everything not listed, including services launched next year.

When a condition key might be missing from some requests, decide on purpose what that should mean. Most operators return false for a missing key; negated ones return true; ...IfExists treats missing as a match. Our IAM policy evaluator lets you paste a policy and a request to see the decision, the CIDR calculator checks aws:SourceIp ranges, and the JSON formatter catches syntax slips before IAM does. If an AI agent will use the role, the AWS MCP server page is a good place to start scoping it.

Multiple statements in one policy are combined with a logical OR.

"Version": "2012-10-17"

Current policy language; without it, variables like ${aws:username} are treated as literal text

Source: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_version.html

Try it: AWS IAM Policy EvaluatorFrom the docs, not run by us
"Statement": [ ... ]

Container for one or more permission statements

From the docs, not run by us
"Sid": "FirstStatement"

Optional label to tell statements apart

From the docs, not run by us
"Effect": "Allow" | "Deny"

Whether matching requests are allowed or denied

Try it: AWS IAM Policy EvaluatorFrom the docs, not run by us
"Principal": { "AWS": "arn:aws:iam::111122223333:root" }

Who the policy applies to; required in resource-based policies, not allowed in identity-based ones

From the docs, not run by us
"Action": ["s3:List*", "s3:Get*"]

API actions as service:Action, wildcards allowed

Try it: AWS IAM Policy EvaluatorFrom the docs, not run by us
"Resource": "arn:aws:s3:::amzn-s3-demo-bucket/*"

ARNs the actions apply to; required in identity-based permission policies

From the docs, not run by us
"Condition": { "Bool": { "aws:MultiFactorAuthPresent": "true" } }

Extra tests the request must pass for the statement to apply

Try it: AWS IAM Policy EvaluatorFrom the docs, not run by us
"Effect": "Allow", "NotAction": "iam:*", "Resource": "*"

Allow every action in every service except IAM; broad, use with care

Try it: AWS IAM Policy EvaluatorFrom the docs, not run by us
"Effect": "Allow", "NotAction": "s3:DeleteBucket", "Resource": "arn:aws:s3:::*"

All S3 actions on S3 resources except deleting buckets; the resource scopes it to S3

From the docs, not run by us
"Effect": "Deny", "NotAction": "iam:*", ... "BoolIfExists": {"aws:MultiFactorAuthPresent": "false"}

Deny everything except IAM actions when the caller did not use MFA; it grants nothing by itself

Try it: AWS IAM Policy EvaluatorFrom the docs, not run by us

A key missing from the request makes most operators false and negated ones (like StringNotLike) true. ...IfExists and Null are the exceptions.

StringEquals / StringNotEquals

Exact, case-sensitive string match or its negation

Try it: AWS IAM Policy EvaluatorFrom the docs, not run by us
StringEqualsIgnoreCase

Exact match ignoring case

From the docs, not run by us
StringLike / StringNotLike

Case-sensitive match with * and ? wildcards

Try it: AWS IAM Policy EvaluatorFrom the docs, not run by us
NumericLessThanEquals (and friends)

Numeric comparisons: Equals, NotEquals, LessThan, LessThanEquals, GreaterThan, GreaterThanEquals

From the docs, not run by us
DateGreaterThan (and friends)

Compare aws:CurrentTime or aws:EpochTime with an ISO 8601 or epoch value

From the docs, not run by us
Bool

Compare a key with true or false, for example aws:SecureTransport

From the docs, not run by us
IpAddress / NotIpAddress

Match aws:SourceIp against CIDR ranges; a bare address means /32

Try it: CIDR CalculatorFrom the docs, not run by us
ArnEquals / ArnLike

Match ARNs component by component; the two behave identically

From the docs, not run by us
StringLikeIfExists

Apply the test only if the key exists; a missing key counts as a match

From the docs, not run by us
"Null": { "aws:TokenIssueTime": "false" }

Require the key to be present, here meaning temporary credentials were used

From the docs, not run by us
ForAllValues: / ForAnyValue:

Set prefixes for multivalued keys: every request value must match, or at least one must

From the docs, not run by us
aws:SourceIp

Requester's public IP; absent when the call comes through a VPC endpoint

Try it: CIDR CalculatorFrom the docs, not run by us
aws:PrincipalOrgID

AWS Organizations ID of the calling principal's organization

From the docs, not run by us
aws:MultiFactorAuthPresent

Whether MFA was used to get the temporary credentials

From the docs, not run by us
aws:SecureTransport

Whether the request came over TLS

From the docs, not run by us
aws:RequestedRegion

The Region the request targets

From the docs, not run by us
aws:PrincipalTag/tag-key

A tag on the calling user or role

From the docs, not run by us
aws:ResourceTag/tag-key

A tag on the resource being accessed

From the docs, not run by us
aws:SourceArn / aws:SourceAccount

The resource or account on whose behalf an AWS service is calling

From the docs, not run by us

Order per the enforcement logic page: explicit deny check, RCPs, SCPs, resource-based, identity-based, permissions boundaries, session policies.

Implicit deny

Every request starts denied, except for the account root user

Try it: AWS IAM Policy EvaluatorFrom the docs, not run by us
Explicit deny

One applicable Deny in any policy type ends evaluation with Deny

Try it: AWS IAM Policy EvaluatorFrom the docs, not run by us
Identity-based + resource-based (same account)

Union: an allow in either one is enough unless something denies

Source: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html

From the docs, not run by us
Identity-based + permissions boundary

Intersection: both must allow

From the docs, not run by us
SCP / RCP

Must allow the action for member accounts; they set maximums and never grant

From the docs, not run by us
Session policy

Limits what a role or federated session can do; grants nothing on its own

Source: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html

From the docs, not run by us

Worked example: Why a developer with S3 full access still gets AccessDenied

A role has this identity policy, and the account has a bucket policy that requires TLS:

{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Action": "s3:*",
    "Resource": ["arn:aws:s3:::amzn-s3-demo-bucket", "arn:aws:s3:::amzn-s3-demo-bucket/*"]
  }]
}
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Deny",
    "Principal": "*",
    "Action": "s3:*",
    "Resource": ["arn:aws:s3:::amzn-s3-demo-bucket", "arn:aws:s3:::amzn-s3-demo-bucket/*"],
    "Condition": { "Bool": { "aws:SecureTransport": "false" } }
  }]
}

Walk it through the documented order. A request over plain HTTP carries aws:SecureTransport set to false, so the bucket policy's condition matches and the first step, the explicit deny check, ends with Deny. The identity allow never gets a say. Over HTTPS the condition is false, the deny does not apply, and the identity policy's allow carries the request through.

Now change the request so it has no aws:SecureTransport key at all. Bool returns false for a missing key, so the deny does not match. If you wanted missing to count as insecure, you would need a different design, such as BoolIfExists, and the docs warn that negated or IfExists forms need care inside Deny statements. Paste both policies into the IAM policy evaluator to try each case.

Common mistakes

  • Leaving out Version or using 2008-10-17 and wondering why ${aws:username} never matches.

    Set "Version": "2012-10-17". The older version treats policy variables as literal strings.

  • Using "Effect": "Allow" with NotAction to mean everything except one thing.

    That also grants every other service, including future ones. Scope it with a specific Resource, or list the actions you want.

  • Expecting a permissions boundary or SCP to give a role access.

    They only set maximums. You still need an identity-based or resource-based policy that allows the action.

  • Restricting ec2:RunInstances with StringLike on ec2:InstanceType and blocking every launch.

    Other resources in the launch lack that key, so the condition fails. The docs fix it with StringLikeIfExists.

  • Relying on aws:SourceIp for calls that go through CloudFormation or another service.

    The target service sees the calling service's IP, and the key is absent through VPC endpoints. The docs say not to use aws:SourceIp for those calls.

  • Granting cross-account access with only a bucket policy.

    Across accounts, the caller's account must also allow the action in an identity-based policy.