Amazon web services CloudFormation AWS::Cognito::IdentityPoolLeatherAttachment角色映射语法错误
在我的AWS CloudFormation堆栈中,我想将角色附加到Cognito标识池(有效),对于身份验证提供者>Cognito>身份验证角色选择,使用CloudFormation语法选择“从令牌中选择角色”(无效),如下所示:Amazon web services CloudFormation AWS::Cognito::IdentityPoolLeatherAttachment角色映射语法错误,amazon-web-services,amazon-cloudformation,amazon-cognito,Amazon Web Services,Amazon Cloudformation,Amazon Cognito,在我的AWS CloudFormation堆栈中,我想将角色附加到Cognito标识池(有效),对于身份验证提供者>Cognito>身份验证角色选择,使用CloudFormation语法选择“从令牌中选择角色”(无效),如下所示: wzjCognitoIdentityPoolRoles: Type: AWS::Cognito::IdentityPoolRoleAttachment Properties: IdentityPoolId:
wzjCognitoIdentityPoolRoles:
Type: AWS::Cognito::IdentityPoolRoleAttachment
Properties:
IdentityPoolId:
Ref: wzjCognitoIdentityPool
Roles:
authenticated:
Fn::GetAtt: [cognitoAuthRoleWithIdentity, Arn]
unauthenticated:
Fn::GetAtt: [cognitoAuthRoleNoIdentity, Arn]
RoleMappings:
Type: Token
AmbiguousRoleResolution: AuthenticatedRole
部署时,出现以下错误:
An error occurred: wzjCognitoIdentityPoolRoles - Property validation failure: [Value of property {/RoleMappings/Type} does not match type {Object}, Value of property {/RoleMappings/AmbiguousRoleResolution} does not match type {Object}].
但据我所知,我认为我使用了正确的语法
我怎样才能解决这个问题
谢谢您的帮助。我认为您应该关注
AWS::Cognito::identitypoolleattachment
的语法,而不是角色映射
从中,我们可以获得RoleMappings
这是一个字符串到角色映射对象映射
所以我想你可以试试:
RoleMappings:
'graph.facebook.com':
Type: Token
AmbiguousRoleResolution: AuthenticatedRole
这里的
'graph.facebook.com'
只是一个例子。我认为您应该关注AWS::Cognito::IdentityPoolLeatAttachment
的语法,而不是RoleMappings
从中,我们可以获得RoleMappings
这是一个字符串到角色映射对象映射
所以我想你可以试试:
RoleMappings:
'graph.facebook.com':
Type: Token
AmbiguousRoleResolution: AuthenticatedRole
这里的
'graph.facebook.com'
只是一个例子。您可以通过以下方式生成:
!Join [ "", [ "cognito-idp.us-west-2.amazonaws.com" , "/", !Ref CognitoUserPool, ":", !Ref CognitoUserPoolAppClient], ]
其中,CognitoUserPoolAppClient
的类型为AWS::Cognito::UserPoolClient
我能够成功地将规则添加到标识提供程序。您可以通过以下方式生成此规则:
!Join [ "", [ "cognito-idp.us-west-2.amazonaws.com" , "/", !Ref CognitoUserPool, ":", !Ref CognitoUserPoolAppClient], ]
其中,CognitoUserPoolAppClient
的类型为AWS::Cognito::UserPoolClient
我能够成功地将规则添加到Identity provider。谢谢,我只是注意到了这一点。在我的例子中,Cognito是身份验证提供者,因此根据文档,我需要使用这个语法:cognito-idp-east-1.amazonaws.com/us-east-1\u abcdefghi:app\u client\u id。但是我不知道如何使用CloudFormation语法创建这个字符串……也许你可以尝试用
'cognito-idp-east-1.amazonaws.com/us-east-1\u abcdefghi:app\u client\u id'
替换。提到你的案例。是的,我是这么说的,但我不知道如何使用CloudFormation或无服务器框架语法动态构造它,因为它是一个键而不是一个值。这让事情变得更复杂…你的情况和你的一样吗?也许可以帮你…谢谢,我只是注意到事实上。在我的例子中,Cognito是身份验证提供者,因此根据文档,我需要使用这个语法:cognito-idp-east-1.amazonaws.com/us-east-1\u abcdefghi:app\u client\u id。但是我不知道如何使用CloudFormation语法创建这个字符串……也许你可以尝试用'cognito-idp-east-1.amazonaws.com/us-east-1\u abcdefghi:app\u client\u id'
替换。提到你的案例。是的,我是这么说的,但我不知道如何使用CloudFormation或无服务器框架语法动态构造它,因为它是一个键而不是一个值。这让事情变得更复杂…你的情况和你的一样吗?也许我能帮你。。。