已过期未删除的DynamoDB条目更新TTL属性后的处理规则咨询
Quick Answer
Yes, DynamoDB will recognize the update and delay deletion until the new future TTL timestamp you set. It will NOT follow the original expired TTL time.
Deep Dive & Document Clarification
Great question—this is a common point of confusion with DynamoDB's TTL behavior, especially since the cleanup process isn't instantaneous. Let's break down the document wording you referenced to make it concrete:
已过期但尚未被删除的条目仍可被更新,且修改或移除过期属性的成功更新将被生效
Here's what this means in practical terms:
- Even when an item has passed its original TTL timestamp (so it's marked as expired) but hasn't been cleaned up by DynamoDB's periodic background scanner, you still have full access to update the item—no restrictions apply here.
- When you modify the TTL attribute to a future timestamp (or remove the TTL attribute entirely), this update takes immediate effect:
- If you set a new future TTL, DynamoDB will discard the original expired status, re-evaluate the item against the new timestamp, and only schedule it for deletion once that new time arrives.
- If you remove the TTL attribute entirely, the item will never be automatically deleted via TTL again (unless you re-add the attribute later with a valid timestamp).
The critical detail here is that DynamoDB's TTL scanner checks the current value of the TTL attribute every time it processes an item. So even if the item was previously flagged for deletion, the latest TTL value (whether future or removed) is what dictates its fate moving forward.
内容的提问来源于stack exchange,提问作者SangminKim

