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?

asked 7 months ago262 views
2 Answers
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
EXPERT
answered 7 months ago
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
EXPERT
answered 7 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions