简体   繁体   English

允许用户池中的 Cognito 用户访问 S3 存储桶的存储桶策略

[英]Bucket policy to allow Cognito user in User Pool access to S3 bucket

I am trying to add a bucket policy to my bucket because my bucket is in a root aws account, and I want to restricts other users, roles, etc. under the root account from accessing my bucket except for a specific Cognito user in my User Pool.我正在尝试向我的存储桶添加存储桶策略,因为我的存储桶位于 root aws 帐户中,并且我想限制 root 帐户下的其他用户、角色等访问我的存储桶,但我的用户中的特定 Cognito 用户除外游泳池。

I do not want to also use an identity pool -- I would just like to refer to the Cognito user as the principal in my bucket policy.我不想也使用身份池——我只想将 Cognito 用户称为我的存储桶策略中的主体。 Is there any way to do this without using an identity pool?有没有办法在不使用身份池的情况下做到这一点? I can't find any example policies that do this.我找不到任何执行此操作的示例策略。

You can set the Principle of your bucket policy as the auth role of your Cognito user.您可以将存储桶策略的原则设置为 Cognito 用户的身份验证角色。 In my case, the Principle looks like就我而言,原则看起来像

"Principal": {
    "AWS": "arn:aws:iam::123456789000:role/NAME_OF_MY-authRole"
},

Then, you can further control the access by changing the Resource.然后,您可以通过更改资源来进一步控制访问。 Here is the example from AWS docs .这是来自AWS docs的示例。

"arn:aws:s3:::bucket-name/cognito/application-name/${cognito-identity.amazonaws.com:sub}",
                "arn:aws:s3:::bucket-name/cognito/application-name/${cognito-identity.amazonaws.com:sub}/*"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AWS S3允许Cognito用户访问存储桶前缀 - aws s3 allow access to bucket prefix for cognito user 允许外部用户(通过 Cognito)访问 S3 存储桶和控制台 - Allow an external user (through Cognito) to access a S3 bucket and console 允许访问 Cognito 用户的 AWS S3 存储桶策略 - AWS S3 bucket policy to allow access to Cognito users 即使使用存储桶和/或用户策略,AWS s3存储桶上的访问也被拒绝 - Access denied on AWS s3 bucket even with bucket and/or user policy 有没有办法使用 AWS Amplify 库 (JavaScript) 在没有认知用户池和身份池的情况下访问 s3 存储桶? - Is there a way to use AWS Amplify library (JavaScript) to access s3 bucket without cognito user poool and identity pool? 允许 S3 访问 AWS 控制台中当前经过身份验证的用户的 S3 存储桶策略? - S3 Bucket Policy to allow S3 Access to Current Authenicated user in AWS Console? 如何只允许经过身份验证的用户(使用Cognito)访问他们自己的S3存储桶/密钥? - How do I only allow authenticated user (using cognito) access to their own S3 bucket/key specifically? Amazon S3存储桶策略,允许用户写入存储桶,但仅限该存储桶 - Amazon S3 Bucket policy to allow user to write to the bucket but that bucket only 无法授予 Cognito 用户对特定 S3 存储桶的访问权限 - Not able to give a Cognito User access on a certain S3 bucket 允许用户访问特定 S3 存储桶以进行备份的 AWS IAM 策略 - AWS IAM Policy to allow user access to specific S3 bucket for backup
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM