Which solution will meet this requirement?
Create a new attribute that has the Number data type. Add a local secondary index (LSI) for this attribute, and enable TTL with an expiration of 48 hours. In the application code, set the value of this attribute to the current timestamp for each new item that is being inserted.
Create a new attribute that has the String data type. Add a local secondary index (LSI) for this attribute, and enable TTL with an expiration of 48 hours. In the application code, set the value of this attribute to the current timestamp for each new item that is being inserted.
Create a new attribute that has the Number data type. Enable TTL on the DynamoDB table for this attribute. In the application code, set the value of this attribute to the current timestamp plus 48 hours for each new item that is being inserted.
Create a new attribute that has the String data type. Enable TTL on the DynamoDB table for this attribute. In the application code, set the value of this attribute to the current timestamp plus 48 hours for each new item that is being inserted.
Explanations:
TTL (Time to Live) requires the expiration timestamp to be in the Number data type (epoch time). LSIs are not relevant for TTL functionality, as TTL operates on the main table’s attribute.
TTL requires the expiration timestamp to be in the Number data type, not String. LSIs are also not necessary for TTL.
TTL must be based on a Number attribute representing epoch time (seconds). Setting the timestamp to the current time plus 48 hours is correct, ensuring that items are removed after 48 hours.
TTL requires a Number attribute, not a String. Setting the timestamp to the current time plus 48 hours is correct, but the attribute type must be Number.