Identity-Based vs Resource-Based S3 Access
coreintermediateAn identity-based policy is attached to an IAM user/role and says what that identity can do. A bucket policy is attached to the bucket itself (resource-based) and says who can do what to it — including granting access to a completely different AWS account. Both are evaluated together; access requires no explicit deny and at least one explicit allow.
Think of it as
An identity-based policy is a badge you personally carry ("I can open any door labeled finance"). A bucket policy is a sign on the door itself ("only badges from accounts A and B may enter"). Getting through requires satisfying both — your badge and the door's own rule.
What we're doing: See a bucket policy grant cross-account read access without any role assumption.
- 2
- The Principal names a different AWS account (222233334444) directly — that account's users/roles with s3:GetObject permission can now read this bucket, with no cross-account role assumption needed on either side.
Why this works: This is the specific capability identity-based policies alone cannot provide — an identity-based policy can only grant permissions to act on resources, it cannot itself make a resource accessible to a principal in another account the way a resource-based policy can.
Trying to grant cross-account S3 access with only an identity-based policy
Wrong
Better
What you see: A user in Account A still gets AccessDenied when reading an object in Account B's bucket, despite Account A's IAM policy explicitly granting s3:GetObject on that bucket's ARN.
Why: An identity-based policy only controls what the identity is permitted to attempt — it cannot grant access on a resource it does not own; the resource's own account must independently grant that access via a bucket policy (or ACL), since both sides of a cross-account request must agree.
- Identity-based policy
- Attached to an IAM user/role
- Says what that identity can attempt
- Cannot alone grant cross-account access
- Bucket policy
- Attached to the bucket itself
- Can name a principal in another account directly
- The standard way to grant cross-account access
Identity-based vs bucket (resource-based) policy
Remember: Identity-based policies are attached to IAM users/roles; bucket policies are attached to the bucket and are the standard way to grant cross-account access directly. Both are evaluated together — access needs no explicit deny and at least one explicit allow.
See also: public access risks · iam vocabulary

