Skip to content

DynamoDB TTL Exam Tips

DynamoDB Time To Leave (TTL)

  • Time to leave attribute defines an expiry time for your data
  • Expired items marked for deletion
  • Great for removing irrelevant or old data
    • Session data
    • Event logs
    • Temporary data
  • Reduce4s cost by automatically removing data which is no longer relevant

Session Data Table

userId sessionId creationTime expirationTime(TTL) sessionData
12341234 23458123458 1544016418 1544023618 {JSON}
82384283 82384238482 1544013196 1544020396 {JSON}
34856723 72374823932 1544030827 1544038027 {JSON}
72374271 82138428348 1544002027 1544009227 {JSON}
  • TTL expressed as EPOCH time Epoch Converter
  • Expiration is set for 2 hours after the session began
  • When the current time is greater than the TTL, the item will be expired and marked for deletion
  • You can filter out expired items from your queries and scans
  • Once marked for deletion, items are deleted with 24 hours