npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

aws-elasticsearch-connector

8.1.3 • Public • Published

aws-elasticsearch-connector

Build Status Code Climate Test Coverage Dependency Status Download Status

A tiny Amazon Signature Version 4 connection class for the official Elasticsearch Node.js client, for compatibility with AWS Elasticsearch and IAM authentication.

For legacy Elasticsearch.js 16.x support, use version 7.x of this library.

Installation

npm install --save aws-elasticsearch-connector @elastic/elasticsearch aws-sdk

Example usage

With specific credentials

const { Client } = require('@elastic/elasticsearch');
 
const client = new Client({
  node: 'my-elasticsearch-cluster.us-east-1.es.amazonaws.com'
  Connection: require('aws-elasticsearch-connector'),
  awsConfig: {
    credentials: {
      accessKeyId: 'foo',
      secretAccessKey: 'bar',
      sessionToken: 'baz' // optional
    }
  }
});

With credentials from AWS.Config

const AWS = require('aws-sdk');
const { Client } = require('@elastic/elasticsearch');
 
// Load AWS profile credentials
AWS.config.update({
  profile: 'my-profile'
});
 
const client = new Client({
  node: 'my-elasticsearch-cluster.us-east-1.es.amazonaws.com'
  Connection: require('aws-elasticsearch-connector')
});

With credentials from the environment

AWS_ACCESS_KEY_ID=foo      # alias: AWS_ACCESS_KEY
AWS_SECRET_ACCESS_KEY=bar  # alias: AWS_SECRET_KEY
AWS_SESSION_TOKEN=baz
const { Client } = require('@elastic/elasticsearch');
 
const client = new Client({
  node: 'my-elasticsearch-cluster.us-east-1.es.amazonaws.com'
  Connection: require('aws-elasticsearch-connector'),
});

Test

npm test
 
# Run integration tests against a real endpoint 
AWS_PROFILE=your-profile npm run test:integration -- \
  --endpoint https://amazon-es-host.us-east-1.es.amazonaws.com

install

npm i aws-elasticsearch-connector

Downloadsweekly downloads

678

version

8.1.3

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability