title: How to properly call AWS.CloudFront.Signer in Node.js?
body: <p>I tried to get a signed URL in a node.js app, my code is shown below.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var AWS = require('aws-sdk');
  const fs = require("fs");
  var options = { keypairId: 'keypairId', privateKeyPath: 'privateKeyPath', expireTime: (new Date().getTime() + 3000) };
  var url = 'cloudfrontURL' + objectpath;
  const key = fs.readFileSync('privateKeyPath').toString("ascii");
  const id = 'keypairId';
  const signer = new AWS.CloudFront.Signer(id, key);
  const params = {
   url: url,
   expires: 1538999532,
  };
  signer.getSignedUrl(params, function (err, data) {
   if (err) { console.log(err) }
   console.log(data);
  });</code></pre>
  </div>
  </div>
  </p>
  
  <p>but I am getting an error, which is shown below</p>
  
  <p>AWS.CloudFront.Signer is not a constructor</p>
  
  <p>What is the reason for this?</p>