【发布时间】:2019-03-28 00:15:44
【问题描述】:
我收到了这个奇怪的错误 禁止访问角色“认知角色”。
在创建云形成堆栈时,这里是我的 yaml 格式的云形成文件。
我基本上是在创建一个 s3 存储桶和一个 cognito 身份,以方便客户端访问我的存储桶,除了这个错误,整个事情都运行良好 禁止访问角色“phototest-cognitoRole-1AMKUVXUXAJ5H”。 (服务:AmazonCognitoIdentity;状态代码:400;错误代码:NotAuthorizedException
AWSTemplateFormatVersion: 2010-09-09
资源:
photoBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: it-academy-photos-bucket
CorsConfiguration:
CorsRules:
- AllowedHeaders: ['*']
AllowedMethods: [GET,POST,PUT]
AllowedOrigins: ['*']
Id: myrules
cognitoRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
-
Effect: Allow
Principal:
Federated:
- "cognito-identity.amazonaws.com"
Action:
- sts:AssumeRoleWithWebIdentity
Policies:
-
PolicyName: "photo_client_policy"
PolicyDocument:
Version: '2012-10-17'
Statement:
-
Sid: VisualEditor1
Effect: Allow
Action:
- s3:PutObject
- s3:GetObjectAcl
- s3:GetObject
- s3:GetObjectTorrent
- s3:GetObjectVersionAcl
- s3:PutObjectVersionTagging
- s3:GetObjectTagging
- s3:PutObjectTagging
- s3:PutBucketCORS
- s3:PutObjectAcl
- s3:GetObjectVersion
Resource: "*"
cognitoIdentityPool:
Type: AWS::Cognito::IdentityPool
Properties:
IdentityPoolName: "photo_bucket"
AllowUnauthenticatedIdentities: true
cognitoIdentityPoolRoleAttachment:
Type: AWS::Cognito::IdentityPoolRoleAttachment
Properties:
IdentityPoolId: !Ref cognitoIdentityPool
Roles:
unauthenticated: !Ref cognitoRole
【问题讨论】:
标签: amazon-web-services amazon-cloudformation amazon-cognito