I'm new to DynamoDB and I'm looking for a way to insert a record with a guaranteed unique primary key. Unless there's an identity seed I'll need to know that in order to insert a new record. I have a table with an int as primary key (perhaps I should have used a GUID). The only suggestion I have seen is to use the item_count() method, but this is flawed in many ways, not least because the documentation states that it updates approx every 6 hours. What's the best practice here? I can't believe the guys at DynamoDB have neglected to allow us to give us a decent method for doing this essential task?
DynamoDB is a key-value store. You provide the key. If you don’t care about the key details and just want a unique id, generate a GUID on the client side (every language has libraries for this) and use that. An incrementing number doesn’t scale.
Knowing the key at the client side is an important part of the retrieval process so most people don’t want a true random GUID. Most people use like an asset ID or whatever identifier for the thing whose data is being tracked.