Hands-On Mini Lab

DynamoDB TTL and Access Pattern Lab

A tiny on-demand table has negligible cost when deleted quickly. DynamoDB Free Tier may apply.

Goal

Reinforce Partition keys, On-demand capacity, TTL, Access patterns through a small, inspectable activity.

Concepts Reinforced

  • Partition keys
  • On-demand capacity
  • TTL
  • Access patterns

Prerequisites

  • AWS CLI configured
  • Permission to create DynamoDB tables

Estimated Cost

Exact Steps

  1. Create a small on-demand table with a partition key named pk.
  2. Enable TTL on an attribute named expiresAt.
  3. Put one item with a future Unix timestamp and one without TTL.
  4. Query or get the items by key and observe that TTL is not an immediate delete mechanism.
Runnable table creation
aws dynamodb create-table --table-name DJamesStudyTtl --attribute-definitions AttributeName=pk,AttributeType=S --key-schema AttributeName=pk,KeyType=HASH --billing-mode PAY_PER_REQUEST

Verification

  • describe-time-to-live shows ENABLED.
  • The table can retrieve the item by partition key.

Cleanup Steps

  • Delete the table.

Sources and Review Metadata

This independent training application is not affiliated with or endorsed by Amazon Web Services. AWS, Amazon Web Services, and AWS certification names are trademarks of Amazon.com, Inc. or its affiliates.