Imagine you have an e-commerce website where customers place orders for different items. The website relies on Amazon DynamoDB and it requires logging of all events from when an order is placed until the item is delivered.
Website Requirements:
ACTIVE
, PLACED
, COMPLETE
or CANCELLED
.status
attribute and contains a list of one or more items.In JSON format, an item on the orders table has the following attributes.
{
"id": "string",
"status": "string",
"customer": {
"id": "string",
"address": "string",
"name": "string",
"phone": "string"
},
"orderDate": "YYYY-MM-DD hh:mm:ss",
"shipDate": "YYYY-MM-DD hh:mm:ss",
"items": [
{
"id": "string",
"name": "string",
"price": "string",
"quantity": "string",
"status": "string"
}
]
}
You will implement a solution to meet this requirement by using two DynamoDB tables - Orders and OrdersHistory; and a streaming solution to copy item level changes from the Orders table to OrdersHistory table.