Class: AWS.SharedIniFileCredentials
- Inherits:
-
AWS.Credentials
- Object
- AWS.Credentials
- AWS.SharedIniFileCredentials
- Defined in:
- lib/credentials/shared_ini_file_credentials.js
Overview
Note:
This feature is not supported in the browser environment of the SDK.
Represents credentials loaded from shared credentials file
(defaulting to ~/.aws/credentials or defined by the
AWS_SHARED_CREDENTIALS_FILE
environment variable).
Using the shared credentials file
This provider is checked by default in the Node.js environment. To use the credentials file provider, simply add your access and secret keys to the ~/.aws/credentials file in the following format:
[default]
aws_access_key_id = AKID...
aws_secret_access_key = YOUR_SECRET_KEY
Using custom profiles
The SDK supports loading credentials for separate profiles. This can be done in two ways:
- Set the
AWS_PROFILE
environment variable in your process prior to loading the SDK. - Directly load the AWS.SharedIniFileCredentials provider:
var creds = new AWS.SharedIniFileCredentials({profile: 'myprofile'});
AWS.config.credentials = creds;
Constructor Summary
-
new AWS.SharedIniFileCredentials(options) ⇒ void
constructor
Creates a new SharedIniFileCredentials object.
Property Summary
Properties inherited from AWS.Credentials
expired, expireTime, accessKeyId, secretAccessKey, sessionToken, expiryWindow
Method Summary
-
refresh(callback) ⇒ void
Loads the credentials from the shared credentials file.
Methods inherited from AWS.Credentials
needsRefresh, get, getPromise, refreshPromise