简体   繁体   English

AWS S3 使用 aws lambda 跨多个账户复制并触发内部 lambda 复制到其他存储桶

[英]AWS S3 copy across multiple accounts using aws lambda and trigger internal lambda to copy to other buckets

I have 2 AWS accounts app-dev and app-prod both have some buckets the structure is as follows我有 2 个 AWS 账户 app-dev 和 app-prod 都有一些存储桶,结构如下

在此处输入图像描述

The flow is as follows:流程如下:

app-prod(Account)-->bucket-prod-->copier-lambda-->app-dev(account)-->bucket-dev-->copier-lambda-->[bucket-dev1, bucket-dev2]

The copier lambda in the app-dev account works fine if I copy the file to bucket-dev from the same account manually using AWS console.如果我使用 AWS 控制台手动将文件从同一帐户复制到bucket-dev ,则app-dev帐户中的复印机 lambda 工作正常。 But, when the copier lambda from account app-prod copies the file to bucket-dev(app-dev) the copier lambda from account app-dev gets triggered but fails with "Access Denied" error and the IAM role for lambda is same in both the cases (file copied manually which triggers copier lambda in same account and file copied by a lambda from a different account) so I am confused here.但是,当来自帐户app-prod的复印机 lambda 将文件复制到bucket-dev(app-dev)时,来自帐户app-dev的复印机 lambda 被触发,但因"Access Denied"错误而失败,并且 Z943669F3FC432BZ586A8 中的 Z94366F3FC442BZ5F 的IAM role相同这两种情况(手动复制的文件在同一帐户中触发复印机 lambda 和由 lambda 从不同帐户复制的文件)所以我在这里感到困惑。

I'm pretty sure i'm missing something very small here.我很确定我在这里遗漏了一些非常小的东西。 Any help would be appreciated.任何帮助,将不胜感激。

Please note that if one account puts an object into a bucket owned by another account, the object is still owned by the originator.请注意,如果一个账户将 object 放入另一个账户拥有的存储桶中,则 object 仍归发起者所有。 The originator has to add an ACL to the object granting the bucket owner access to the object.发起者必须向 object 添加 ACL,授予存储桶所有者对 object 的访问权限。

See here for more details.有关更多详细信息,请参见此处

By default, an S3 object is owned by the AWS account that uploaded it.默认情况下,S3 object 归上传它的 AWS 账户所有。 This is true even when the bucket is owned by another account.即使存储桶由另一个帐户拥有也是如此。 To get access to the object, the object owner must explicitly grant you (the bucket owner) access.要访问 object,object 所有者必须明确授予您(存储桶所有者)访问权限。

The object owner can grant the bucket owner full control of the object by updating the access control list (ACL) of the object. object 所有者可以通过更新 object 的访问控制列表 (ACL) 授予存储桶所有者对 object 的完全控制权。 The object owner can update the ACL either during a put or copy operation, or after the object is added to the bucket. object 所有者可以在放置或复制操作期间或在将 object 添加到存储桶之后更新 ACL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM