我想连接账户 A 中的 ec2 实例,该实例应该能够从账户 A 和另一个账户 B 访问存储桶。如何实现?
我看到了官方文档 https://aws.amazon。 com/premiumsupport/knowledge-center/s3-instance-access-bucket/ 表示要在帐户中创建角色并附加! 我有另一个解决方案,即在账户 B 中创建一个 IAM 用户并仅授予其 S3 存储桶权限,并使用该用户在账户 B 中配置 EC2 实例。那么如果我这样做会有效吗? EC2实例仍然可以从其帐户访问S3吗?
I saw the official documentation https://aws.amazon.com/premiumsupport/knowledge-center/s3-instance-access-bucket/ which says to create role in both account and attach!
I had another solution which is create an IAM user in account B and grant it only S3 bucket permissions and config the EC2 Instance in Account B with that user. So if i do that will it work? and can the EC2 instance still access the S3 from the its account?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的情况似乎是:
Bucket-A
)Bucket-B
) 中的存储桶您应该执行以下操作:
角色-A
) Amazon EC2 实例具有:Bucket-A
、和的权限Bucket-B
的权限Bucket-B
允许从Role-A
访问存储桶(这将授予“跨账户访问权限”)就是这样!由于 IAM 角色的权限,实例将能够访问
Bucket-A
,并且由于 IAM 角色的权限,实例将能够访问Bucket-B
和桶政策。It appears that your situation is:
Bucket-A
)Bucket-B
)You should do the following:
Role-A
) for the Amazon EC2 instance with:Bucket-A
, andBucket-B
Bucket-B
that permits access to the bucket fromRole-A
(This will grant "cross-account access")That's it! The instance will be able to access
Bucket-A
due to permissions in the IAM Role, and it will be able to accessBucket-B
due to permissions in both the IAM Role and the Bucket Policy.