Sub topic 7
How SCPs Are Inherited and Evaluated, and Why to Prefer Deny Lists
This chapter assumes you know IAM policy evaluation, can read JSON policies, and have attached an SCP to an OU as shown in the previous chapter. Here you will learn how SCPs combine down the hierarchy and why most organizations write deny lists.
Inheritance: every level must allow
An SCP never grants permissions. It sets the maximum an account can be granted. An IAM principal can act only if both of these are true:
- An identity or resource policy in the account allows the action.
- Every level between the root and the account allows it through its SCPs. This covers the root, each parent OU, and the account itself.
At each level, the action must be allowed by at least one SCP attached there. A deny at any level wins over everything.
Two details matter:
- SCPs affect all IAM users and roles in member accounts, including the account's root user. They do not affect the management account.
- SCPs do not affect service-linked roles.
Allow lists and deny lists
Every new organization starts with the AWS-managed FullAWSAccess SCP attached at every level. It allows everything, so nothing is blocked until you add something.
- Deny list: keep
FullAWSAccessand attach SCPs with explicitDenystatements. Anything not denied stays allowed. - Allow list: detach
FullAWSAccessand attach SCPs that name every permitted action. Anything not listed is blocked.
The allow list looks safer, but it is harder to run. Because each level needs its own allow, you must repeat the allowed actions at the root, the OU and the account. Every new AWS service or action is blocked until you update the policies. SCPs also have a size limit, which large allow lists reach quickly.
The deny list is simpler. Two points follow from how evaluation works:
- A deny at the root applies to every account, and no lower level can undo it.
- Removing a guardrail means detaching one policy. It does not mean rebuilding a long allow list.
Reading a deny SCP with conditions
The Region restriction from the policy examples uses NotAction with a condition:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyOutsideApprovedRegions",
"Effect": "Deny",
"NotAction": [
"iam:*",
"organizations:*",
"route53:*",
"cloudfront:*",
"support:*",
"budgets:*",
"sts:*"
],
"Resource": "*",
"Condition": {
"StringNotEquals": {
"aws:RequestedRegion": ["eu-west-1", "eu-central-1"]
}
}
}
]
}This denies every action except the listed global services when the requested Region is not eu-west-1 or eu-central-1. The NotAction list keeps global services working, because they are served from a fixed Region such as us-east-1.
Common errors
- Testing only the account. A policy attached to the account works, but a deny on a parent OU still blocks it. Check every level above.
- Expecting an SCP to grant access. Allowing
s3:*in an SCP gives nobody S3 access. IAM policies must still allow it. - Locking out your own team. Keep administrative and break-glass roles outside restrictive denies, for example with a condition on
aws:PrincipalARN. - Attaching to the root first. Test a new deny on a sandbox OU before you move it up.
Exercise
An OU has FullAWSAccess and a deny SCP for ec2:*. A child account in that OU has an IAM policy that allows ec2:RunInstances. Can a role in the account launch instances, and why?
Show answer
No. The deny SCP on the parent OU is inherited by the account, and an explicit deny overrides any allow, including the IAM policy in the account.