使用 pull 方法的跨账户代码管道

Cross account codepipeline using pull method

我正在尝试创建一个跨帐户代码管道,但没有适合这种情况的文档。

  1. AccountT - A 有带有 yaml 文件的 s3 存储桶
  2. 账户 B 将拥有代码管道

账户 B codepipeline 应该在账户 A 的源阶段使用 S3 作为源,在部署阶段使用 cloudformation 部署方法。有人可以帮助说明完成此任务必须满足的角色和其他需求。

要完成这项工作,您需要做两件事。

  1. 您的存储桶需要使用客户 KMS 密钥,而不是默认密钥。这是因为您无法授予其他帐户使用默认密钥的权限,这意味着其他帐户无法解密存储桶中的数据。您需要在密钥策略中授予权限,以允许其他帐户使用该密钥进行解密。理想情况下,不仅针对整个帐户,还针对您的 CodePipeline 源步骤中使用的角色。
  2. 您必须在 S3 存储桶策略中授予对其他帐户的访问权限。理想情况下,不仅针对整个帐户,还针对您的 CodePipeline 源步骤中使用的角色。

我有一个project that does some of this using organizations. It isn't exactly what you want, in that the CodePipeline in my project lives in "AccountT" and the pipeline runs CloudFormation (or other things) run in "Account-B". So in my case only CloudFormation is reaching back to the bucket in "AccountT". I don't think it should be a big change to modify it to work the way you need it to work. My project is largely based off this AWS article