mercredi 24 juin 2015

is invalidation needed or am I doing something wrong?

I am uploading a file to s3 through the Javascript SDK with the following code:

<textarea id="data"></textarea>
<button id="upload-button">Upload to S3</button>
<div id="results"></div>

<script type="text/javascript">
  var bucket = new AWS.S3({params: {Bucket: 'myBucket'}});

  var textarea = document.getElementById('data');
  var button = document.getElementById('upload-button');
  var results = document.getElementById('results');
  button.addEventListener('click', function() {
    results.innerHTML = '';

    var params = {Key: 'data.txt', Body: textarea.value};
    bucket.upload(params, function (err, data) {
      results.innerHTML = err ? 'ERROR!' : 'SAVED.';
    });
  }, false);
</script>

When I upload the file and access it through the cloudfront CDN URL, the file seems instantly updated without the need of invalidation.

How come? I thought when you upload a file to s3 you have to invalidate the CDN for it to get updated after 10-15 minutes.




Aucun commentaire:

Enregistrer un commentaire