S3 对象拒绝访问 - 这些对象来自另一个账户的 AWS CodeBuild 项目

S3 objects deny access - These objects came from another account's AWS CodeBuild project

(+)
我刚刚在 petrch 的帮助下找到了一个类似的问题和答案(谢谢!)并尝试申请...


我正在通过 accountA 的 CodeBuild 项目更新 accountB 的 S3 存储桶。
一个问题是,accountA 的 CodeBuild 中的所有对象都拒绝访问。

我的目的是使用这个 S3 存储桶进行静态托管。
我设置了静态托管的所有要求,当我手动上传简单 index.html 时它工作正常。

但是来自 accountA 的 CodeBuild 项目的单个对象显示如下附加错误。
例如)index.html 属性和权限

我检查了 CodeBuild 项目中工件设置中的 Disable artifact encryption 选项。
以及覆盖参数, encryptionDisabled: true

当我将输出保存在同一帐户 S3 中时,此代码构建项目运行良好。
(AccountA 中的 S3 静态托管站点运行良好)
但是在 accountB 的 S3 中出现访问问题。

在尝试接触 KMS 策略之前,我想知道我是否遗漏了 CodeBuild 中的某些配置。

请告诉我我必须做什么或错过了什么......

谢谢。

(+)
我刚刚在 petrch 的帮助下找到了一个类似的问题和答案(谢谢!)并尝试申请...


使用bucket-owner-full-control 标准ACL 上传对象,否则对象仍将由源帐户“拥有”。 看: https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html

它说:

Amazon S3 access control lists (ACLs) enable you to manage access to buckets and objects. Each bucket and object has an ACL attached to it as a subresource. It defines which AWS accounts or groups are granted access and the type of access. When a request is received against a resource, Amazon S3 checks the corresponding ACL to verify that the requester has the necessary access permissions. When you create a bucket or an object, Amazon S3 creates a default ACL that grants the resource owner full control over the resource. This is shown in the following sample bucket ACL (the default object ACL has the same structure)

因此该对象具有源存储桶的 ACL,这不是很明显,但您可以在源帐户的 PutObject 操作期间提供 ACL。所以它仍然可以只是一个调用。