title: S3 upload triggers DynamoDB Write, but GET call to DynamoDB needs to be delayed
body: <p>My apologies in advance for not coming up with a more succinct title.</p>
  <p>After successfully uploading a file to S3, it triggers a Lambda function to write data associated with the file such as the S3 key and file size to DynamoDB.</p>
  <p>The Client (React.js) then makes an asyc call <code>getAllFiles</code> to DynamoDB, but the result is missing the latest Write triggered by the S3 upload. Why? Probably because the DynamoDB table has not been written yet. If I <code>setTimout</code> for 2 seconds before making the <code>getAllFiles</code> call, then the latest Write is returned.</p>
  <pre><code>await s3Upload(newFile)
  const res = await getAllFiles()
  console.log(res) //missing newFile
  </code></pre>
  <p>But if I do this:</p>
  <pre><code>await s3Upload(newFile)
  setTimeout(async () =&gt; {
  const res = await getAllFiles()
    console.log(res) //newFile returned
  }, 2000) 
  </code></pre>
  <p><code>setTimeout</code> is not the best solution. I'm wondering if there is an overall better approach. Maybe DynamoDB Streams can notify the Client when the Write is completed, but I have not been able to find anything on that.</p>
  <p>I guess I can give up the S3 trigger and just make a Write call from React to DynamoDB, but that has its own downsides. The trigger seems like a very appropriate approach and I would like to keep it, even if it means sticking with setTimeout. If nothing else, it saves me an HTTP call.</p>
  <p>Thanks</p>