title: Signature generated by getSignedUrl via aws-sdk for putObject is not matched?
body: <p>Using aws-sdk.js with NodeJs.</p>
  
  <p>Generated a signed URL for file upload (putObject) to a AWS bucket, along with file download (getObject) signed URL.</p>
  
  <p>File download URL is working, however upload URL is throwing error:</p>
  
  <p><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</code></p>
  
  <p><code>&lt;Error&gt;&lt;Code&gt;SignatureDoesNotMatch&lt;/Code&gt;&lt;Message&gt;The request signature we calculated does not match the signature you provided. Check your key and signing method.&lt;/Message&gt;&lt;AWSAccessKeyId&gt;AWSACCESSKEY&lt;/AWSAccessKeyId&gt;&lt;/Error&gt;</code></p>
  
  <p>JS to generate signed URL for <code>getObject</code> and <code>putObject</code>:</p>
  
  <pre><code>var AWS = require('aws-sdk');
  // AWS is configured in .aws and is correct 
  const s3 = new AWS.S3();
  
  var params = {
      Bucket: 'upload-bucket',
      Key: 'Account_Info.pdf',
      Expires: 60*60
  };
  
  // Upload signedUrl
  let putUrl = s3.getSignedUrl('putObject', params);
  console.log("Put: ", putUrl);
  
  let p = JSON.parse(JSON.stringify(params));
  p.Key= 'Account.pdf';
  // download signed Url
  let url = s3.getSignedUrl('getObject', p);
  </code></pre>
  
  <p>signed URL for download is working fine, need to know what might be wrong in put API.</p>
  
  <p>JS code for upload file:</p>
  
  <pre><code>let request = require('request');
  var fs = require("fs");
  
  let file = new Buffer(fs.readFileSync('Account_Info.pdf', 'base64'), 'base64');
  
  let url = putUrl; //'something/Account_Info.pdf';
  let method = 'PUT';
  let qs = {
    'AWSAccessKeyId': 'AWSACCESSKEY',
    'Expires':'1539258230',
    'Signature':'Qbuu9fP6rrmwWDAPQFf%2BE3JiGZo%3D'
  };
  
  let formData = {
    file: { value: file,
      options: { filename: 'Account_Info.pdf', contentType: 'pdf' } }
  };
  
  let ops = {
    url, method, qs, formData
  };
  
  request (ops, (err, res, body) =&gt; {
    console.log(err);
    console.log(body);
  });
  </code></pre>
  
  <p>Is error due to conversion of all special character to their utf-8 notation like all <strong>=</strong> become <strong>%2D</strong>, <strong>/</strong> become <strong>%2F</strong>, <strong>+</strong> become <strong>%2B</strong>. However tried converting them back to actual form didn't work and more over this doesn't seems to affect GET URL. Tried passing qs along URL no change in result.</p>
  
  <p>Wasted 3 days figuring out what might be going wrong here. Wish AWS error would been more clear, and AWS would had provided better documentation for file upload.</p>
  
  <p>Any help is needed.</p>