Python 获得;属性错误:';CfnUserPool';对象没有属性';用户池id'&引用;错误
我正在尝试使用AWS文档创建“CfnUserPoolClient”对象- 我创建了这样的“CfnUserPool”对象-Python 获得;属性错误:';CfnUserPool';对象没有属性';用户池id'&引用;错误,python,amazon-cognito,aws-cdk,aws-userpools,Python,Amazon Cognito,Aws Cdk,Aws Userpools,我正在尝试使用AWS文档创建“CfnUserPoolClient”对象- 我创建了这样的“CfnUserPool”对象- _cognito_user_pool = _cognito.CfnUserPool(stack, id="pool-id", user_pool_name="user-auth-pool") _user_pool_id = _cognito_user_pool.id 要创建“CfnUserPoolClient”对象,我需要“CfnUserPool”对象的ID。 我正在使用
_cognito_user_pool = _cognito.CfnUserPool(stack, id="pool-id", user_pool_name="user-auth-pool")
_user_pool_id = _cognito_user_pool.id
要创建“CfnUserPoolClient”对象,我需要“CfnUserPool”对象的ID。
我正在使用下面的代码创建“CfnUserPoolClient”对象-
我得到下面的错误代码-
AttributeError: 'CfnUserPool' object has no attribute 'user_pool_id'.
我认为“CfnUserPool”对象没有“user\u pool\u id”属性。
我已经尝试使用“id”来获取这样的用户池id-
_cognito_user_pool = _cognito.CfnUserPool(stack, id="pool-id", user_pool_name="user-auth-pool")
_user_pool_id = _cognito_user_pool.id
但我还是得到了同样的错误,这次是“id”
那么,如何从CfnUserPool资源中获取CfnUserPool客户端的“user\u pool\u id”值呢?答案-我使用UserPool而不是CfnUserPool解决了这个问题。UserPool具有“user\u pool\u id”属性,我们可以使用该属性获取其id值。仅供其他人参考,以下内容将用于此目的: _user\u pool\u id=\u cognito\u user\u pool.ref