From the information provided in the AWS SDK config guide there are multiple ways to configure the SDK:
Is there a way to determine:
a) If the SDK has global config (credentials) and b) how those credentials/settings were loaded/configured?
So it appears you can look into the config's credentialProvider object which is a CredentialProviderChain. Its resolve() method returns an instance of a AWS.Credentials which will identify which method is used for configuring credentials.
Example as follows:
AWS.config.credentialProvider.resolve(function(err, credential) {
if(credential !== null) {
awsCredential = credential.constructor.name;
})
console.log("AWS configured? ", awsCredential ? 'yes'.green : 'no'.red);
if(awsCredential) {
console.log(" Provided by: ", awsCredential);
}
Specifically noting that the returned credential reveals its classname via credential.constructor.name.
Edit: I've now written this up as a post comparing the use of callbacks to promises to achieve the same goal - just in case anyone else encounters the same question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With