I have an Invoice table in dynamodb with hash-sort combo key. The hash is a uuid "tenantId" and the sort is a uuid named "id" for the invoice. However I have a field called "InvoiceNumber" which is the human readable sequential identifier for the invoices.
What is the best/optimal way to increment the InvoiceNumber when I create a new record while ensuring uniqueness and avoid race conditions?
Edit: Uniqueness would need to be enforced for each hash or tenant but not across the table.
InvoiceNumberunique within eachtenantIdor global? Also, does any of your items ever get deleted? - Andre.IDK