Sub topic 14
Troubleshooting denials caused by SCPs and RCPs
This chapter assumes you know how SCPs and RCPs are attached and inherited, and how they combine with IAM policies in request evaluation. It also assumes you can read CloudTrail events and use the AWS CLI. The goal is a repeatable way to find out which policy denied a request.
Start with the error message
The wording of an AccessDenied message tells you which layer denied the request.
| Message fragment | Meaning |
|---|---|
| `with an explicit deny in a service control policy` | A Deny statement in an SCP matched. |
| `because no service control policy allows the ... action` | The request was implicitly denied. No SCP on some level of the path allows the action. This is typical of allow-list strategies. |
| `with an explicit deny in a resource control policy` | A Deny statement in an RCP matched. |
| `because no resource control policy allows the ... action` | The RCP path does not allow the action. |
| `with an explicit deny in an identity-based policy` | The cause is IAM, not the organization. |
Not every service returns detailed messages, and some cross-account or console calls hide them. In those cases, move on to CloudTrail.
Follow a fixed sequence
- Identify the account that made the request and, for RCPs, the account that owns the resource.
- Read the
errorMessagefield of the CloudTrail event for the denied call. It often names the policy type even when the console does not. - List every policy that applies to that account.
- Compare the action, resource, and condition values in the request with each statement.
To list the policies that apply, walk the path from the account up to the root:
# Parents of the account, from account up to the root
aws organizations list-parents --child-id 111122223333
# SCPs attached directly to the account, then to each OU on the path
aws organizations list-policies-for-target \
--target-id 111122223333 \
--filter SERVICE_CONTROL_POLICY
aws organizations list-policies-for-target \
--target-id ou-exam-ple12345 \
--filter RESOURCE_CONTROL_POLICY
# Read the policy document
aws organizations describe-policy --policy-id p-examplepolicyidRepeat the target query for the OU's parent and for the root. The effective permissions are the combination of every level, so a Deny at any one level is enough.
Common causes
- Region conditions. A Region-restriction SCP denies calls whose
aws:RequestedRegionis not listed. Check the Region in the CloudTrail event. A service that calls a global endpoint inus-east-1can fail when only European Regions are approved, unless the service is in theNotActionlist. - Allow-list gaps. With
FullAWSAccessremoved, an action needs an Allow at the root, at each OU, and at the account. One missing level causes an implicit deny. - Missing
IfExistshandling in RCPs. A condition such asaws:SecureTransportoraws:PrincipalOrgIDbehaves differently when the key is absent. A perimeter that omits an exception for AWS service principals or approved third parties blocks legitimate callers, for example a service reading a bucket on your behalf. - Wrong account assumed. An SCP applies to the principal's account. An RCP applies to the resource's account. A cross-account request can be blocked by the policies of either side.
- Not an organization problem. SCPs and RCPs never grant access. If no SCP or RCP matches, check identity-based policies, resource-based policies, permission boundaries, and session policies.
Rule out the exemptions
If a request unexpectedly succeeds when you expected a denial, or you suspect the wrong policy, recall what the policies skip. SCPs do not affect the management account or service-linked roles. RCPs do not affect resources in the management account, and they cover only supported services. A test run from the management account tells you nothing about how a member account behaves. Reproduce the failure from a member account in the same OU.
Exercise
A role in a member account gets "with an explicit deny in a service control policy" when it calls ec2:RunInstances in ap-southeast-2. The organization uses a deny-list Region SCP that allows only eu-west-1 and eu-central-1. What do you check first, and what are two valid fixes?
Show answer
Confirm in the CloudTrail event that the requested Region is ap-southeast-2 and that the SCP is attached somewhere on the path from the account to the root. Fixes: launch the instance in an approved Region, or add the Region to the aws:RequestedRegion list in the SCP (or attach an adjusted policy to a narrower OU for that workload). Detaching the policy from the root is not a good fix.