Course contentsShow
← Security
Lesson 1740 of 3,05235. Cloud Security - IAMFree lesson

Resource-Based Policies for Cross-Account

Granting cross-account access through resource policies on S3 buckets, KMS keys, and other services.

Resource-Based Policies for Cross-Account Access

What you'll learn: How to grant cross-account access by attaching policies directly to cloud resources like S3 buckets and KMS keys.

Two Ways to Cross the Account Boundary

You already know about using AssumeRole to let identities in one account access resources in another. But there's a second approach: resource-based policies that live on the resource itself and explicitly grant permissions to external accounts.

Think of it like your home security system: AssumeRole is giving someone a temporary key card after verifying their identity. A resource-based policy is like programming your front door lock to recognize specific people from the neighbor's house—no key exchange needed.

How Resource-Based Policies Work

With resource-based policies, you attach a policy directly to the resource (S3 bucket, KMS key, SNS topic, etc.) that specifies which external principals can access it and what they can do.

Example S3 bucket policy allowing cross-account read access:

{
  "Version": "2012-10-10",
  "Statement": [{
    "Effect": "Allow",
    "Principal": {
      "AWS": "arn:aws:iam::111122223333:root"
    },
    "Action": "s3:GetObject",
    "Resource": "arn:aws:s3:::my-bucket/*"
  }]
}

This says: "Account 111122223333 can read objects from my bucket." Users in that account still need their own IAM permissions to use this access—both sides must allow.

When to Use Resource-Based Policies

Use resource-based policies when:

  • You control the resource but not the accessing identities
  • You want simpler access without role assumption
  • The service supports them (S3, KMS, Lambda, SQS, SNS, etc.)

They're especially useful for services that need direct access, like Lambda functions triggered by S3 events across accounts.

Key Takeaway: Resource-based policies grant cross-account access by attaching permission statements directly to resources, requiring both the resource policy AND the accessing identity's permissions to allow the action.