I've read the developer guide for expiring items using DynamoDB TTL, and was wondering if it's possible to use TTL as an alternative to deletes, instead of in addition to.
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/TTL.html
Since Amazon deletes the item for you (when convenient for them) without consuming any write units, would it be possible to have all of my deletes done like this? The idea would be to create items without a TTL, and then instead of deleting them just setting the TTL to the current time. I understand that I would have to add some logic to account for expired-but-not-deleted items, but this seems trivial compared to the savings.
Is this possible?
The idea would be to create items without a TTL, and then instead of deleting them just setting the TTL to the current time.
That doesn't make sense, you'd need to use a WCU to update the item, might as well just delete it.
Using TTL to delete the item for free makes sense when you can set the TTL when the item is created.
I suppose setting the TTL with an update might be useful if you have multiple GSIs. You'd only pay for the update to the table, the delete's would be free. Whereas if you delete the record in the table, you'd pay for the table and the GSIs.
Update June 2023
Thought I'd add to this answer that a TTL delete is only free on the origin table if you are using Global tables. The replicated delete you still pay for.