Home > Software design >  storing user details in AWS RDS using Cognito
storing user details in AWS RDS using Cognito

Time:01-21

I am new to AWS, I need to securely store user details. So i was thinking to authorise and authenticate using cognito, but then i need to store multiple pieces of data about a user, some of the data stored about them should only be accessible to them some to every other user. So my question is how can i restrict access RDS records to only match the corresponding cognito user which the record is stroing data about? On top of that how can i add a new record when new cognito user is created. Any code that is required would be most useful in nodejs, thanks!! Help would be greatly appreciated!

I have successfully set up cognito user pool and seperatly set up RDS database which i can query, but i can't seem to find anywhere how i can link them

CodePudding user response:

There isn't really a way to link Cognito and RDS directly. The link is your application code. Your application should be checking the currently logged in user details it gets from Cognito, and then using that user info (like a userID or userName value) as a parameter in the SQL queries it issues to RDS.

CodePudding user response:

On top of that how can i add a new record when new cognito user is created.

When a new user was confirmed, you could create an RDS record with Lambda trigger, I guess.

Post confirmation Lambda trigger - Amazon Cognito

  • Related