I am uploading a file from Android device to S3 bucket via this code
TransferUtility trasnferManager = new TransferUtility(s3, context);
trasnferManager.upload(..,..,..);
After that I have a lambda trigger attached to S3:ObjectCreated event.
When the lambda is executed I am trying to get the file via S3.getObject() function. Unfortunately sometimes I am receiving "NoSuchKey: The specified key does not exist:" error. After that lambda retries couple of times and successfully gets the file and proceeds with its execution.
In my opinion lambda function is executed before the file in S3 is avaivable? But that should not happen by design. The trigger should be triggered after the file upload on S3 is complete.
According to announcement on Aug 4, 2015:
Amazon S3 buckets in all Regions provide read-after-write consistency for PUTS of new objects and eventual consistency for overwrite PUTS and DELETES.
Read-after-write consistency allows you to retrieve objects immediately after creation in Amazon S3.
But prior to this:
All regions except US Standard (renamed to US East (N. Virginia)) supported read-after-write consistency for new objects uploaded to Amazon S3.
My bucket is in US East (N. Virginia) region and it is created before Aug 4, 2015. I don't know that this could be the issue...
EDIT: 20.10.2016
According to documentaion - EVENTUALLY CONSISTENT READ operation may return NO RESULT even if two or more WRITE operations had been completed before it.
In this example, both W1 (write 1) and W2 (write 2) complete before the start of R1 (read 1) and R2 (read 2). For a consistent read, R1 and R2 both return color = ruby. For an eventually consistent read, R1 and R2 might return color = red, color = ruby, or no results, depending on the amount of time that has elapsed.