AWS 通过跨账户和 IAC 设置访问资源

AWS access to resources with cross account and IAC setup

我有以下场景:
我们正在 AWS 上构建一个基础设施,在多个账户上使用基础设施即代码 (IAC)。

我一开始有 account Aaccount B,我想同时使用 CloudFormation 和 Terraform 创建基础设施。创建帐户 A 时,我想允许帐户 B 中的角色访问在帐户 A 中创建的 S3 存储桶。帐户 B 中的角色尚未创建,但是,我知道名称是什么最终会是。

我的问题:如果我知道它们最终将如何命名,我能否在两个帐户之间授予对不存在资源的访问权限?
或者:我是否必须先创建资源才能授予访问权限?

Stack Sets would allow you to run manage stacks in multiple accounts and regions with CloudFormation. CloudFormation is pretty smart about dependencies, but you can explicitly use the DependsOn attribute to have resources wait for the dependent resource to be ready, like the IAM Role for cross-account access 在这种情况下。