0

I have two items from the same table which need to be updated. Each item represents a user and I need to make sure a value is written to them both or is not written at all. I have looked through the internet and found a transaction library for DynamoDB (https://java.awsblog.com/post/Tx13H2W58QMAOA7/Performing-Conditional-Writes-Using-the-Amazon-DynamoDB-Transaction-Library), but when I try to implement this library it does not seem to exist in maven http://search.maven.org/#search%7Cga%7C1%7Caws. My guess is maybe this is no longer a supported library (Last update was almost a year ago)? Is there any methods to perform a transaction inside of dynamodb?

2
  • DynamoDB only supports transactions (conditional writes) at the individual item level natively. You could build your own method of locking individual records before modifying either but that is a bit complicated. Nov 12, 2015 at 17:47
  • @JaredHatfield Would you happen to know that status of the dynamodb transaction library? (java.awsblog.com/post/Tx13H2W58QMAOA7/…). Nov 12, 2015 at 18:52

1 Answer 1

0

I using this library in production project. This library never exist in Maven Central. So, you need to build jar in your local computer with mvn command.

  1. How Set Up dynamodb-transactions

    git clone https://github.com/awslabs/dynamodb-transactions

    cd dynamodb-transactions

    mvn clean package

And you will find amazon-dynamodb-transactions-[version].jar in dynamodb-transactions/target folder.

  1. Similar Transaction Function

In Dynamodb, multi item transaction is not support. It is possible single item transaction only.
By the way, I used dynamodb-transactions library, but it needs huge write capacity(7N+4). And it is not well maintained project.
Now we can use Dynamodb Stream.
I think best similar DBMS transaction(master-transaction data) approach in Dynamodb that master data with single item and transaction datas saving by Dynamodb Stream with Lambda function.
Dynamodb Stream 100% guarantee data. So, Just little carefully code Lambda function part with fault tolerant saving data, the above approach like "asynchronize transaction" working. (But If user call API and returning data need aggregate transaction datas, the above approach is not suit)

From view point of well maintained system and aws modern technology,I think it more better approach in Dynamodb.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.