Skill 1.1.5
Determining the appropriate use of resource policies for AWS services
Key Concepts
A resource-based policy is attached to a resource and includes a Principal element. Examples: S3 bucket policies, KMS key policies, SQS queue and SNS topic policies, Lambda function resource policies, ECR repository policies, Secrets Manager secret policies and API Gateway resource policies.
They are ideal for cross-account access: a bucket policy can allow another account's role to read objects without that role being assumed. They also let AWS services act on a resource, for example allowing S3 or EventBridge to invoke a Lambda function, or SNS to send to an SQS queue. Conditions such as aws:SourceArn, aws:SourceVpce, aws:SourceIp and aws:PrincipalOrgID restrict access further (for example, only through a VPC endpoint or only from your organisation).
Within one account, access is allowed if either the identity policy or the resource policy allows it (and nothing denies). Across accounts, both sides must allow it. KMS is special: the key policy must allow access, either directly or by delegating to IAM.