Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are writes to Amazon S3 atomic (all-or-nothing)?

I have a large number of files that I am reading and writing to S3. I am just wondering if I need to code for the case where a file is "half written" e.g. the S3 PUT / Write only "half" worked.

Or are writes to S3 all-or-nothing?

I know there is a read-write eventual consistency issue which (I think) is largely a separate issue.

like image 200
kellyfj Avatar asked May 20 '14 15:05

kellyfj


People also ask

What is Amazon S3 written in?

Like most web applications, the Amazon AWS Management Console is written in the client-side languages Javascript, CSS, and HTML.

Does S3 support read-after-write consistency for all regions?

With this enhancement, Amazon S3 now supports read-after-write consistency in all regions for new objects added to Amazon S3. Read-after-write consistency allows you to retrieve objects immediately after creation in Amazon S3.

Is S3 rename Atomic?

As you note, S3 does not have an atomic rename operation, so your usual technique doesn't work as you desire. S3 has a nice "notification" feature that can be configured. In your case, you probably want to get notified when a file is created.

Is AWS S3 SQL or NoSQL?

AWS S3 is a key-value store, one of the major categories of NoSQL databases used for accumulating voluminous, mutating, unstructured, or semistructured data. Uploaded objects are referenced by a unique key, which can be any string. This high-level and generic storage structure affords users near-infinite flexibility.


2 Answers

See S3 PUT documentation:

Amazon S3 never adds partial objects; if you receive a success response, Amazon S3 added the entire object to the bucket.

like image 174
Mystic Avatar answered Oct 13 '22 00:10

Mystic


For all regions except US Standard (us-east-1) you get read-after-write-consistency. This means that if you get an HTTP 200 OK for your PUT, you can read the object right away.

If your request is dropped in the middle, you would not get and HTTP 200 and your object would not be written at all.

UPDATE: All regions now support read-after-write consistency (thanks @jeff-loughridge): https://aws.amazon.com/about-aws/whats-new/2015/08/amazon-s3-introduces-new-usability-enhancements/

like image 35
Julio Faerman Avatar answered Oct 13 '22 00:10

Julio Faerman