使用CloudFormation创建IdentityPool

use*_*030 5 aws-cloudformation serverless-framework aws-cognito

我正在尝试按照位于http://serverless-stack.com/chapters/create-a-cognito-identity-pool.html的教程来创建标识池,并使用cloudformation记录创建,以便我可以我完成后轻松撤消一切.但是,我无法找到任何显示如何使用模板语法有效执行此操作的示例.我现在拥有的是以下内容

ScratchUserPool:
      Type: AWS::Cognito::UserPool
      Properties:
        UserPoolName: notes-user-pool

ScratchUserPoolClient:
  Type: AWS::Cognito::UserPoolClient
  Properties:
    ClientName: notes-client
    ExplicitAuthFlows: [ADMIN_NO_SRP_AUTH]
    UserPoolId:
      Ref: ScratchUserPool

ScratchIdentityPool:
  Type: AWS::Cognito::IdentityPool
  Properties:
    IdentityPoolName: ScratchIdentityPool
    AllowUnauthenticatedIdentities: false
    CognitoIdentityProviders:
      - ClientId:
          Ref: ScratchUserPoolClient
        ProviderName:
          Ref: ScratchUserPool
Run Code Online (Sandbox Code Playgroud)

部署步骤在尝试创建时失败ScratchIdentityPool.我得到一个错误说明:

配置堆栈时发生错误:ScratchIdentityPool - 无效的Cognito身份提供程序(服务:AmazonCognitoIdentity;状态代码:400;错误代码:InvalidParameterException;请求ID:bc058020-663b-11e7-9f2a-XXXXXXXXXX)

我没有正确引用客户端或提供商名称吗?

use*_*030 6

几乎在我发布问题之后,我想我能够回答它.我的身份池的问题是我需要以下列方式引用提供者名称:

ScratchIdentityPool:
  Type: AWS::Cognito::IdentityPool
  Properties:
    IdentityPoolName: ScratchIdentityPool
    AllowUnauthenticatedIdentities: false
    CognitoIdentityProviders:
      - ClientId:
          Ref: ScratchUserPoolClient
        ProviderName:
          Fn::GetAtt: [ScratchUserPool, ProviderName]
Run Code Online (Sandbox Code Playgroud)

我需要使用特殊的亚马逊功能Fn::GetAtt才能使其正常工作.