Sub topic 5
What SCPs do not restrict
This chapter assumes you know the organization tree and how SCPs are attached and inherited. It covers the principals and actions that service control policies (SCPs) never evaluate. These gaps cause two kinds of mistakes: guardrails you believe are in force but are not, and "mystery" access that no SCP can explain.
The core rule: SCPs filter principals in member accounts
An SCP sets the maximum permissions for IAM users and roles in member accounts of your organization. Three consequences follow:
- An SCP never grants access. It only removes permissions that identity-based or resource-based policies would otherwise allow.
- An SCP is evaluated against the calling principal. It is not evaluated against the resource being accessed.
- If the caller is not an IAM user or role in a member account, the SCP has nothing to evaluate.
Most of the exemptions below follow from these points.
Exemption 1: the management account
SCPs do not affect any user or role in the management account. This includes the root user of the management account. You can attach an SCP to the root of the organization, and it still has no effect on the management account.
This means you cannot use SCPs to limit what an administrator in the management account can do. It also means a compromised management account credential bypasses every deny you have written.
Practical guidance:
- Keep workloads out of the management account. Use it for Organizations, billing, and a very small number of administrative tasks.
- Protect its credentials with MFA and tight IAM policies, because an SCP cannot do that job.
- Delegate administration of services such as IAM Identity Center, CloudFormation StackSets, or security services to a delegated administrator account. A delegated administrator is an ordinary member account, so SCPs do apply to it.
You can find the management account ID with the CLI:
aws organizations describe-organization \
--query 'Organization.[Id,MasterAccountId]' \
--output textAny test of an SCP must run in a member account. A test in the management account always succeeds, whatever the policy says.
Exemption 2: service-linked roles
A service-linked role (SLR) is a role predefined by an AWS service, with permissions that the service defines. Actions that use permissions attached to a service-linked role are not restricted by SCPs. Examples include AWSServiceRoleForElasticLoadBalancing and AWSServiceRoleForAutoScaling.
This is intentional. Blocking an SLR could break a service's ability to manage resources on your behalf, for example by leaving an Auto Scaling group unable to launch instances.
Two details are easy to confuse:
- An SCP does not restrict what an existing SLR does.
- An SCP can still restrict the principal who creates or deletes the SLR. A deny on
iam:CreateServiceLinkedRolestops a member-account user from creating one, even though the role's later activity is exempt.
Regular roles that a service assumes on your behalf are different. A role such as a Lambda execution role or an ECS task role is a normal IAM role in a member account. SCPs apply to it. The same is true of OrganizationAccountAccessRole, the role Organizations creates in new accounts. A deny SCP can lock it out.
Exemption 3: principals outside the organization
SCPs only apply to accounts in the organization they are attached to. Suppose a role in account 111111111111 (outside your organization) accesses an S3 bucket in your member account through the bucket policy. Your SCPs do not evaluate that request, because the caller does not belong to your organization.
This is a common source of false confidence. A deny SCP on s3:GetObject protects data from your own principals. It does not stop an external account that a bucket policy trusts. Controlling that access requires a resource control policy (RCP), a resource-based policy, or a condition such as aws:PrincipalOrgID. Later chapters cover RCPs.
The reverse also holds. If a principal in your member account calls a resource in another account, your SCP still applies to that principal. The resource owner's SCPs and RCPs apply as well, if that account is in an organization.
Exemption 4: AWS service principals
When an AWS service acts under its own service principal, such as cloudtrail.amazonaws.com writing logs to a bucket, no IAM user or role in a member account makes the call. SCPs therefore do not evaluate the request. Granting or denying that access is the job of the resource-based policy on the target.
This matters when an SCP denies something broadly. A deny on s3:PutObject for your principals will not stop CloudTrail or Config from delivering logs. If you want to restrict which service principals can reach a bucket, use the bucket policy, or an RCP that tests aws:PrincipalIsAWSService or aws:SourceOrgID.
Exemption 5: specific tasks and services
AWS documents a short list of tasks that SCPs cannot restrict. The list includes:
- Registering for the Enterprise support plan.
- Providing trusted signer functionality for CloudFront private content.
- Configuring reverse DNS for an Amazon Lightsail email server or an Amazon EC2 instance acting as an email sender.
- Tasks on certain AWS-related services, such as Alexa Top Sites, Alexa Web Information Service, Amazon Mechanical Turk, and Amazon Product Marketing API.
AWS can revise this list. Check the current "Tasks and entities not restricted by SCPs" section in the Organizations user guide before you rely on it for a compliance claim.
What is not exempt
Some principals are often assumed to be exempt and are not:
- The root user of a member account. SCPs restrict it fully. This is one of the main uses of SCPs.
- IAM administrators in member accounts, even with
AdministratorAccess. An SCP deny overrides an Allow in an identity-based policy. - Delegated administrator accounts, as noted above.
- Roles assumed by a federated user in a member account. The SCP applies to the assumed role.
The following table summarizes the picture.
| Caller or action | Restricted by your SCPs? | Why |
|---|---|---|
| IAM user or role in a member account | Yes | Core scope of SCPs |
| Root user of a member account | Yes | It is a principal in a member account |
| Any principal in the management account, including its root user | No | The management account is outside SCP scope |
| Actions using a service-linked role's permissions | No | Services must be able to manage resources |
| Creating a service-linked role | Yes | The caller is a normal principal |
| Principal in an account outside the organization | No | Not part of the organization |
| AWS service principal acting for itself | No | Not an IAM user or role in a member account |
| Tasks on the documented exemption list | No | Documented AWS exception |
Exempting your own roles deliberately
Sometimes you want a break-glass or automation role to bypass a deny. Do that with a condition on aws:PrincipalARN. This must be explicit, because the exemptions above are not configurable. The following SCP denies ec2:DeleteFlowLogs for everyone except one named role in each account:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ProtectFlowLogs",
"Effect": "Deny",
"Action": "ec2:DeleteFlowLogs",
"Resource": "*",
"Condition": {
"ArnNotLike": {
"aws:PrincipalARN": "arn:aws:iam::*:role/SecurityBreakGlass"
}
}
}
]
}Gotchas when testing
- Test in a member account. A passing test from the management account proves nothing.
- Check the caller's account, not the resource's account. For cross-account access, the SCPs of the caller's account apply to the caller.
- Do not read an absence of denials as protection. If an access path involves a service principal, an SLR, or an outside account, an SCP is the wrong control for it.
- Separate "SCP does not apply" from "SCP allowed it." In both cases the request succeeds, but only the second means the policy was evaluated.
Exercise
A deny SCP on s3:DeleteBucket is attached to the organization root. An administrator signs in to the management account and deletes a bucket, and the call succeeds. Separately, a role in an unrelated external account deletes a bucket in a member account through a bucket policy that trusts it, and that call also succeeds. Explain why neither call is blocked and name the control that could restrict the second call.
Show answer
SCPs never apply to principals in the management account, so the first call is never evaluated against the root-level deny. SCPs also apply only to principals in the organization's member accounts, and the external role belongs to an account outside the organization, so the second call is not evaluated either. A resource control policy (RCP) on the member account, or a tighter bucket policy that uses a condition such as aws:PrincipalOrgID, can restrict the external caller.
Exercise
Your SCP denies ec2:* outside two approved Regions. Will it stop Auto Scaling from launching an instance in a third Region through its service-linked role? Will it stop a member-account user from creating the service-linked role?
Show answer
The SCP does not restrict actions that use a service-linked role's permissions, so Auto Scaling's use of its SLR is not blocked by it. A user in a member account who calls iam:CreateServiceLinkedRole is a normal principal, so SCPs apply to that call. The call is blocked only if an SCP denies that IAM action or a condition matches the request.