Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there optimistic locking in AWS S3?

I have an excel file within s3. Since different programs read and write it, I need to guarantee that each of them is writing to the version they read.

like image 638
XY6 Avatar asked Jan 05 '23 09:01

XY6


1 Answers

S3 only guarantees read after write consistency for newly created objects, and eventual consistency for overwriting and deleting objects. If your excel file is small enough (less than 400kb), you could store it in a binary attribute of a DynamoDB item and use conditional updates on a version attribute to ensure read after write consistency for the file. Otherwise, of the file is bigger than 400kb, you could upload each version of the file to a new key in s3 and then track the s3 URL to latest version of the file in a versioned DynamoDB item.

like image 62
Alexander Patrikalakis Avatar answered Jan 06 '23 23:01

Alexander Patrikalakis