Reputation: 41
I really hate coming to stackoverflow with such a noob question but my searching has returned little to nothing useful.
So, I've implemented Amplify and Cognito for authentication, that all works but I obviously need to store some additional user information in a database. In my case, I'm going to be using DynamoDB.
My question is, how? How do I reference a user in the database from Cognito? or more specifically, how "should" this be done properly? I can think of a thousand ways to do it, but being fairly new to this side of AWS, I'm not sure of the best path to take.
I'm sure I'll get hammered on this question (always do) but thanks for any genuine advice for somebody with a basic question about how to properly implement something.
Upvotes: 3
Views: 689
Reputation: 25669
Each Cognito UserPool user has a unique UUID UserID
. It is the natural choice for the DynamoDB Partition Key for user records. Cognito can trigger a lambda on certain events like sign-up, giving you the opportunity to bootstrap the new user DynamoDB record.
Depending on your use case, Cognito user pool attributes may be an alternative DynamoDb user records. You can set (immutable) string and number values on custom attributes for each user.
Upvotes: 3