Every time you add a new item to the table, a new value
of id has to be set. And this has to be done with concurrency in mind.
SQL databases like PostgreSQL, Oracle, MySQL and others support
auto-increment features. When you add a new record to the table,
the value of the primary key is omitted and the server retrieves
the next one automatically. If a number of INSERT requests
arrive at the same time the server guarantees that the numbers won't be duplicated.

However, DynamoDB doesn't have this feature. Instead,
DynamoDB has Atomic Counters
and Conditional Updates,
which are very similar features. Still, they're not exactly the same.

In case of an atomic counter, you should create a supplementary
table and keep the latest value of id in it.

In case of conditional updates, you should
retry
a few times in case of collisions.

To make life easier in a few of my applications, I created a simple web
service—stateful.co.
It provides a simple atomic counter feature through its RESTful API.

First, you create a counter with a unique name. Then,
you set its initial value (it is zero by default). And, that's it.
Every time you need to obtain a new value for id column in
DynamoDB table, you make an HTTP request to stateful.co
asking to
increment your counter by one and return its next value.

stateful.co guarantees that values
returned will never duplicate each other—no matter how many
clients are using a counter or how fast they request increments simultaneously.