跳至內容

cross account s3 access

-2

How to provide access to S3 buckets in a different AWS account

已提問 1 個月前檢視次數 59 次
2 個答案
0

Hello.

There are several ways to allow cross-account access to S3, but I think the easiest is to use a bucket policy to allow IAM roles from other accounts.
The following documentation provides example configurations.
https://repost.aws/knowledge-center/cross-account-access-s3

專家
已回答 1 個月前
專家
已審閱 1 個月前
0

Bucket Policy Example

Add the following bucket policy in Account A to allow access from Account B.

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

IAM Policy Example

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["s3:GetObject", "s3:PutObject"],
      "Resource": "arn:aws:s3:::my-bucket/*"
    }
  ]
}

IAM Role (AssumeRole) Example

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::ACCOUNT-B-ID:root"
      },
      "Action": "sts:AssumeRole"
    }
  ]
}

Important note on access evaluation:

Same account: Either an IAM policy or a bucket policy alone is sufficient.
Cross-account: Both the requester's IAM policy and the bucket policy must explicitly allow the action.

For more details, please refer to: https://repost.aws/knowledge-center/cross-account-access-s3

AWS
支援工程師
已回答 1 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。