New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@talaikis/aws-es-connection

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@talaikis/aws-es-connection

AWS ElasticSearch connection for the @elastic/elasticsearch ES client

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

AWS ES Connection

AWS ES connection for the new elasticsearch client (@elastic/elasticsearch)

!!! this fork accepts local config instead of global.

Usage

Javascript:

const { Client } = require('@elastic/elasticsearch');
const { createAWSConnection, awsCredsifyAll, awsGetCredentials } = require('@acuris/aws-es-connection')

const awsCredentials = await awsGetCredentials()
const AWSConnection = createAWSConnection(awsCredentials)
const client = awsCredsifyAll(
  new Client({
    node: 'https://node-name.eu-west-1.es.amazonaws.com',
    Connection: AWSConnection
  })
)

// inside async func
await client.cat.help()

Typescript:

import { createAWSConnection, awsCredsifyAll, awsGetCredentials } from '@acuris/aws-es-connection'
import AWS from 'aws-sdk'
import { Client } from '@elastic/elasticsearch'

const awsCredentials = await awsGetCredentials()
const AWSConnection = createAWSConnection(awsCredentials)
const client = awsCredsifyAll(
  new Client({
    node: 'https://node-name.eu-west-1.es.amazonaws.com',
    Connection: AWSConnection
  })
)

// inside async func
await client.cat.help()

How does it work?

This package has two parts. Firstly the createAWSConnection returns a class which signs the calls to AWS elasticsearch. The second part - awsCredsifyAll wraps the elastic search client so that all calls first check that the AWS credentials haven't expired and refreshes them when needed.

Developer notes

Running the tests.

Make sure that your AWS credentials are available to your env, for example you could set them in your ENV.

You need a running AWS ES instance for the tests to run against. Set the endpoint URL as the env AWS_ES_ENDPOINT.

AWS_ES_ENDPOINT=https://xxxx.es.amazonaws.com yarn test

Keywords

FAQs

Package last updated on 08 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc