AWS Certified Solutions Architect – Associate
IAM policy evaluation: explicit deny, SCPs and boundaries
AWS denies a request unless a policy allows it, and an explicit deny in any applicable policy overrides every allow. Within one account, identity-based and resource-based policies add together. SCPs, permissions boundaries and session policies grant nothing: they set a ceiling, so the action must also be allowed by each of them.
Identity-based and resource-based policies
In the same account, the permissions are the union of the identity-based policy on the user or role and the resource-based policy on the resource, such as a bucket policy. If either one allows the action, AWS allows it. An explicit deny in either one overrides the allow.
Across accounts, the rule changes. AWS evaluates the request in both accounts. The caller's identity-based policy in its own account must allow the request, and the resource-based policy in the resource's account must allow the caller. The request is allowed only if both evaluations return Allow.
Guardrails that grant nothing
A service control policy (SCP) never grants permissions. It sets the maximum for IAM users and roles in member accounts, including each member account's root user. SCPs need an organization with all features enabled. A permission must be allowed at every level from the root through each OU down to the account. Remove FullAWSAccess without putting an allow in its place and every action in the affected accounts fails.
SCPs do not affect users or roles in the management account, and they do not affect service-linked roles. Member accounts that are delegated administrators are still affected.
A permissions boundary is a managed policy that sets the most an identity-based policy can grant a user or role. The effective permissions are the intersection of the two. If a boundary allows only S3, CloudWatch and EC2, an attached policy that allows iam:CreateUser still fails. When an SCP, a boundary and an identity-based policy all apply, all three must allow the action.
Where resource policies bypass a boundary
In the same account, a resource-based policy that grants access to an IAM user ARN is not limited by an implicit deny in that user's identity-based policy or permissions boundary. A user whose boundary allows only S3 can still read a Secrets Manager secret whose resource policy names the user.
A resource-based policy that grants access to an IAM role ARN is limited by an implicit deny in the role's permissions boundary or session policy. One that grants access to a role session ARN in the same account is not.
This only covers implicit denies. If the boundary explicitly denies the logs bucket, a bucket policy that allows the user still does not get them in.
Where the exam catches people
- Believing an SCP grants permissions: it only limits them, and users and roles still need IAM policies that allow the action.
- Believing an SCP attached at the root restricts the management account: SCPs do not affect users or roles in the management account.
- Believing an extra Allow cancels a Deny: an explicit deny in any applicable policy overrides every allow, so the deny itself has to change.
- Believing a permissions boundary gives access: it sets the maximum and grants nothing on its own.
- Believing a bucket policy alone gives another account access: the caller's identity-based policy in its own account must also allow the request.