DynamoDB auto incremented ID & server time (iOS SDK)

Is there an option in DynammoDB to store auto incremented ID as primary key in tables? I also need to store the server time in tables as the "created at" fields (eg., user create at). But I don't find any way to get server time from DynamoDB or any other AWS services.

Can you guys help me with,

  1. Working with auto incremented IDs in DyanmoDB tables
  2. Storing server time in tables for "created at" like fields.

Thanks.

Answers 1

  • Actually, there are very few features in DynamoDB and this is precisely its main strength. Simplicity.

    • There are no way automatically generate IDs nor UUIDs.
    • There are no way to auto-generate a date

    For the "date" problem, it should be easy to generate it on the client side. May I suggest you to use the ISO 8601 date format ? It's both programmer and computer friendly.

    Most of the time, there is a better way than using automatic IDs for Items. This is often a bad habit taken from the SQL or MongoDB world. For instance, an e-mail or a login will make a perfect ID for a user. But I know there are specific cases where IDs might be useful.

    In these cases, you need to build your own system. In this SO answer and this article from DynamoDB-Mapper documentation, I explain how to do it. I hope it helps


Related Articles