- Newest
- Most votes
- Most comments
Based on your question, I understand that you have created a proof of concept (POC) in which users are authenticated using AWS Cognito services and their data is stored in DynamoDB as assets. Now, you want to modify your POC to store assets specific to each user so that when a user logs in, they can only view and manipulate the assets that they have created.
You will need to change your current architecture to accomplish this. Each asset record should contain a user identity so that you may filter the assets according to the user who created them.
To modify your POC, you can follow these steps: Add a property to the Asset object that will contain the user identification in the data model. This field may be the Cognito user ID of the user that generated the asset.
When generating an asset, the CRUD operations should be changed to include the user ID, and when fetching assets, the entries should be filtered based on the user ID. This may be done by utilising AWS AppSync VTL (Velocity Template Language).
Modify the authorization rules in your AWS AppSync API to ensure that each user can only access their own assets. You can use the $ctx.identity.userId context variable to accomplish this.
By making these changes, your AWS AppSync API can retrieve and store assets based on the user who created them, allowing each user to view and manipulate only their own resources.
Relevant content
- asked 9 months ago
- asked 2 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated a year ago