Dynamodb handling multiple clients

0

So consider the following scenario. I currently am using a Postgres db for storing data for multiple clients one of which is a discord bot, but was thinking of trying out dynamodb as these crud operations all revolve around key value pairs. Currently there is a primary key for each user associated with the server as well as an optional discord id for discord clients. How would one structure primary keys for a dynamodb table to support crud methods from multiple clients. Should I just create a global secondary index for discord id for discord users so that I can always query for it if the client is using discord?

已提問 7 個月前檢視次數 278 次
2 個答案
1

Hi,

All possible options with multi-tenancy in DynamoDB are extremely well-detailled in this whitepaper: https://docs.aws.amazon.com/pdfs/whitepapers/latest/multi-tenant-saas-storage-strategies/multi-tenant-saas-storage-strategies.pdf#multitenancy-on-dynamodb

You should probably read it in full details to determine which proposed architecture best fits your needs.

Best,

Didier

profile pictureAWS
專家
已回答 7 個月前
0

A bit more detail about your schema is required to give an answer with the appropriate information. However, something to consider:

If the client is doing a PutItem call then that call replaces the item in the database. Multiple clients doing that will overwrite each others changes and that is probably undesirable.

One solution is to use UpdateItem and update specific attributes. There is still a risk where clients can overwrite each other's changes but that might not be an issue - depending on your schema.

An alternative is to have each client update different items. That may work for you - but it depends on your schema.

There are probably other ways to design this as well but it's not possible to say given the information available.

profile pictureAWS
專家
已回答 7 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南