You have been hired as a Database administrator by a start-up.
Your first task is to modify a DynamoDB table so that its data expires automatically after a certain period of time.
Upon looking at the documentation, you figured out that DynamoDB supports a concept of TTL using which you can achieve the same.
What are the steps to use the feature?
Click on the arrows to vote for the correct answer
A. B. C. D.Correct Answer: B.
While enabling TTL, you can provide any name of your choice to use as a key attribute name to be used for storing timestamp value.
Option A is incorrect: dataExpiry is not a reserved keyword for TTL.
Option C is incorrect: expiryTTL is also not a reserved keyword for TTL.
Option D is incorrect: TTL is not enabled by default, and it does not even pick the TTL key attribute automatically.
Reference:
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/TTL.htmlAs a Database Administrator, you can use the Time to Live (TTL) feature in DynamoDB to remove data that is no longer needed. When you enable TTL for a table, you can set a timestamp for each item in the table. When the timestamp for an item expires, the item is automatically deleted from the table.
To enable TTL for a table in DynamoDB, you need to perform the following steps:
Enable TTL: You need to enable TTL for the DynamoDB table. You can do this by selecting the table in the DynamoDB console, clicking on the 'Manage TTL' button and then setting the TTL attribute.
Choose Key Attribute: You need to choose a key attribute in the table that will store the expiry timestamp. The attribute that you choose should be of the Number data type and should be in Unix epoch time format.
Set Expiry Timestamp: Once you have chosen the key attribute, you need to set the expiry timestamp for each item in the table. You can do this by setting the value of the key attribute to the Unix epoch time when the item should expire.
Wait for TTL to take effect: Once you have enabled TTL and set the expiry timestamp for the key attribute, you need to wait for TTL to take effect. DynamoDB checks the TTL attribute of each item in the table approximately once every hour. When DynamoDB finds an expired item, it deletes the item from the table.
Option D is incorrect because TTL is not enabled by default in DynamoDB. You need to enable it manually for each table. Option A and Option C are also incorrect because 'dataExpiry' and 'expiryTTL' are not valid keywords to store the expiry timestamp. You can use any attribute name of your choice to store the expiry timestamp, as long as it is of the Number data type and in Unix epoch time format. Therefore, the correct answer is Option B - Enable TTL and use any name of your choice as a key attribute to store the expiry timestamp.