title: "The specified key does not exist" S3 error for really existing object in the bucket
body: <p>In our application we have to download on backend by AWS Java SDK uploaded user's image for some processing operations(resize,crop,etc.) Sometimes, we get the following error:</p>
  
  <blockquote>
    <p>com.amazonaws.services.s3.model.AmazonS3Exception: The specified key does not exist. (Service: Amazon S3; Status Code: 404; Error Code: NoSuchKey;</p>
  </blockquote>
  
  <p>but this key and the object which was saved by this path exist. I know that in AWS developer guide this behavior is expected:</p>
  
  <blockquote>
    <p>However, information about the changes might not immediately replicate across Amazon S3 and you might observe the following behaviors: A process writes a new object to Amazon S3 and immediately attempts to read it. Until the change is fully propagated, Amazon S3 might report "key does not exist."</p>
  </blockquote>
  
  <p>but how can I process this error in my code? I tried to wait some milliseconds,I tried to retry download this object - and all my attempts are failed.</p>
  
  <pre><code>         try
              {
                  Download download = s3TransferManager
                          .download(new GetObjectRequest(bucketName, key), new File(tempUrl));
                  download.waitForCompletion();
              }
              catch (AmazonS3Exception amazonS3Exception)
              {
                  Thread.sleep(1000);
                  //retry 3 time.... }
  </code></pre>
  
  <p>I would be glad to hear any advice how to download existing file in that case. Thank you!</p>