When enabling DynamoDB streams on a table, you can choose to record one of the following.
Since the requirement for this scenario is to retain only the current view of orders on the Orders table, you will set the DynamoDB stream for the table to only hold the old image of items when updates are performed. The new image does not need to be written to the stream since it is not required.
Enable DynamoDB streams on the Orders table by running the AWS CLI command below.
aws dynamodb update-table \
--table-name Orders \
--stream-specification \
StreamEnabled=true,StreamViewType=OLD_IMAGE \
--query "TableDescription.LatestStreamArn"
Confirm that DynamoDB streams has been enabled using the AWS CLI commands below.
aws dynamodb describe-table \
--table-name Orders \
--query "Table.StreamSpecification.StreamEnabled"
The output should return a boolean as shown below.
true