Load credentials from EC2 instance metadata #78

Merged
merged 16 commits into from Mar 18, 2013

Projects

None yet

1 participant

@lsegal
Contributor
lsegal commented Mar 15, 2013

Updates the credential resolvers to work asynchronously. This adds a few semi-backward incompatible changes:

  • Credentials.refresh() now takes a callback that returns a potential error from resolution.
  • CredentialProviderChain.resolve() no longer returns a credentials object, instead takes a callback that returns (err, creds).
  • Adds Credentials.get() that should be used in asynchronous scenarios.
  • Adds Config.getCredentials() as the standard mechanism to get credentials with async support. This method will search the credentials object if set, and use the credentialProvider property otherwise.
  • Adds the Config.credentialProvider option to resolve credentials if not statically assigned with credentials.
  • Also adds AWS.MetadataService to query the instance metadata (used by EC2MetadataCredentials under the hood).
Loren Segal added some commits Mar 12, 2013
Loren Segal Refactor HTTP client to use HttpRequest objects directly cfc4839
Loren Segal Add test to ensure cert bundle only gets loaded once d72b80d
Loren Segal Allow copy construction of AWS.Endpoint 8665890
Loren Segal Disallow null/undefined endpoint arguments 937229e
Loren Segal Allow path to be overridden in HttpClient by HttpRequest 6ca207c
Loren Segal 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
380009a
Loren Segal Add AWS.MetadataService to query EC2 instance metadata bdc6fbb
Loren Segal Bind all doneCallback functions to emitter f1eba40
Loren Segal Close HTTP socket properly in event of timeout 5a30f30
Loren Segal Update tests to use new HttpClient.handleRequest method 187bc6c
Loren Segal Allow credentials to be loaded asynchronously
* Add Config.getCredentials
* Add Credentials.{get,needsRefresh}
* Add EC2MetadataCredentials
2041e09
Loren Segal Fix loading of credentials for EC2MetadataCredentials 52177fa
Loren Segal Mark integration tests that cannot be run with vended credentials 75f2073
Loren Segal Refactoring on config and event listeners 5b2b4c7
Loren Segal Refactor SigV2 and query params to support re-signing d4fc3e9
Loren Segal Add documentation for MetadataService and credentials classes 40d2159
@lsegal lsegal merged commit 33db812 into master Mar 18, 2013

1 check failed

default The Travis build could not complete due to an error
Details
@lsegal lsegal deleted the ec2metadata branch Mar 18, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment