title: Using NodeJS and request module and aws-sdk to move images from Parse to S3/CloudFront
body: <p>Okay.  NodeJS using the request module. Downloading a resource in Parse (which is in S3) and I want upload to my S3 bucket (behind a CloudFront endpoint) using the aws-sdk node module.  Here is my code:</p>
  
  <pre><code>var AWS = require('aws-sdk');
  var request = require('request');
  
  AWS.config.loadFromPath('./aws-config.json');
  var s3 = new AWS.S3();
  
  var url = "http://files.parse.com/[the rest of the url]";
  
  request(url, function (error, response, body) {
      console.log(response);
      if (!error &amp;&amp; response.statusCode == 200) {
          s3.putObject({
              "Body": body,
              "Key": "thumbnail2.jpg",
              "Bucket": "[my-bucket]"
          }, function (error, data) {
              console.log(error || data);
          });
      }
  });
  </code></pre>
  
  <p>If I open the parse url I see the image.  If I open the url that is in my bucket, I get a broken image.</p>