title: Creating an AWS SQS queue
body: <p>I am trying to create an SQS queue on AWS from an EC2 instance using node.js.
  From the same instance, I can access S3 and list the buckets, etc. using node.js. The instance has an IAM role granting full access to S3 and SQS.</p>
  
  <p>Executing the below code however fails and I cannot figure out why. Even more interesting is that from my PC the code actually works.</p>
  
  <pre><code>var AWS = require('aws-sdk');
  AWS.config.update({region:'eu-central-1'});
  //console.log("awsv "+AWS.VERSION); --&gt; 2.3.5
  var sqs = new AWS.SQS();
   var params = {
    QueueName: "MyQueue1"
   };
   sqs.createQueue(params, function(err, data) {
     if (err) console.log(err, err.stack); // an error occurred
     else {
          if(data)
                  console.log(data);           // successful response
          else
                  console.log("Other unknown error");
     }
   });
  </code></pre>
  
  <p>Error message:</p>
  
  <pre><code>/home/ubuntu/aws-nodejs-sample/node_modules/aws-sdk/lib/http/node.js:121
        callback();
        ^
  TypeError: undefined is not a function
      at Writable.writer._write (/home/ubuntu/aws-nodejs-sample/node_modules/aws-sdk/lib/http/node.js:121:7)
      at Writable.write (_stream_writable.js:176:8)
      at write (_stream_readable.js:481:24)
      at Array.forEach (native)
      at flow (_stream_readable.js:493:19)
      at _stream_readable.js:458:7
      at process._tickCallback (node.js:427:13)
      at process._makeCallback (node.js:345:15)
  </code></pre>
  
  <p>It turns out, that a quick test with a script calling the CLI functions actually works:</p>
  
  <pre><code>var AWS = require('aws-sdk');
  AWS.config.region = 'eu-central-1';
  
  var qUrl="https://sqs.eu-central-1.amazonaws.com/......./awsquerytest";
  
  var queue = new AWS.SQS({params: {QueueUrl: qUrl}}); // using url to queue
  var receipthandle;
  var fs = require('fs');
  
  var child = require('child_process').exec('aws sqs receive-message --queue-url https://sqs.eu-central-1.amazonaws.com/....../awsquerytest');
  child.stdout.on('data', function(data) {
     var x= data.toString();
     console.log(data.toString());
     fs.writeFile("/home/ubuntu/aws-nodejs-sample/output",x,function(err){
  if(err){
  return console.log(err);
  }
  console.log("oldu");
  });
  });
  
  child.stderr.on("data", function (data) {
      console.log(data.toString());
  });
  </code></pre>
  
  <p>How can this be explained?</p>