Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deleting Data from DynamoDb Table automatically

Is there any kind of life retention period concept in DynamoDB.

I mean is there any way such that data inside a table will be deleted after some time like we can set some retention period in S3.

Thanks,

like image 208
Geek_To_Learn Avatar asked Jun 18 '15 06:06

Geek_To_Learn


People also ask

Which feature in DynamoDB allows you to automatically delete expired items from the table?

TTL typically deletes expired items within 48 hours of expiration.

How do I delete data from DynamoDB table?

With the DynamoDB API, you use the DeleteItem action to delete data from a table, one item at a time. You must specify the item's primary key values. In addition to DeleteItem , Amazon DynamoDB supports a BatchWriteItem action for deleting multiple items at the same time.

Does DynamoDB have auto scaling?

If you use the AWS Management Console to create a table or a global secondary index, DynamoDB auto scaling is enabled by default. You can modify your auto scaling settings at any time. For more information, see Using the AWS Management Console with DynamoDB auto scaling.

How do I enable auto scaling in DynamoDB?

Choose the table that you want to work with and select the Additional settings tab. In the Read/write capacity section, select Edit. In the Capacity mode section, select Provisioned. In the Table capacity section, set Auto scaling to On for Read capacity, Write capacity, or both.


2 Answers

DynamoDB has introduced a Time to Live (TTL) feature. You can create a numeric field and set the value to "time in seconds" (since epoch) when you want the record to be deleted.

DynamoDB will automatically delete the record at the specified time. Of course, TTL has to be configured on a per table basis.

You can fnd more details at: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/time-to-live-ttl-how-to.html

like image 174
Ashutosh Avatar answered Sep 20 '22 15:09

Ashutosh


No, there is no "retention" setting available in DynamoDB.

You could run a daily/monthly query that uses a date field to filter results, and use that output to determine which Items to delete. This would need to be implemented in your own programming code.

Some users choose to use separate tables to provide ageing. For example, create a separate table for each month. Then, delete old tables once they pass a certain age. However, your software would have to know how to handle multiple tables of data.

Examples:

  • Reference to monthly rotation of tables
  • Understand Access Patterns for Time Series Data
like image 42
John Rotenstein Avatar answered Sep 18 '22 15:09

John Rotenstein