Class: AWS.EnvironmentCredentials
- Inherits:
-
AWS.Credentials
- Object
- AWS.Credentials
- AWS.EnvironmentCredentials
- Defined in:
- lib/credentials/environment_credentials.js
Overview
Represents credentials from the environment.
By default, this class will look for the matching environment variables prefixed by a given envPrefix. The un-prefixed environment variable names for each credential value is listed below:
accessKeyId: ACCESS_KEY_ID
secretAccessKey: SECRET_ACCESS_KEY
sessionToken: SESSION_TOKEN
With the default prefix of 'AWS', the environment variables would be:
AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN
Constructor Summary
-
new AWS.EnvironmentCredentials(envPrefix) ⇒ void
constructor
Creates a new EnvironmentCredentials class with a given variable prefix envPrefix.
Property Summary
-
envPrefix ⇒ String
readonly
The prefix for the environment variable names excluding the separating underscore ('_').
Properties inherited from AWS.Credentials
expired, expireTime, accessKeyId, secretAccessKey, sessionToken, expiryWindow
Method Summary
-
refresh(callback) ⇒ void
Loads credentials from the environment using the prefixed environment variables.
Methods inherited from AWS.Credentials
needsRefresh, get, getPromise, refreshPromise
Constructor Details
new AWS.EnvironmentCredentials(envPrefix) ⇒ void
Creates a new EnvironmentCredentials class with a given variable prefix envPrefix. For example, to load credentials using the 'AWS' prefix:
var creds = new AWS.EnvironmentCredentials('AWS');
creds.accessKeyId == 'AKID' // from AWS_ACCESS_KEY_ID env var