Add timeout setting per API call #5

nilskassube opened this Issue Dec 7, 2012 · 1 comment


None yet
2 participants

It should be possible to add timeout settings per API call. Please also document how to best handle timeouts globally for all AWS SDK API calls.

lsegal added a commit that referenced this issue Mar 15, 2013

Add httpOptions to Config and allow HTTP timeout
    var s3 = new AWS.S3({httpOptions: {timeout: 500}});
    s3.client.getObject(params, function(err, data) {
      // err.code can be a TimeoutError

httpOptions can also contain other HTTP level options, like `agent`,
which sets the `http.Agent` object to use in the request.

Creating a custom connection pool for a specific client over HTTP:

  var http = require('http');
  var agent = new http.Agent({maxSockets: 20}); // pool size = 20
  var options = {sslEnabled: false, httpOptions: {agent: agent}};
  var s3 = new AWS.S3(options);

Note that increasing the connection pool size over HTTPS connections
increases overhead for short-running processes.

Closes #5

@lsegal lsegal closed this in 380009a Mar 18, 2013

lsegal added a commit that referenced this issue Mar 18, 2013

Merge pull request #78 from aws/ec2metadata
Load credentials from EC2 instance metadata

Adds a number of changes:

* Refactors Credential loading to support asynchronous requests.
* Support for passing low-level HTTP options to HttpClient through Config

Fixes #5
Fixes #50

lsegal commented Mar 18, 2013

This is now supported by either globally setting:

AWS.Config.httpOptions = {timeout: 5000};

Or per-service:

s3 = new AWS.S3({httpOptions: {timeout: 5000}});

Note that all timeout values are in milliseconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment