dynamodb: How to add auto increment numbers to key field while adding record to table
<p>I would like to add auto numbers to key field of table in dynamodb via console,
e.g. 0,1,2,...</p>

<p>I have <code>contact_us</code> table that I would like to have column with auto id increment.
Please help me with this.</p>

<pre><code>import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAutoGeneratedKey;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey;
import com.amazonaws.services.dynamodbv2.model.AttributeValue;

public class ContactUs extends HttpServlet {

    String con_id;

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        try{
           // ...
           // ...

           Map&lt;String, AttributeValue&gt; item = newRecord();
           //System.out.println(item);

           // ...

           dbObject.addRecord(item, "contact_us");

        }catch (Exception e) {
           // TODO: handle exception
           e.printStackTrace();
        }
    }

    private Map&lt;String, AttributeValue&gt; newRecord() {
        Map&lt;String, AttributeValue&gt; item = new HashMap&lt;String, AttributeValue&gt;();
        con_id = getConID();
        dateTimeTimestamp = new SysDateTimeTimestamp();
        //Need to add con_id which will be auto id.
        item.put("con_id", new AttributeValue(con_id));
        // ...
        // ...

        return item;
    }

    @DynamoDBHashKey(attributeName = "con_id")
    @DynamoDBAutoGeneratedKey
    public String getConID(){
       return con_id;
    }

    public void setConID(String con_id){
       this.con_id = con_id;
    }
}
</code></pre>

<p>Here I am receiving con_id value blank.</p>