Support Documents
×
No data found.


Understanding DynamoDB TTL

Lab Details

  1. This lab walks you through to create a table in Amazon DynamoDB and enable the TTL (Time To Live) feature. Next we will insert two values to the table, one with expiration time and the other with no expiration time and see whether the items in the table get deleted after the TTL gets expired.

  2. You will practice the lab using DynamoDB Table.

  3. Duration: 45 minutes

  4. AWS Region: US East (N. Virginia) us-east-1

Introduction

What is AWS DynamoDB?

Definition

  • DynamoDB is a fast and flexible NoSQL database designed for applications that need consistent, single-digit millisecond latency at any scale.it is a fully managed database and it supports both document and key value data models.

  • It has a very flexible data model. This means that you don't need to define your database schema upfront. It also has reliable performance.

  • DynamoDB is a good fit for mobile gaming, ad-tech, IoT and many other applications.

DynamoDB Tables

DynamoDB tables consist of :

  • Items (Think of a row of data in a table).

  • Attributes (Think of a column of data in a table).

  • Supports key-value and document data structures.

  • Key= the name of the data.  Value= the data itself.

  • Document can be written in JSON, HTML or XML.

DynamoDB TTL

  • Amazon DynamoDB Time to Live (TTL) allows you to define a per-item timestamp to determine when an item is no longer needed.

  • DynamoDB deletes the item from your table without consuming any write throughput.

  • TTL is provided at no extra cost.

  • TTL is useful if you store items that lose relevance after a specific time.

DynamoDB- Primary Keys

  • DynamoDB stores and retrieves data based on a Primary key

  • DynamoDB also uses Partition keys to determine the physical location of data being stored.

  • If you are using a partition key as your Primary key, then no items will have the same Partition key.

  • Composite Keys (Partition Key + Sort Key) can be used in combination.

  • Two items may have the same partition key, but must have a different sort key.

  • All items with the same partition key are stored together and then sorted according to the sort key value.

  • DynamoDB allows you to store multiple items with the same partition keys.

Architecture Diagram

Case Study

  • Before preceding this lab, please note that the DynamoDB TTL may take upto 48 Hours to delete the expired items from the table.

Tasks Details

  1. Log into AWS Management Console.

  2. Create a DynamoDB table.

  3. Configure DynamoDB TTL.

  4. Insert items into the table.

  5. Test the lab configuration.

  6. Validation of the lab.

  7. Deleting AWS resources