I have my nodejs lambda trying to index data into ES, but it's failing because of this error:
2018-01-15T23:39:09.578Z (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 131): Authorization Exception ::
User: anonymous is not authorized to perform: es:ESHttpPost on resource: ****
I have applied AmazonESFullAccess policy to the Lambda function role.
What am I missing?
I was able to resolve this issue. Code was missing 'connectionClass' and 'amazonES' parameters.
var AWS = require('aws-sdk');
var connectionClass = require('http-aws-es');
var elasticsearch = require('elasticsearch');
var elasticClient = new elasticsearch.Client({
host: ***,
log: 'error',
connectionClass: connectionClass,
amazonES: {
credentials: new AWS.EnvironmentCredentials('AWS')
}
});
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