考题解析 | 为 Amazon S3 设置跨账户访问权限


  题目

Company A has an AWS account that is named Account A. Company A recently acquired Company B, which has an AWS account that is named Account B. Company B stores its files in an Amazon S3 bucket. The administrators need to give a user from Account A full access to the S3 bucket in Account B.
After the administrators adjust the IAM permissions for the user in Account A to access the S3 bucket in Account B, the user still cannot access any files in the S3 bucket. Which solution will resolve this issue?

A. In Account B, create a bucket ACL to allow the user from Account A to access the S3 bucket in Account B.
B. In Account B, create an object ACL to allow the user from Account A to access all the objects in the S3 bucket in Account B.
C. In Account B, create a bucket policy to allow the user from Account A to access the S3 bucket in Account B.
D. In Account B, create a user policy to allow the user from Account A to access the S3 bucket in Account B.

  参考答案

C

  参考解析

技巧:排除明显错误选项,在没有明显错误的选项中选择最合理的选项。

▢ 题干翻译
A 公司有一个名为 account A 的 AWS 帐户。A 公司最近收购了 B 公司,后者有一个名称为 account B 的 AWS 帐户,B 公司将其文件存储在 Amazon S3 存储桶中。管理员需要授予帐户 a 中的用户对帐户 B 中 S3 存储桶的完全访问权限。管理员调整帐户 A 中用户访问帐户 B 中 S3 存储桶的 IAM 权限后,用户仍然无法访问 S3 存储桶中的任何文件。哪种解决方案可以解决这个问题?

▢ 概括问题:
Account A 和 Account B 是两个独立的 AWS 账户。Account B 拥有一个 S3 存储桶(Bucket),存储了文件。Account A 的一个 IAM 用户需要获得 Account B 的 S3 存储桶的完全访问权限。

▢ 技术要点:
要使 Account A 的 IAM 用户 能够访问 Account B 的 S3 存储桶,必须由 Account B 的管理员在 Account B 的 S3 存储桶上显式授予权限。AWS 提供了几种方式来实现跨账户访问:
Bucket Policy(存储桶策略)(推荐),是最灵活、最常用的方式,可以精确控制谁可以访问存储桶及其内容,可针对 IAM 用户、角色、另一个 AWS 账户等主体授权。
Bucket ACL(存储桶访问控制列表),不能直接针对单个 IAM 用户授权,通常用于账户级别的权限管理,仅支持账户级别的权限(如 AWS Account ID)。
Object ACL(对象访问控制列表),不能直接针对单个 IAM 用户授权,通常用于账户级别的权限管理,针对单个对象的权限,管理粒度过细,不适用批量授权。
IAM Role(IAM 角色)(但题目问的是直接给用户权限,不涉及角色)
另外,要注意:
User Policy 仅适用于当前账户的 IAM 用户,不能用于跨账户授权。

A. 不正确。在 Account B 中创建 Bucket ACL,允许 Account A 的用户访问 S3 存储桶。Bucket ACL 仅支持账户级别授权(如 AWS Account ID),无法直接指定单个 IAM 用户。即使通过 Account A 的账户 ID 授权,用户仍需通过 IAM 角色或临时凭证访问,无法直接使用其 IAM 用户身份。
B. 不正确。在 Account B 中创建 Object ACL,允许 Account A 的用户访问存储桶中的所有对象。Object ACL 是针对单个对象的权限,无法批量应用于整个存储桶。同样无法直接授权单个 IAM 用户,仅支持账户或公开访问。
C. 正确。在 Account B 中创建 Bucket Policy,允许 Account A 的用户访问 S3 存储桶。Bucket Policy 可精确控制谁(如 IAM 用户 ARN)可以访问存储桶,并支持授予 3:*(完全权限)。
D. 不正确。在 Account B 中创建 User Policy,允许 Account A 的用户访问 S3 存储桶。User Policy 是 Account B 自身 IAM 用户的权限策略,无法用于授权其他账户的用户。跨账户授权必须通过 Bucket Policy 或资源共享机制(如 RAM)。