lib/credentials/shared_ini_file_credentials.js
function refresh(callback) {
    if (!callback) callback = function(err) { if (err) throw err; };
    try {
      if (!this.filename) this.loadDefaultFilename();
      var creds = AWS.util.ini.parse(AWS.util.readFileSync(this.filename));
      if (typeof creds[this.profile] === 'object') {
        this.accessKeyId = creds[this.profile]['aws_access_key_id'];
        this.secretAccessKey = creds[this.profile]['aws_secret_access_key'];
        this.sessionToken = creds[this.profile]['aws_session_token'];
      }

      if (!this.accessKeyId || !this.secretAccessKey) {
        throw new Error('Credentials not set in ' + this.filename +
                        ' using profile ' + this.profile);
      }
      this.expired = false;
      callback();
    } catch (err) {
      callback(err);
    }
  }
function refresh(callback) {
    if (!callback) callback = function(err) { if (err) throw err; };
    try {
      if (!this.filename) this.loadDefaultFilename();
      var creds = AWS.util.ini.parse(AWS.util.readFileSync(this.filename));
      if (typeof creds[this.profile] === 'object') {
        this.accessKeyId = creds[this.profile]['aws_access_key_id'];
        this.secretAccessKey = creds[this.profile]['aws_secret_access_key'];
        this.sessionToken = creds[this.profile]['aws_session_token'];
      }

      if (!this.accessKeyId || !this.secretAccessKey) {
        throw new Error('Credentials not set in ' + this.filename +
                        ' using profile ' + this.profile);
      }
      this.expired = false;
      callback();
    } catch (err) {
      callback(err);
    }
  }
function refresh ( callback ) { if ( ! callback ) callback = function ( err ) { if ( err ) throw err ; } ; try { if ( ! this . filename ) this . loadDefaultFilename ( ) ; var creds = AWS . util . ini . parse ( AWS . util . readFileSync ( this . filename ) ) ; if ( typeof creds [ this . profile ] === 'object' ) { this . accessKeyId = creds [ this . profile ] [ 'aws_access_key_id' ] ; this . secretAccessKey = creds [ this . profile ] [ 'aws_secret_access_key' ] ; this . sessionToken = creds [ this . profile ] [ 'aws_session_token' ] ; } if ( ! this . accessKeyId || ! this . secretAccessKey ) { throw new Error ( 'Credentials not set in ' + this . filename + ' using profile ' + this . profile ) ; } this . expired = false ; callback ( ) ; } catch ( err ) { callback ( err ) ; } }
Loads the credentials from the instance metadata service

@callback callback function(err)
Called when the instance metadata service 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`, and `sessionToken` properties).
@param err [Error] if an error occurred, this value will be filled
@see get
Loads the credentials from the instance metadata service