![为 s3 用户配置根登录存储桶?](https://linux22.com/image/1524360/%E4%B8%BA%20s3%20%E7%94%A8%E6%88%B7%E9%85%8D%E7%BD%AE%E6%A0%B9%E7%99%BB%E5%BD%95%E5%AD%98%E5%82%A8%E6%A1%B6%EF%BC%9F.png)
我想为特定的 s3 用户配置策略/权限,以便他们登录到存储桶下的特定子文件夹。
我在这里有一个存储桶位置:s3://foo.s3.amazonaws.com下面是一个名为“error”的子文件夹,我希望用户默认登录到该文件夹。因此完整路径为:s3://foo.s3.amazonaws.com/error/
有没有办法我可以配置策略/权限,以便让特定用户登录到“错误”子文件夹?
答案1
您可以创建一个策略并将其与该用户关联。
`
{ "Version":"2012-10-17", "Statement": [ { "Sid": "AllowUserToSeeBucketListInTheConsole", "Action": ["s3:ListAllMyBuckets", "s3:GetBucketLocation"], "Effect": "Allow", "Resource": ["arn:aws:s3:::*"] }, { "Sid": "AllowRootAndHomeListingOfCompanyBucket", "Action": ["s3:ListBucket"], "Effect": "Allow", "Resource": ["arn:aws:s3:::foo"], "Condition":{"StringEquals":{"s3:prefix":["","error/"],"s3:delimiter":["/"]}} }, { "Sid": "AllowListingOfUserFolder", "Action": ["s3:ListBucket"], "Effect": "Allow", "Resource": ["arn:aws:s3:::foo"], "Condition":{"StringLike":{"s3:prefix":["error/*"]}} }, { "Sid": "AllowAllS3ActionsInUserFolder", "Effect": "Allow", "Action": ["s3:*"], "Resource": ["arn:aws:s3:::foo/error/*"] } ] }
查看这篇博文更多细节。