# aws-es-utils

> Utilities to connect with Amazon Elasticsearch Service (using AWS signed request)

Latest version **1.1.0** (published 2019-04-01) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install aws-es-utils
pnpm add aws-es-utils
yarn add aws-es-utils
bun add aws-es-utils
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2019-04-01 |
| First published | 2017-07-06 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 0 |
| Unpacked size | 29.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Vick Vu |
| Maintainers | vickvu |
| Keywords | elasticsearch, aws, amazon, es, request, signed, utils |

## Links

- npm: https://www.npmjs.com/package/aws-es-utils
- Repository: https://github.com/vickvu/node-aws-es-utils
- Issues: https://github.com/vickvu/node-aws-es-utils/issues
- npm.io page: https://npm.io/package/aws-es-utils

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2019-04-01
- 1.0.0 — 2018-10-02
- 0.6.1 — 2018-01-24
- 0.6.0 — 2017-07-11
- 0.5.2 — 2017-07-08
- 0.5.1 — 2017-07-07
- 0.5.0 — 2017-07-06

## README

# AWS Elasticsearch Utils

[![Greenkeeper badge](https://badges.greenkeeper.io/vickvu/node-aws-es-utils.svg)](https://greenkeeper.io/)

[![NPM](https://nodei.co/npm/aws-es-utils.png)](https://npmjs.org/package/aws-es-utils)

[![Build Status](https://travis-ci.org/vickvu/node-aws-es-utils.svg?branch=master)](https://travis-ci.org/vickvu/node-aws-es-utils)
[![Coverage Status](https://coveralls.io/repos/github/vickvu/node-aws-es-utils/badge.svg?branch=master)](https://coveralls.io/github/vickvu/node-aws-es-utils?branch=master)
[![Known Vulnerabilities](https://snyk.io/test/github/vickvu/node-aws-es-utils/badge.svg)](https://snyk.io/test/github/vickvu/node-aws-es-utils)

## Sign request
If you limit your [Amazon Elasticsearch Service](https://aws.amazon.com/elasticsearch-service/) with an IAM role, you will need to [sign every http request](http://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-managedomains.html#es-managedomains-signing-service-requests) made to the service. The function `createESConnectorClass` creates a new class that can be used as a drop-in replacement for [Elasticsearch default class](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/extending_core_components.html#_connection). For example:
```javascript
var elasticsearch = require('elasticsearch');
var esHttpConnector = require('elasticsearch/src/lib/connectors/http');
var AWS = require('aws-sdk');
var awsEs = require('aws-es-utils');
var let client = new elasticsearch.Client({
  host: 'https://xxxx.ap-southeast-2.es.amazonaws.com',
  connectionClass: awsEs.createESConnectorClass({
    AWS: AWS,
    superClass: esHttpConnector
  }),
  awsRequestSigning: true
});
```
Extra [config](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/configuration.html) to Elasticsearch client constructor
 - `awsRequestSigning` (boolean): enable AWS request signing
 - `awsRegion` (string | optional): [AWS region](http://docs.aws.amazon.com/general/latest/gr/rande.html). If this property is missing, the class will try to parse the region from the host name.
 - `awsCredential` (object | optional): optional [AWS credentials](http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html). If this property is missing, the class will try to use [AWS.CredentialProviderChain](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CredentialProviderChain.html) to retrieve the default credential. This property could be either an [AWS.Credentials](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Credentials.html) object or a normal object with the following properties:
   - `accessKeyId` (string): the [AWS access key ID](http://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys)
   - `secretAccessKey` (string): the [AWS secret access key](http://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys)
   - `sessionToken` (string): the optional AWS session token (the string you received from AWS STS when you obtained temporary security credentials))
 - `headers` (object): extra headers to send to ElasticSearch

 # License
 This project is licensed under the terms of the [Apache license](./LICENSE).

---
_Source: https://npm.io/package/aws-es-utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
