0

I have 3 clients. All of them want to insert items in the same database.

Whenever a client sends a request,

  1. I need to read the last entered record in ddb.
  2. Increase its id by 1.
  3. Push this new request in the ddb with the increased id.

What's the best aws based architecture to implement this?

What if there were 100 clients?

Mumbaikar007
  • 441
  • 1
  • 6
  • 16
  • Does this answer your question? [How to use auto increment for primary key id in dynamodb](https://stackoverflow.com/questions/37072341/how-to-use-auto-increment-for-primary-key-id-in-dynamodb) – Aman B Aug 31 '22 at 01:57

1 Answers1

0

What use is it to have an increasing Id as a partition key, assuming that's the use-case?

Unlike relational databases where this would be a good pattern, typically in a key-value store it's not as it leada.to difficulty reading the data back.

My suggestion would be to use a useful Id that is known to your application to allow you to read the items back efficiently. If those known values are not unique, then you can add a sort key which will become a primary key to define your uniqueness.

Leeroy Hannigan
  • 11,409
  • 3
  • 14
  • 31