title: How to configure AWS S3 SDK for Node.JS to be used with localhost?
body: <p>I'm trying to use <a href="https://github.com/jubos/fake-s3" rel="nofollow">fakes3</a> as an endpoint for some simple S3 code I've written. I can't get beyond the connection stage though.</p>
  
  <p>The current error is: <code>NetworkingError: getaddrinfo ENOTFOUND</code>.</p>
  
  <p>I've got configuration setup:</p>
  
  <pre><code>"aws": {                                
      "accessKeyId": "123",               
      "secretAccessKey": "abc",           
      "region": "",                       
      "endpoint": "http://localhost:8081",
      "sslEnabled": false                 
  }               
  
  var AWS = require('aws-sdk');
  // loaded the config into an object called `config`:
  
  AWS.config.update(config.aws);
  s3 = new AWS.S3();
  // also tried creating an `EndPoint`:
  s3.endpoint = new AWS.Endpoint(config.aws.endpoint);  
  </code></pre>
  
  <p>When I try simple code like:</p>
  
  <pre><code>s3.putObject({ Bucket: 'logging', Key: "logging123", Body: "started" }, 
     function(err, data) {
     if (err) {
         console.log(err);
     }
  });
  </code></pre>
  
  <p>The error mentioned above occurs. When I leave out directly setting the <code>endPoint</code>, the request is made to the East AWS region (and ignores the <code>endpoint</code> value I've passed in via configuration).</p>
  
  <p>And, I'm running <code>fakes3</code> using the command line:</p>
  
  <pre><code>fakes3 -r c:\temp\_fakes3 -p 8081
  Loading FakeS3 with c:/temp/_fakes3 on port 8081 with hostname s3.amazonaws.com
  [2013-11-30 14:20:22] INFO  WEBrick 1.3.1
  [2013-11-30 14:20:22] INFO  ruby 2.0.0 (2013-06-27) [x64-mingw32]
  [2013-11-30 14:20:22] INFO  WEBrick::HTTPServer#start: pid=11800 port=8081
  </code></pre>