Aws-sdk-js: ElasticSearch Client with Request Signing

Created on 14 Oct 2015  路  13Comments  路  Source: aws/aws-sdk-js

I see there is an ES Service object that allows programmatic management of an ElasticSearch cluster. However, I do not see an ElasticSearch Client API. This would be incredibly useful because it could implement AWS Authentication via Request Signing:

http://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-managedomains.html#es-managedomains-signing-service-requests

Is an ElasticSearch client on the roadmap for the aws-sdk?

feature-request

Most helpful comment

I used elasticsearch, http-aws-es and aws-sdk:

var AWS = require('aws-sdk'),
  es = require('elasticsearch').Client({
    host: 'es-host',
    connectionClass: require('http-aws-es'),
    amazonES: {
      region: 'us-east-1',
      credentials: new AWS.EnvironmentCredentials('AWS')
    }
  });

//es.search()

All 13 comments

Thanks for suggesting this! We're looking into how to support sending signed requests to the Amazon ES search API.

Are you currently using an Elasticsearch client? If so, which one?

I would also like to see this feature. I'm currently using the official elasticsearch.js client which handle some API features like bulk requests which can be tricky to do via a standard HTTP call.

I'd also like to see this. Currently using the official elasticsearch client for javascript.

I saw this project on the Elasticsearch.js docs. I haven't tested it, but it looks like that library would allow you to use AWS authentication with the official elasticsearch.js client.

I'm going to close this issue, as it looks like the http-aws-es project will take care of signing Amazon ES requests.

Please feel free to reopen if you have any questions or concerns.

@jeskew how are you managing the signing of requests with that module? I'm trying to use that module with IAM roles for Amazon EC2 but that currently doesn't work until sometimes like https://github.com/TheDeveloper/http-aws-es/pull/1 gets merged.

How about using it with the standard ES Java REST Client?

I used elasticsearch, http-aws-es and aws-sdk:

var AWS = require('aws-sdk'),
  es = require('elasticsearch').Client({
    host: 'es-host',
    connectionClass: require('http-aws-es'),
    amazonES: {
      region: 'us-east-1',
      credentials: new AWS.EnvironmentCredentials('AWS')
    }
  });

//es.search()

This is similar what i've done ^^^

The amazonES not work fine for me, its not set the amazon credential. Work for me of this way.

var AWS = require('aws-sdk');
AWS.config.update({
    credentials: new AWS.Credentials(ACCESKEY, SECRETKEY),
    region: 'us-east-1'
});

var client = require('elasticsearch').Client({
    host: 'https:..',
    connectionClass: require('http-aws-es')
});

@skilledDeveloper I am getting "No Living connections" when following your solution. Where am I going wrong? Can someone help me?

const AWS = require('aws-sdk');
const config = require('../../configuration');
const elasticsearch = require('elasticsearch');

const esClient = new elasticsearch.Client({
  host: config.get('elasticsearch.rental.host'),
  log: config.get('elasticsearch.log_level'),
  connectionClass: require('http-aws-es'),
  amazonES: {
    region: 'us-west-2',
    credentials: new AWS.EnvironmentCredentials('AWS'),
  },
});

module.exports = esClient;

using this when i tried to use cognito unauthRole it is denying my request .a added the unauth role arn to elasticsearch policy as well

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

Was this page helpful?
0 / 5 - 0 ratings