How automatic cleanup works with TTL and S3
mainThe DynamoDBSaver provides a unified cleanup mechanism using DynamoDB TTL and S3 Lifecycle policies.
- DynamoDB TTL: When you set
ttl_seconds, each checkpoint is tagged with an expiration time. DynamoDB deletes expired items automatically without consuming write throughput (though deletion may take a few days). - S3 Lifecycle: If S3 offloading is enabled, the library automatically configures S3 lifecycle rules based on your
ttl_seconds. It converts seconds to days to match S3's day-level precision.
Setting ttl_seconds synchronizes cleanup across both layers, so you do not need to manually configure S3 lifecycle policies.