Class: AWS.FileSystemCredentials

AWS.Credentials show all
Defined in:



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

Represents credentials from a JSON file on disk. If the credentials expire, the SDK can refresh() the credentials from the file.

The format of the file should be similar to the options passed to AWS.Config:

{accessKeyId: 'akid', secretAccessKey: 'secret', sessionToken: 'optional'}


Loading credentials from disk

var creds = new AWS.FileSystemCredentials('./configuration.json');
creds.accessKeyId == 'AKID'

Constructor Summary collapse

Property Summary collapse

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.FileSystemCredentials(filename) ⇒ void

Creates a new FileSystemCredentials object from a filename


  • filename (String)

    the path on disk to the JSON file to load.

Property Details

filenameString (readonly)

Returns the path to the JSON file on disk containing the credentials.


  • (String)

    the path to the JSON file on disk containing the credentials.

Method Details

refresh(callback) ⇒ void

Loads the credentials from the filename on disk.

Callback (callback):

  • function(err) { ... }

    Called after the JSON file on disk is read and parsed. When this callback is called with no error, it means that the credentials information has been loaded into the object (as the accessKeyId, secretAccessKey, and sessionToken properties).


    • err (Error)

      if an error occurred, this value will be filled

See Also:

  • AWS.FileSystemCredentials.get