Sub topic 6
Deny list versus allow list strategies
This chapter assumes you can read IAM policy JSON. It also assumes you know how SCPs are attached to the root, OUs, and accounts, and that an SCP never grants permissions. It only limits what identity-based and resource-based policies can allow.
Two ways to build guardrails
Every SCP strategy rests on one fact. AWS attaches a managed policy named FullAWSAccess to the root, every OU, and every account when you enable SCPs. It allows all actions. What you do with that policy decides your strategy.
| Row | Deny list | Allow list |
|---|---|---|
| `FullAWSAccess` | Kept | Detached |
| What you write | `Deny` statements for specific things | `Allow` statements for approved services |
| Default for new services | Allowed | Blocked |
| Maintenance | Add denies as risks appear | Add allows as teams need services |
| Failure mode | A risky action you did not think of stays open | A needed action is blocked until you allow it |
Deny list
In a deny list, you keep FullAWSAccess and attach SCPs that deny what you want to prevent. The Region restriction and the organizations:LeaveOrganization policy from the next chapter are both deny-list policies.
A Deny in an SCP at any level of the path to an account wins. A child OU cannot undo a deny set above it. Because of this, deny lists are easy to reason about and easy to layer. They are also what AWS recommends for most organizations.
The cost is that you must know what to deny. A new AWS service is usable on day one unless an existing deny covers it.
Allow list
In an allow list, you detach FullAWSAccess and attach SCPs that allow only approved actions. Anything not explicitly allowed is implicitly denied.
An action must be allowed at every level between the root and the account. If the root has an allow list and an OU has none, accounts in that OU can do nothing. This is the usual cause of an allow-list outage.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowApprovedServices",
"Effect": "Allow",
"Action": [
"ec2:*",
"s3:*",
"logs:*",
"cloudwatch:*",
"iam:*",
"sts:*"
],
"Resource": "*"
}
]
}Include iam:* and sts:* in the list, or your teams cannot manage roles or assume them.
# Attach the allow list first, then detach the default policy
aws organizations attach-policy \
--policy-id p-allowlistexample \
--target-id ou-exam-ple12345
aws organizations detach-policy \
--policy-id p-FullAWSAccess \
--target-id ou-exam-ple12345The order matters. If you detach FullAWSAccess first, every account in the OU loses all permissions until the replacement is attached.
Choosing between them
Start with a deny list unless you have a compliance reason to approve services one by one. You can also combine them. Use an allow list on a sandbox OU, where you want to permit a few services, and a deny list elsewhere. Test any change to FullAWSAccess on a test OU first, because the blast radius is every account beneath the target.
Some teams hit the size limit on allow lists. An SCP document can be at most 5,120 characters, and a target can have at most five SCPs attached. Long service lists can run into both limits.
Exercise
An OU has an allow-list SCP permitting s3:*. The root still has only FullAWSAccess, and the OU's own FullAWSAccess was detached. Can a principal in an account in that OU call ec2:RunInstances? Why or why not?
Show answer
No. With FullAWSAccess detached from the OU, an action must be allowed by the OU's SCPs, and the allow list covers only s3:*. The root's FullAWSAccess allows everything, but the action must be allowed at every level, so the OU's missing allow causes an implicit deny.