Modeling : Transaction Archival (v13)
ACME Requirement
- Archive the Transactions that are older than 7 years
- Delete the customer offers
- Archive the old transactions to an S3 bucket
Solution
- Define an attribute for TTL in the table
- When the Transaction entity is created, set the TTL attribute = Txn date + 7 years
- Leverage the stream event for archival of transactions
- A Lambda function reads the stream records
- The system expired transaction items get written to a S3 bucket
Potential risk
Can’t loose any transaction during archival
- You may backup the table on periodic basis
- You may continuously write the events to a Data Lake for offline analytics & backup!!
Architecture layout
- Setup Lambda to read the stream
References
Documentation
UpdateTimeToLive API
Human time to Epoch Converted