What Is an AWS Resource-Based Policy? Define Principals and Actions on an S3 Bucket
An AWS resource-based policy is a JSON policy attached directly to a resource, such as an S3 bucket or KMS key, to specify who may perform which actions and under what conditions. An identity-based policy attached to a user or role describes permissions from the principal’s perspective; a resource-based policy names the allowed principal from the protected resource’s perspective. The two approaches are not interchangeable, and cross-account access and KMS often require policies on both sides.
An AWS resource-based policy is a JSON policy attached directly to a resource, such as an S3 bucket or KMS key, to specify who may perform which actions and under what conditions. An identity-based policy attached to a user or role describes permissions from the principal’s perspective; a resource-based policy names the allowed principal from the protected resource’s perspective. The two approaches are not interchangeable, and cross-account access and KMS often require policies on both sides.
This article follows official AWS IAM, S3, and KMS documentation checked on November 20, 2026. It focuses on S3 bucket policies, policy structure, and permission evaluation, while noting service-specific differences. Account IDs, organization IDs, and bucket names in examples are fictional placeholders.
How does it differ from an identity-based policy?
An identity-based policy attaches to a user, group, or role and describes what that identity can do. A resource-based policy attaches to a resource and describes which Principal can do what Action on which Resource, optionally under a Condition. For example, an S3 bucket policy can allow a role to read objects under one prefix or explicitly deny requests that do not meet a condition.
Common resource-based policies include S3 bucket policies and IAM role trust policies. Every KMS key has a key policy, which is a resource policy for the key. Not every AWS service supports ordinary resource-based policies. Check the policy mechanisms supported by the particular service and resource type before designing access.
What problem does an S3 bucket policy solve?
Suppose an analytics role in an organization should read only objects under reports/. An identity policy attached to the role describes which resources the role can read. A bucket policy lets the bucket owner state which principals the bucket itself accepts. This is useful when the data owner wants to manage the sharing boundary at the resource, including sharing resources with principals from other accounts.
The following illustrative policy allows the AnalyticsReader role to perform only GetObject on objects under the bucket’s reports/ prefix. 111122223333 and the bucket name are fictional placeholders.
{
"Version": "2012-10-17",
"Statement": [{
"Sid": "ReadReportsOnly",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::111122223333:role/AnalyticsReader"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::example-data-bucket/reports/*"
}]
}The main elements are:
`Principal` identifies the allowed role by its IAM ARN.
`Action` is `s3:GetObject`, which reads an object. It differs from `s3:ListBucket`, which lists bucket contents.
`Resource` names objects under `reports/`, not the bucket itself. Bucket-level and object-level operations often use different ARN forms.
`Effect: Allow` permits matching requests. A matching explicit `Deny` takes precedence over other allows.
This is an illustrative example, not a policy tested in a live account. If the role is in another AWS account, a bucket policy alone is not enough: the external account’s identity policy must also allow the access, and both account evaluations must allow it. Organization policies and other applicable restrictions can narrow access further.
How does evaluation differ within one account and across accounts?
Within one account, for many resource types an explicit allow in either an identity-based policy or a resource-based policy can grant access. The exact result depends on the principal type and how the resource policy names it. IAM role trust policies and KMS key policies are exceptions that must explicitly allow access, and some services have additional requirements. Do not assume one policy type always overrides another; check the service’s evaluation rules.
For a principal from another account, the resource-owning account’s policy generally needs to allow the external principal, and the caller’s account identity policy must also allow the requested operation. Both account evaluations must return Allow. AWS Organizations service control policies (SCPs), resource control policies (RCPs), permissions boundaries, session policies, VPC endpoint policies, or explicit denies may constrain the result. One Allow statement does not guarantee the final request will succeed.
How are resource-based policies different from ACLs and IAM roles?
A resource-based policy is a JSON document attached to a resource. An access control list (ACL) is a separate mechanism supported by some services, including S3, and can use different syntax and evaluation behavior. For modern S3 setups, consider object ownership settings and Block Public Access, and whether ACLs are necessary.
An IAM role can act as both an identity and a resource. Its trust policy says who may assume it; its identity-based permissions policy says what the resulting role session may do. An S3 bucket policy instead attaches to the bucket and governs access to the bucket and its objects. If AWS offers a managed sharing service for the resource type, such as AWS Resource Access Manager (RAM), consider whether it is easier to manage than many separate resource policies.
Why do KMS key policies need special attention?
Every AWS KMS customer-managed key must have a key policy. It is the primary policy for controlling access to that key. IAM policies can allow key use only if the key policy explicitly enables the account to delegate permissions through IAM; otherwise, an IAM Allow alone has no effect. For a caller in another AWS account, the key-owning account’s key policy and the caller account’s IAM policy must both allow the operation.
Policy administration can affect access to encrypted data and whether a key remains manageable. Treat permission to change a key policy, such as kms:PutKeyPolicy, separately from permission to use the key. Consider separating key administrators from principals that perform cryptographic operations. KMS key policies are regional and apply only to keys in that Region.
How should you write and verify a policy safely?
**Narrow the target first.** Identify the principal, data, and API actions required. Do not start with broad principals such as every user or `Principal: "*"`.
**Check the service authorization reference.** Confirm the actions and resource types required for each operation. Distinguish bucket-level permissions from object-level permissions when their ARN formats differ.
**Confirm that conditions actually strengthen the boundary.** When using conditions such as organization ID or transport security, do not assume an Allow condition blocks alternate access paths from other policies or ACLs. If you need a full restriction, review the service’s recommended Deny pattern, ACLs, Block Public Access, and other access paths.
**Review public access separately.** Check S3 Block Public Access at the account and bucket levels. Public website hosting is a specific case that requires understanding the exposure and configuring the intended scope.
**Test both allowed and denied cases.** Confirm an allowed principal can read objects in the intended prefix while other prefixes and write/delete operations are rejected. Console testing may require extra permissions used by the console, so its results can differ from an application’s exact permissions.
**Audit policy changes and access.** Limit who can change policies and review service audit records for policy updates and access events. IAM Access Analyzer can help identify external sharing in supported resource policies.
Common errors and what to check
**Invalid principal or wrong `Principal`:** Verify the account ID, role ARN, and whether the principal was deleted or recreated. Check the ARN partition and account when the principal is external.
**An `Allow` exists, but access is denied:** Check that the resource ARN matches the operation, whether the caller’s account also needs an identity policy, and whether explicit denies, SCPs/RCPs, permissions boundaries, session policies, or a VPC endpoint policy apply.
**Object reads work but listing fails:** `s3:GetObject` reads objects; `s3:ListBucket` lists bucket contents. If listing is required, design a separate permission on the bucket ARN, with any needed prefix condition.
**Only KMS operations fail:** Check whether the key policy allows the principal or enables IAM delegation, whether the caller’s IAM policy allows the KMS action, and whether the key is in the expected Region.
**Unexpected public or outside-organization access:** Review S3 Block Public Access, ACLs, bucket policies, access points, and organization conditions together. Adding one Allow condition does not automatically remove other grant paths.
Resource-based policies let the resource owner describe a sharing boundary at the resource itself. They do not unify every AWS service’s authorization model, and cross-account access and KMS often require additional policies. Minimize the principal, action, resource, and condition, then verify success and denial using the specific service’s evaluation rules.
References
[AWS IAM: Policies and permissions, including resource-based policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html)
[AWS IAM: Identity-based and resource-based policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_identity-vs-resource.html)
[AWS IAM: Policy evaluation and allow/deny logic](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic_policy-eval-denyallow.html)
[Amazon S3: Bucket policy examples](https://docs.aws.amazon.com/AmazonS3/latest/userguide/example-bucket-policies.html)
[AWS KMS: Key policies](https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html)
[AWS KMS: Controlling access and permissions](https://docs.aws.amazon.com/kms/latest/developerguide/control-access.html)