hakan
hakan

Reputation: 43

How to get the time information of a record in a Dynamodb Stream

I am trying to use Dynamodb streams log the changes in a table for analytics purposes. I am using the Java SDK and everything is working, I can see all the changes made to the table and get old and new images, however I could not find any timestamp for the change that happened. Since I want to keep a log of these changes, I need the exact time that it happened but I could not find any time information in the record.

Where can I see the datetime information about when the change was made?

Upvotes: 3

Views: 5269

Answers (2)

Tom
Tom

Reputation: 17854

This already has an accepted answer (that the info is not present), but perhaps something has changed because I'm seeing a timestamp in the stream.

For example, when I change a DynamoDB item, my Lambda (which uses nodejs 4.3 platform, but I don't think that is relevant) receives the usual array of records, where record.dynamodb for the 'modify' has

{
    "ApproximateCreationDateTime": 1468175100,
    "Keys": { "id": { "S": "stringid" } },
    "NewImage": {
    ...

The 'ApproximateCreationDateTime' is not in my Dynamo item - it appears to be a unix timestamp (s, not ms) inserted into the stream by AWS. I haven't really investigated it further by perhaps this would satisfy the original request.

Upvotes: 2

Mike76
Mike76

Reputation: 984

Streams doesn't provide a timestamp in the records ( see http://docs.aws.amazon.com/dynamodbstreams/latest/APIReference/API_GetRecords.html for data available )

Perhaps you could set a "lastModified" attribute when you update an item in the table. This would then be available in the "NewImage" data.

Upvotes: -1

Related Questions