Mapping Cognito Identity Id and User Pool Id


Link to chapter -


What will be the usage of the UserPool User Id inside the lambda?

I’ve trying to store some user data that wanted to retrieve inside Lambda and couldn’t figure out how to do it and ended up with a dynamodb table that has stored the CognitoIdentityId as a way to retrieve that data.

If this chapter is a solution to my problem I don’t see which part of the JS sdk I have to use inside the lambda to access the user pool.


I think it’s useful for looking up user attributes for instance, if you wanted a subscription/follow feature between users. It appears to me to open up your userpool to be more like a dynamoDB table you can query.


It seems so but unfortunately I could find what part of the JS sdk let’s you get that information. Maybe @jayair could give us a hint about what was the meaning of that chapter.


Yeah the basic problem is that when you authenticate your Lambda functions with IAM, you only get the Identity Id to work with. But there is no way to get the User Pool Id given the Identity Id. But this chapter details a little trick to let you get that.

You could then use that to get info using the Admin Cognito User Pool -