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
"Statement": [ ... ]Container for one or more permission statements
"Sid": "FirstStatement"Optional label to tell statements apart
"Effect": "Allow" | "Deny"Whether matching requests are allowed or denied
"Principal": { "AWS": "arn:aws:iam::111122223333:root" }Who the policy applies to; required in resource-based policies, not allowed in identity-based ones
"Action": ["s3:List*", "s3:Get*"]API actions as service:Action, wildcards allowed
"Resource": "arn:aws:s3:::amzn-s3-demo-bucket/*"ARNs the actions apply to; required in identity-based permission policies
"Condition": { "Bool": { "aws:MultiFactorAuthPresent": "true" } }Extra tests the request must pass for the statement to apply
"Effect": "Allow", "NotAction": "iam:*", "Resource": "*"Allow every action in every service except IAM; broad, use with care
"Effect": "Allow", "NotAction": "s3:DeleteBucket", "Resource": "arn:aws:s3:::*"All S3 actions on S3 resources except deleting buckets; the resource scopes it to S3
"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
A key missing from the request makes most operators false and negated ones (like StringNotLike) true. ...IfExists and Null are the exceptions.
StringEquals / StringNotEqualsExact, case-sensitive string match or its negation
StringEqualsIgnoreCaseExact match ignoring case
StringLike / StringNotLikeCase-sensitive match with * and ? wildcards
NumericLessThanEquals (and friends)Numeric comparisons: Equals, NotEquals, LessThan, LessThanEquals, GreaterThan, GreaterThanEquals
DateGreaterThan (and friends)Compare aws:CurrentTime or aws:EpochTime with an ISO 8601 or epoch value
BoolCompare a key with true or false, for example aws:SecureTransport
IpAddress / NotIpAddressMatch aws:SourceIp against CIDR ranges; a bare address means /32
ArnEquals / ArnLikeMatch ARNs component by component; the two behave identically
StringLikeIfExistsApply the test only if the key exists; a missing key counts as a match
"Null": { "aws:TokenIssueTime": "false" }Require the key to be present, here meaning temporary credentials were used
ForAllValues: / ForAnyValue:Set prefixes for multivalued keys: every request value must match, or at least one must
aws:SourceIpRequester's public IP; absent when the call comes through a VPC endpoint
aws:PrincipalOrgIDAWS Organizations ID of the calling principal's organization
aws:MultiFactorAuthPresentWhether MFA was used to get the temporary credentials
aws:SecureTransportWhether the request came over TLS
aws:RequestedRegionThe Region the request targets
aws:PrincipalTag/tag-keyA tag on the calling user or role
aws:ResourceTag/tag-keyA tag on the resource being accessed
aws:SourceArn / aws:SourceAccountThe resource or account on whose behalf an AWS service is calling
Order per the enforcement logic page: explicit deny check, RCPs, SCPs, resource-based, identity-based, permissions boundaries, session policies.
Implicit denyEvery request starts denied, except for the account root user
Explicit denyOne applicable Deny in any policy type ends evaluation with Deny
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
Identity-based + permissions boundaryIntersection: both must allow
SCP / RCPMust allow the action for member accounts; they set maximums and never grant
Session policyLimits 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
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
Versionor using2008-10-17and wondering why${aws:username}never matches.Set
"Version": "2012-10-17". The older version treats policy variables as literal strings.Using
"Effect": "Allow"withNotActionto 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:RunInstanceswithStringLikeonec2:InstanceTypeand blocking every launch.Other resources in the launch lack that key, so the condition fails. The docs fix it with
StringLikeIfExists.Relying on
aws:SourceIpfor 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:SourceIpfor 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.
Related cheat sheets
Sources
- https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_version.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_notaction.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic_policy-eval-denyallow.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html
How we research: where our facts come from, how often we re-check them, and why no one can pay for a review or a verdict.