I want to access my AWS credentials that I saved in C:/Users/myusername/.aws The file is called credentials without any extension and it has my aws_access_key_id, aws_secret_access_key and aws_session_token
The code below does not work on windows 10 WSL,producing error : Error: connect ECONNREFUSED 169.254.169.254:80 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1121:14)
The code works on ubuntu, with the credentials saved in .aws folder in the home directory.
var AWS = require("aws-sdk");
AWS.config.getCredentials(function (err) {
if (err) console.log(err.stack);
// credentials not loaded
else {
console.log("Access key:", AWS.config.credentials.accessKeyId);
console.log("Secret access key:", AWS.config.credentials.secretAccessKey);
}
});