We announced the upcoming end-of-support for AWS SDK for JavaScript v2.
We recommend that you migrate to AWS SDK for JavaScript v3. For dates, additional details, and information on how to migrate, please refer to the linked announcement.

Class: AWS.RemoteCredentials

Inherits:
AWS.Credentials show all
Defined in:
lib/credentials/remote_credentials.js

Overview

Note:

This feature is not supported in the browser environment of the SDK.

Represents credentials received from specified URI.

This class will request refreshable credentials from the relative URI specified by the AWS_CONTAINER_CREDENTIALS_RELATIVE_URI or the AWS_CONTAINER_CREDENTIALS_FULL_URI environment variable. If valid credentials are returned in the response, these will be used with zero configuration.

This credentials class will by default timeout after 1 second of inactivity and retry 3 times. If your requests to the relative URI are timing out, you can increase the value by configuring them directly:

AWS.config.credentials = new AWS.RemoteCredentials({
  httpOptions: { timeout: 5000 }, // 5 second timeout
  maxRetries: 10, // retry 10 times
  retryDelayOptions: { base: 200 } // see AWS.Config for information
});

Constructor Summary collapse

Property Summary

Properties inherited from AWS.Credentials

expired, expireTime, accessKeyId, secretAccessKey, sessionToken, expiryWindow

Method Summary collapse

Methods inherited from AWS.Credentials

needsRefresh, get, getPromise, refreshPromise

Constructor Details

new AWS.RemoteCredentials(options) ⇒ void

Method Details

refresh(callback) ⇒ void

Loads the credentials from the relative URI specified by container

Callback (callback):

  • function(err) { ... }

    Called when the request to the relative URI responds (or fails). When this callback is called with no error, it means that the credentials information has been loaded into the object (as the accessKeyId, secretAccessKey, sessionToken, and expireTime properties).

    Parameters:

    • err (Error)

      if an error occurred, this value will be filled

See Also:

  • AWS.RemoteCredentials.get