- Newest
- Most votes
- Most comments
Your final comment sums up the request:
considering DynamoDB's distributed nature
As a distributed system, it's considered an anti pattern to have an auto-incrementing partition key (assuming that's the ask here). Instead you should think on choosing a partition key that can fulfill your read requirements without having to do full table Scans.
If guaranteed uniqueness is what you require, consider using a UUID or something similar along with a conditional update.
If the requirement is for non-key attributes, consider options outlined in this blog
I suggest checking out the following blog, which talks through several options for implementing resource counters and the considerations of each. https://aws.amazon.com/blogs/database/implement-resource-counters-with-amazon-dynamodb/
DynamoDB does not support auto incrementing sequences. Still, you may find atomic counters useful in your case. See: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html#WorkingWithItems.AtomicCounters and https://aws.amazon.com/blogs/developer/using-atomic-counters-in-the-enhanced-dynamodb-aws-sdk-for-java-2-x-client/.
In my search, I also fount this possible solution: https://b itesizedserverless.com/b ite/reliable-auto-increments-in-dynamodb/
Relevant content
- asked a year ago
- asked 2 years ago
- asked a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago