Which strategy meets these requirements with the MOST operational efficiency?
Create an AWS Step Functions state machine with a DynamoDB DeleteItem operation that uses the ConditionExpression parameter to delete items older than a week. Create an Amazon EventBridge (Amazon CloudWatch Events) scheduled rule that runs the Step Functions state machine on a weekly basis.
Create an AWS Lambda function to delete items older than a week from the DynamoDB table. Create an Amazon EventBridge (Amazon CloudWatch Events) scheduled rule that triggers the Lambda function on a weekly basis.
Enable Amazon DynamoDB Streams on the table. Use a stream to invoke an AWS Lambda function to delete items older than a week from the DynamoDB table
Enable TTL on the DynamoDB table and set a Number data type as the TTL attribute. DynamoDB will automatically delete items that have a TTL that is less than the current time.
Explanations:
AWS Step Functions and EventBridge provide a complex solution that requires additional management, such as manually handling the deletion logic with a ConditionExpression, which adds unnecessary operational overhead.
Using an AWS Lambda function with EventBridge scheduled rules requires custom code to handle deletions and has operational overhead, which is less efficient compared to native DynamoDB features like TTL.
DynamoDB Streams are useful for capturing changes to data, but they are not intended for periodic purging of old items. Using streams in this case is unnecessarily complicated and requires a Lambda function for deletion, adding operational overhead.
Enabling TTL (Time to Live) on the DynamoDB table is the most efficient solution. DynamoDB automatically deletes items with expired TTL values without requiring custom code or additional infrastructure, reducing operational complexity.