简体   繁体   中英

AWS S3 Bucket Policy to allow read-only access from my instances

Is it possible to create an S3 bucket policy that allows read-only access from my EC2 instances? I tried a bunch of things, but I can't figure out what to use for the principal.

The principal will be the role.

ie: arn:aws:iam::accountnumber:role/rolename

This post describes how to do it:

http://www.tothenew.com/blog/role-based-s3-access-from-a-specific-ec2-instance/

just ignore the part about the IP address since you won't need it.

您应该为实例分配一个角色,该角色允许访问S3存储桶。

The issue is that:

  1. You need both the role itself and the assumed-role in your not_principals clause
  2. wildcards are not allowed in principal specifications

This explains how to use userid instead:

https://aws.amazon.com/blogs/security/how-to-restrict-amazon-s3-bucket-access-to-a-specific-iam-role/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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