AWS DynamoDB - a way to get when an item was last updated?

Viewed 4043

Is there a way to check when a dynamoDB item was last updated without adding a separate attribute for this? (For example, are there any built-in attributes or metadata that could provide this information?)

4 Answers

No. This is not a built-in feature of the DynamoDB API.

You have to implement yourself by adding a column to each item for each UpdatedTime with the current time.

For example, are there any built-in attributes or metadata that could provide this information? No

There are multiple approaches to implement this using DynamoDB.

  • Use either sort key, GSI or LSI with time stamp attribute, to query last updated item.
  • When adding an item to the table, keep track of last updated time at your Backend.
  • Using DynamoDB streams, create a Lambda function which executives, when an item is added to track last updated time.

Note: If you are going with last two approaches, you can still use a seperate DynamoDB table to store Metadata such as last updated attribute.

I don't think there is an out of the box solution for that but you can use DynamoDB streams with basic Lambda function to keep track of which items are updated, then you can store this information somewhere else like S3(through Kinesis Firehose) or you can update the same table.

Related