Reputation: 4078
Aws Lambda not picking up credentials even after attaching a role to lambda that has AWSLambdaBasicExecutionRole. I added few more logs to check if its trying to load SharedIniFileCredentials but it didnt.
start: async (startParams) => {
logger.info(startParams);
if (startParams === konstants.LOCAL_ENVIRONMENT) {
logger.info('load credentials only for local');
AWS.config.credentials = new AWS.SharedIniFileCredentials();
}
message: 'Missing credentials in config',
errno: -2,
syscall: 'open',
code: 'CredentialsError',
path: '/home/sbx_user1051/.aws/credentials',
time: 2020-03-04T03:55:47.923Z,
originalError:
{ message: 'Could not load credentials from SharedIniFileCredentials',
errno: -2,
syscall: 'open',
Upvotes: 0
Views: 647
Reputation: 238131
Docs write:
The execution role provides the Lambda function with the credentials it needs to run and to invoke other web services. As a result, you do not need to provide credentials to the Node.js code you write within a Lambda function.
So I think you should re-think how are you writing your node.js lambda function.
Upvotes: 3