DEV Community

Kirk Kirkconnell for AWS

Posted on • Edited on

3

Identify items in an Amazon DynamoDB table that haven't been accessed and move them to Amazon S3.

Question: How to identify items in an Amazon DynamoDB table that haven't been accessed for a time and move them to Amazon S3.

Answer: There is no built in way for DynamoDB to know which items have or have not been accessed lately. More than likely, your best option is to do the following:

Prerequisites:

  1. Have TTL enabled on the table and a TTL attribute on every item in the table. If not, you will have to do that first.
  2. If you do not already update TTL attributes on items when they are accessed, you must change your application code to update the TTL attribute on an item when you access that item. Otherwise none of this will work.

With that in place, enable DynamoDB Streams. Then create a Lambda function that watches DDB Streams specifically for TTL Deletes which reads from the table's stream, then write the expired items to S3. Here is an older blog post which should still be mostly relevant for this purpose.

API Trace View

Struggling with slow API calls?

Dan Mindru walks through how he used Sentry's new Trace View feature to shave off 22.3 seconds from an API call.

Get a practical walkthrough of how to identify bottlenecks, split tasks into multiple parallel tasks, identify slow AI model calls, and more.

Read more →

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more